Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if(a > b)
puts("a > b");
else if(a < b)
puts("a < b");
else
puts("a == b");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244494/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244494/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp2 = icmp slt i32 %0, %1
%.str.2..str.3 = select i1 %cmp2, ptr @.str.2, ptr @.str.3
%.str.2.sink = select i1 %cmp, ptr @.str.1, ptr %.str.2..str.3
%call4 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (a < b) printf("a < b\n");
else if (a > b) printf("a > b\n");
else printf("a == b\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244537/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244537/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a ,b;
scanf("%d %d" ,&a ,&b);
if(a < b){
printf("a < b\n");
}else if(a > b){
printf("a > b\n");
}else if(a == b){
printf("a == b\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244588/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244588/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.end10.sink.split, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, %1
br i1 %cmp2, label %if.end10.sink.split, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp eq i32 %0, %1
br i1 %cmp6, label %if.end10.sink.split, label %if.end10
if.end10.sink.split: ; preds = %if.else5, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.4, %if.else ], [ @str, %if.else5 ]
%puts12 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
br label %if.end10
if.end10: ; preds = %if.end10.sink.split, %if.else5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a, b;
scanf( "%d %d", &a, &b );
if( a > b)
printf( "a > b\n" );
else if( a < b )
printf( "a < b\n" );
else
printf( "a == b\n" );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244630/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244630/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp2 = icmp slt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a, b;
scanf("%d %d", &a, &b);
if(a > b)
printf("a > b\n");
else if(a < b)
printf("a < b\n");
else if(a == b)
printf("a == b\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244674/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244674/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.end10.sink.split, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp slt i32 %0, %1
br i1 %cmp2, label %if.end10.sink.split, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp eq i32 %0, %1
br i1 %cmp6, label %if.end10.sink.split, label %if.end10
if.end10.sink.split: ; preds = %if.else5, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.4, %if.else ], [ @str, %if.else5 ]
%puts12 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
br label %if.end10
if.end10: ; preds = %if.end10.sink.split, %if.else5
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;
while(scanf("%d %d",&a,&b)!=EOF){
if(a>b)
printf("a > b\n");
if(a<b)
printf("a < b\n");
if(a==b)
printf("a == b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244717/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244717/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.5 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not14 = icmp eq i32 %call13, -1
br i1 %cmp.not14, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end10
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, %1
br i1 %cmp1, label %if.then, label %if.end
if.then: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre15 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%2 = phi i32 [ %.pre15, %if.then ], [ %1, %while.body ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %while.body ]
%cmp3 = icmp slt i32 %3, %2
br i1 %cmp3, label %if.then4, label %if.end6
if.then4: ; preds = %if.end
%puts11 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
%.pre16 = load i32, ptr %a, align 4, !tbaa !5
%.pre17 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then4, %if.end
%4 = phi i32 [ %.pre17, %if.then4 ], [ %2, %if.end ]
%5 = phi i32 [ %.pre16, %if.then4 ], [ %3, %if.end ]
%cmp7 = icmp eq i32 %5, %4
br i1 %cmp7, label %if.then8, label %if.end10
if.then8: ; preds = %if.end6
%puts12 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end10
if.end10: ; preds = %if.then8, %if.end6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end10, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int a,b;
scanf("%d",&a);
scanf("%d",&b);
if(a<b)
puts("a < b");
else if(a>b)
puts("a > b");
else
puts("a == b");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244768/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244768/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"a < b\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp3 = icmp sgt i32 %0, %1
%.str.2..str.3 = select i1 %cmp3, ptr @.str.2, ptr @.str.3
%.str.2.sink = select i1 %cmp, ptr @.str.1, ptr %.str.2..str.3
%call5 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a, b;
scanf("%d %d", &a, &b);
if(a < b){
printf("a < b\n");
} else if(a == b){
printf("a == b\n");
}else{
printf("a > b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244810/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244810/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.4 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp eq i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
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 <string.h>
int main(void)
{
int a, b;
char buf[256], rel[3];
rel[2] = '\0';
fgets(buf, 256, stdin);
buf[255] = '\0';
sscanf(buf, "%d %d", &a, &b);
a = a - b;
if (a)
{
if (a & 0x80000000)
rel[0] = '<';
else
rel[0] = '>';
rel[1] = 0;
}
else
memset(rel, '=', 2);
printf("a %s b\n", rel);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244861/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244861/source.c"
target datalayout = "e-m:e-p270: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 [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"a %s b\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
%buf = alloca [256 x i8], align 16
%rel = alloca [3 x i8], align 2
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 256, ptr nonnull %buf) #3
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %rel) #3
%arrayidx = getelementptr inbounds [3 x i8], ptr %rel, i64 0, i64 2
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%0 = load ptr, ptr @stdin, align 8, !tbaa !8
%call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 256, ptr noundef %0)
%arrayidx1 = getelementptr inbounds [256 x i8], ptr %buf, i64 0, i64 255
store i8 0, ptr %arrayidx1, align 1, !tbaa !5
%call3 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %buf, ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) #3
%1 = load i32, ptr %a, align 4, !tbaa !10
%2 = load i32, ptr %b, align 4, !tbaa !10
%sub = sub nsw i32 %1, %2
store i32 %sub, ptr %a, align 4, !tbaa !10
%tobool.not = icmp eq i32 %1, %2
br i1 %tobool.not, label %if.else9, label %if.then
if.then: ; preds = %entry
%tobool4.not = icmp sgt i32 %sub, -1
%. = select i1 %tobool4.not, i8 62, i8 60
store i8 %., ptr %rel, align 2, !tbaa !5
%arrayidx8 = getelementptr inbounds [3 x i8], ptr %rel, i64 0, i64 1
store i8 0, ptr %arrayidx8, align 1, !tbaa !5
br label %if.end11
if.else9: ; preds = %entry
store i16 15677, ptr %rel, align 2
br label %if.end11
if.end11: ; preds = %if.else9, %if.then
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %rel)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %rel) #3
call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %buf) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
|
#include <stdio.h>
int main(){
int a, b;
scanf("%d%d", &a, &b);
if ( a < b) {
printf("a < b\n");
} else if (a > b){
printf("a > b\n");
} else if (a == b){
printf("a == b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244911/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244911/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.end10.sink.split, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, %1
br i1 %cmp2, label %if.end10.sink.split, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp eq i32 %0, %1
br i1 %cmp6, label %if.end10.sink.split, label %if.end10
if.end10.sink.split: ; preds = %if.else5, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.4, %if.else ], [ @str, %if.else5 ]
%puts12 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
br label %if.end10
if.end10: ; preds = %if.end10.sink.split, %if.else5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a,b;
scanf("%d%d",&a,&b);
if(a<b)printf("a < b\n");
else if(a>b)printf("a > b\n");
else printf("a == b\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_244955/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_244955/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a, b;
scanf("%d %d",&a,&b);
if(a < b){
printf("a < b\n");
}
if(a > b){
printf("a > b\n");
}
if(a == b){
printf("a == b\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245004/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245004/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre12 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %.pre12, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%cmp2 = icmp sgt i32 %3, %2
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
%puts10 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
%.pre13 = load i32, ptr %a, align 4, !tbaa !5
%.pre14 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%4 = phi i32 [ %.pre14, %if.then3 ], [ %2, %if.end ]
%5 = phi i32 [ %.pre13, %if.then3 ], [ %3, %if.end ]
%cmp6 = icmp eq i32 %5, %4
br i1 %cmp6, label %if.then7, label %if.end9
if.then7: ; preds = %if.end5
%puts11 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end9
if.end9: ; preds = %if.then7, %if.end5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a,b;
scanf("%d %d",&a,&b);
if (a<b)
printf("a < b\n");
else
if (a>b)
printf("a > b\n");
else
if (a==b)
printf("a == b\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245048/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245048/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.end10.sink.split, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, %1
br i1 %cmp2, label %if.end10.sink.split, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp eq i32 %0, %1
br i1 %cmp6, label %if.end10.sink.split, label %if.end10
if.end10.sink.split: ; preds = %if.else5, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.4, %if.else ], [ @str, %if.else5 ]
%puts12 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
br label %if.end10
if.end10: ; preds = %if.end10.sink.split, %if.else5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a, b;
scanf("%d %d", &a, &b);
if(a == b){
printf("a == b\n");
}else if(a > b){
printf("a > b\n");
}else{
printf("a < b\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245105/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245105/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
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"}
|
/*氏名:保坂優介, 学籍番号:200441141
概要:二つの数の大小を判別する*/
#include<stdio.h>
int main(void)
{
int a, b; //変数の宣言
scanf("%d %d", &a, &b); //入力
if (a < b) //a<bの場合
{
printf("a < b\n"); //出力
}
if (a > b) //a>bの場合
{
printf("a > b\n"); //出力
}
if (a == b) //a=bの場合
{
printf("a == b\n"); //出力
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245149/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245149/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre12 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %.pre12, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%cmp2 = icmp sgt i32 %3, %2
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
%puts10 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
%.pre13 = load i32, ptr %a, align 4, !tbaa !5
%.pre14 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%4 = phi i32 [ %.pre14, %if.then3 ], [ %2, %if.end ]
%5 = phi i32 [ %.pre13, %if.then3 ], [ %3, %if.end ]
%cmp6 = icmp eq i32 %5, %4
br i1 %cmp6, label %if.then7, label %if.end9
if.then7: ; preds = %if.end5
%puts11 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end9
if.end9: ; preds = %if.then7, %if.end5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main() {
int a, b;
scanf("%d%d", &a, &b);
if (a < b) printf("a < b\n");
else if (a > b) printf("a > b\n");
else printf("a == b\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245192/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245192/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
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>
int main(void) {
int a, b;
scanf("%d %d",&a,&b);
if(a<b)
printf("a < b\n");
else if(a==b)
printf("a == b\n");
else
printf("a > b\n");
return EXIT_SUCCESS;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245235/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245235/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.4 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp eq i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
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 = 0;
int b = 0;
scanf("%d%d",&a,&b);
if(a < b){
printf("a < b\n");
}
if(a > b){
printf("a > b\n");
}
if(a == b){
printf("a == b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245279/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245279/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
store i32 0, ptr %a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
store i32 0, ptr %b, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre12 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %.pre12, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%cmp2 = icmp sgt i32 %3, %2
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
%puts10 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
%.pre13 = load i32, ptr %a, align 4, !tbaa !5
%.pre14 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%4 = phi i32 [ %.pre14, %if.then3 ], [ %2, %if.end ]
%5 = phi i32 [ %.pre13, %if.then3 ], [ %3, %if.end ]
%cmp6 = icmp eq i32 %5, %4
br i1 %cmp6, label %if.then7, label %if.end9
if.then7: ; preds = %if.end5
%puts11 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end9
if.end9: ; preds = %if.then7, %if.end5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a, b; //Value a, b.
scanf("%d %d", &a, &b);
printf("a ");
if(a < b)
printf("< ");
if(a > b)
printf("> ");
if(a == b)
printf("== ");
printf("b\n");
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245321/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245321/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"a \00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"< \00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"> \00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"== \00", align 1
@str = private unnamed_addr constant [2 x i8] c"b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre12 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %.pre12, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%cmp3 = icmp sgt i32 %3, %2
br i1 %cmp3, label %if.then4, label %if.end6
if.then4: ; preds = %if.end
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
%.pre13 = load i32, ptr %a, align 4, !tbaa !5
%.pre14 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then4, %if.end
%4 = phi i32 [ %.pre14, %if.then4 ], [ %2, %if.end ]
%5 = phi i32 [ %.pre13, %if.then4 ], [ %3, %if.end ]
%cmp7 = icmp eq i32 %5, %4
br i1 %cmp7, label %if.then8, label %if.end10
if.then8: ; preds = %if.end6
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
br label %if.end10
if.end10: ; preds = %if.then8, %if.end6
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b;
scanf("%d%d", &a, &b);
if (a < b) printf("a < b\n");
else if (a > b) printf("a > b\n");
else printf("a == b\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245365/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245365/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a=0;
int b=0;
scanf("%d %d",&a,&b);
if(a<b){
puts("a < b");
}else if(a>b){
puts("a > b");
}else if(a==b){
puts("a == b");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245408/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
store i32 0, ptr %a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
store i32 0, ptr %b, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.end10.sink.split, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, %1
br i1 %cmp2, label %if.end10.sink.split, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp eq i32 %0, %1
br i1 %cmp6, label %if.end10.sink.split, label %if.end10
if.end10.sink.split: ; preds = %if.else5, %if.else, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ @.str.3, %if.else5 ]
%call4 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
br label %if.end10
if.end10: ; preds = %if.end10.sink.split, %if.else5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include "stdio.h"
int main(void)
{
int a,b;
scanf("%d %d",&a,&b);
if(a > b){
printf("a > b\n");
}else if(a < b){
printf("a < b\n");
}else{
printf("a == b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245451/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245451/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp2 = icmp slt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
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 argc, const char * argv[]) {
int a, b;
scanf("%d %d", &a, &b);
if (a<b) {
printf("a < b\n");
}else if (a>b) {
printf("a > b\n");
}else{
printf("a == b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245495/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245495/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a, b;
scanf("%d %d", &a, &b);
if (a < b){
printf("a < b\n");
} else if(a ==b){
printf("a == b\n");
} else {
printf("a > b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245545/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245545/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.4 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp eq i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a, b;
scanf("%d %d", &a, &b);
if(a<b){
printf("a < b\n");
}
else if(a>b){
printf("a > b\n");
}
else{
printf("a == b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245602/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245602/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
if (a>b) {
printf("a > b\n");
} else if (a<b) {
printf("a < b\n");
} else {
printf("a == b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245697/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245697/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp2 = icmp slt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
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>
int main()
{
long int a,b,x,y;
int t;
scanf("%d",&t);
while(t)
{
scanf("%ld%ld%ld%ld",&x,&y,&a,&b);
if((y-x)%(a+b)==0)
printf("%ld\n",(y-x)/(a+b));
else
printf("-1\n");
t--;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24574/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24574/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%ld%ld%ld%ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%.pr = load i32, ptr %t, align 4, !tbaa !5
%tobool.not6 = icmp eq i32 %.pr, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %y, align 8, !tbaa !9
%1 = load i64, ptr %x, align 8, !tbaa !9
%sub = sub nsw i64 %0, %1
%2 = load i64, ptr %a, align 8, !tbaa !9
%3 = load i64, ptr %b, align 8, !tbaa !9
%add = add nsw i64 %3, %2
%rem = srem i64 %sub, %add
%div = sdiv i64 %sub, %add
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.body
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %div)
br label %if.end
if.else: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
%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 %dec, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
if(a<b){
printf("a < b\n");
}else if(a==b){
printf("a == b\n");
}else{
printf("a > b\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245783/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245783/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.4 = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp eq i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
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>
int main(){
int a,b;
scanf("%d%d",&a,&b);
if(a<b) printf("a < b\n");
else if(a>b) printf("a > b\n");
else printf("a == b\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245826/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245826/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"a == b\00", align 1
@str.4 = private unnamed_addr constant [6 x i8] c"a > b\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"a < b\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp2 = icmp sgt i32 %0, %1
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
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>
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int x,y,a,b;
scanf("%d%d%d%d",&x,&y,&a,&b);
if((y-x)%(a+b)!=0)printf("-1\n");
else printf("%d\n",(y-x)/(a+b));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24587/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24587/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%dec6 = add nsw i32 %0, -1
store i32 %dec6, ptr %n, align 4, !tbaa !5
%tobool.not7 = icmp eq i32 %0, 0
br i1 %tobool.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i32, ptr %y, align 4, !tbaa !5
%2 = load i32, ptr %x, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
%3 = load i32, ptr %a, align 4, !tbaa !5
%4 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %4, %3
%rem = srem i32 %sub, %add
%div = sdiv i32 %sub, %add
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %while.body
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %div)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
%5 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %5, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %5, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX 12
#define MAX_ORDER 16777216
char dec[MAX_ORDER][MAX];
int getChar_ID(char c){
if(c == 'A'){
return 1;
}else if(c == 'C'){
return 2;
}else if(c == 'G'){
return 3;
}else if(c == 'T'){
return 4;
}else return -1;
}
long analysis(char *str){
int len = strlen(str);
int i;
int id=0;
int k=1;
//printf("in to analysis\n" );
for(i=0; i<len; i++){
id += k * getChar_ID(str[len-i-1]);
k *= 4;
//printf("len-i=%d\n",len-i );
//printf("Now ID: %d\n", id);
}
return id;
}
void insert(int id, char *str){
strcpy(dec[id],str);
}
void find(int id,char *str){
if(0==strcmp(dec[id],str)){
printf("yes\n" );
}else printf("no\n" );
}
int main() {
int n;
char str[MAX];
char com[7];
int i;
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%s %s",com,str);
if(com[0]=='i'){
insert(analysis(str),str);
}else if(com[0]=='f'){
find(analysis(str),str);
}else printf("Command is illegal\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245927/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245927/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dec = dso_local global [16777216 x [12 x i8]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@str.6 = private unnamed_addr constant [19 x i8] c"Command is illegal\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar_ID(i8 noundef signext %c) local_unnamed_addr #0 {
entry:
switch i8 %c, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ -1, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @analysis(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%conv = trunc i64 %call to i32
%cmp12 = icmp sgt i32 %conv, 0
br i1 %cmp12, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call, 4294967295
br label %for.body
for.body: ; preds = %for.body.preheader, %getChar_ID.exit
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %getChar_ID.exit ]
%k.015 = phi i32 [ 1, %for.body.preheader ], [ %mul4, %getChar_ID.exit ]
%id.014 = phi i32 [ 0, %for.body.preheader ], [ %add, %getChar_ID.exit ]
%0 = xor i64 %indvars.iv, -1
%sub2 = add i64 %call, %0
%sext = shl i64 %sub2, 32
%idxprom = ashr exact i64 %sext, 32
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar_ID.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar_ID.exit
if.then10.i: ; preds = %for.body
br label %getChar_ID.exit
if.then15.i: ; preds = %for.body
br label %getChar_ID.exit
if.else16.i: ; preds = %for.body
br label %getChar_ID.exit
getChar_ID.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i32 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ -1, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i32 %retval.0.i, %k.015
%add = add nsw i32 %mul, %id.014
%mul4 = shl nsw i32 %k.015, 2
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !8
for.end.loopexit: ; preds = %getChar_ID.exit
%2 = sext i32 %add to i64
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%id.0.lcssa = phi i64 [ 0, %entry ], [ %2, %for.end.loopexit ]
ret i64 %id.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(i32 noundef %id, ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %id to i64
%arrayidx = getelementptr inbounds [16777216 x [12 x i8]], ptr @dec, i64 0, i64 %idxprom
%call = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
ret void
}
; 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 #5
; Function Attrs: nofree nounwind uwtable
define dso_local void @find(i32 noundef %id, ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%idxprom = sext i32 %id to i64
%arrayidx = getelementptr inbounds [16777216 x [12 x i8]], ptr @dec, i64 0, i64 %idxprom
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #9
%cmp = icmp eq i32 %call, 0
%str.5.str = select i1 %cmp, ptr @str.5, ptr @str
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.5.str)
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%n = alloca i32, align 4
%str = alloca [12 x i8], align 1
%com = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %str) #10
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %com) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%cmp55 = icmp sgt i32 %0, 0
br i1 %cmp55, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.056 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
switch i8 %1, label %if.else18 [
i8 105, label %if.then
i8 102, label %if.then13
]
if.then: ; preds = %for.body
%call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%conv.i = trunc i64 %call.i to i32
%cmp12.i = icmp sgt i32 %conv.i, 0
br i1 %cmp12.i, label %for.body.preheader.i, label %analysis.exit
for.body.preheader.i: ; preds = %if.then
%wide.trip.count.i = and i64 %call.i, 4294967295
br label %for.body.i
for.body.i: ; preds = %getChar_ID.exit.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %getChar_ID.exit.i ]
%k.015.i = phi i32 [ 1, %for.body.preheader.i ], [ %mul4.i, %getChar_ID.exit.i ]
%id.014.i = phi i32 [ 0, %for.body.preheader.i ], [ %add.i, %getChar_ID.exit.i ]
%2 = xor i64 %indvars.iv.i, -1
%sub2.i = add i64 %call.i, %2
%sext.i = shl i64 %sub2.i, 32
%idxprom.i = ashr exact i64 %sext.i, 32
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %idxprom.i
%3 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i [
i8 65, label %getChar_ID.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar_ID.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar_ID.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar_ID.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar_ID.exit.i
getChar_ID.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ -1, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul nsw i32 %retval.0.i.i, %k.015.i
%add.i = add nsw i32 %mul.i, %id.014.i
%mul4.i = shl nsw i32 %k.015.i, 2
%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 %analysis.exit, label %for.body.i, !llvm.loop !8
analysis.exit: ; preds = %getChar_ID.exit.i, %if.then
%id.0.lcssa.i = phi i32 [ 0, %if.then ], [ %add.i, %getChar_ID.exit.i ]
%idxprom.i22 = sext i32 %id.0.lcssa.i to i64
%arrayidx.i23 = getelementptr inbounds [16777216 x [12 x i8]], ptr @dec, i64 0, i64 %idxprom.i22
%call.i24 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.i23, ptr noundef nonnull dereferenceable(1) %str) #10
br label %for.inc
if.then13: ; preds = %for.body
%call.i25 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%conv.i26 = trunc i64 %call.i25 to i32
%cmp12.i27 = icmp sgt i32 %conv.i26, 0
br i1 %cmp12.i27, label %for.body.preheader.i29, label %analysis.exit51
for.body.preheader.i29: ; preds = %if.then13
%wide.trip.count.i30 = and i64 %call.i25, 4294967295
br label %for.body.i31
for.body.i31: ; preds = %getChar_ID.exit.i40, %for.body.preheader.i29
%indvars.iv.i32 = phi i64 [ 0, %for.body.preheader.i29 ], [ %indvars.iv.next.i45, %getChar_ID.exit.i40 ]
%k.015.i33 = phi i32 [ 1, %for.body.preheader.i29 ], [ %mul4.i44, %getChar_ID.exit.i40 ]
%id.014.i34 = phi i32 [ 0, %for.body.preheader.i29 ], [ %add.i43, %getChar_ID.exit.i40 ]
%4 = xor i64 %indvars.iv.i32, -1
%sub2.i35 = add i64 %call.i25, %4
%sext.i36 = shl i64 %sub2.i35, 32
%idxprom.i37 = ashr exact i64 %sext.i36, 32
%arrayidx.i38 = getelementptr inbounds i8, ptr %str, i64 %idxprom.i37
%5 = load i8, ptr %arrayidx.i38, align 1, !tbaa !5
switch i8 %5, label %if.else16.i.i50 [
i8 65, label %getChar_ID.exit.i40
i8 67, label %if.then5.i.i49
i8 71, label %if.then10.i.i48
i8 84, label %if.then15.i.i39
]
if.then5.i.i49: ; preds = %for.body.i31
br label %getChar_ID.exit.i40
if.then10.i.i48: ; preds = %for.body.i31
br label %getChar_ID.exit.i40
if.then15.i.i39: ; preds = %for.body.i31
br label %getChar_ID.exit.i40
if.else16.i.i50: ; preds = %for.body.i31
br label %getChar_ID.exit.i40
getChar_ID.exit.i40: ; preds = %if.else16.i.i50, %if.then15.i.i39, %if.then10.i.i48, %if.then5.i.i49, %for.body.i31
%retval.0.i.i41 = phi i32 [ 2, %if.then5.i.i49 ], [ 3, %if.then10.i.i48 ], [ 4, %if.then15.i.i39 ], [ -1, %if.else16.i.i50 ], [ 1, %for.body.i31 ]
%mul.i42 = mul nsw i32 %retval.0.i.i41, %k.015.i33
%add.i43 = add nsw i32 %mul.i42, %id.014.i34
%mul4.i44 = shl nsw i32 %k.015.i33, 2
%indvars.iv.next.i45 = add nuw nsw i64 %indvars.iv.i32, 1
%exitcond.not.i46 = icmp eq i64 %indvars.iv.next.i45, %wide.trip.count.i30
br i1 %exitcond.not.i46, label %analysis.exit51, label %for.body.i31, !llvm.loop !8
analysis.exit51: ; preds = %getChar_ID.exit.i40, %if.then13
%id.0.lcssa.i28 = phi i32 [ 0, %if.then13 ], [ %add.i43, %getChar_ID.exit.i40 ]
%idxprom.i52 = sext i32 %id.0.lcssa.i28 to i64
%arrayidx.i53 = getelementptr inbounds [16777216 x [12 x i8]], ptr @dec, i64 0, i64 %idxprom.i52
%call.i54 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i53, ptr noundef nonnull dereferenceable(1) %str) #9
%cmp.i = icmp eq i32 %call.i54, 0
%str.5.str.i = select i1 %cmp.i, ptr @str.5, ptr @str
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.str.i)
br label %for.inc
if.else18: ; preds = %for.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
for.inc: ; preds = %analysis.exit, %if.else18, %analysis.exit51
%inc = add nuw nsw i32 %i.056, 1
%6 = load i32, ptr %n, align 4, !tbaa !10
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %com) #10
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %str) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
|
#include<stdio.h>
#include<string.h>
/*
Dictionary (Hash)
2019. 4/30
*/
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
// char to int
int getChar(char ch) {
switch (ch) {
case 'A':
return 1;
break;
case 'C':
return 2;
break;
case 'G':
return 3;
break;
case 'T':
return 4;
break;
default:
return 0;
}
}
// char to int, generate 'key'
long long getKey(char str[]) {
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++) {
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key) { return key % M; }
int h2(int key) { return 1 + (key % (M - 1)); }
int find(char str[]){
long long key, i, h;
key = getKey(str);
for(i = 0; ; i++){
h = (h1(key) + i * h2(key)) % M;
if (strcmp(H[h], str) == 0) return 1;
else if (strlen(H[h]) == 0) return 0;
}
return 0;
}
int insert(char str[]){
long long key, i, h;
key = getKey(str);
for (i = 0; ; i++) {
h = (h1(key) + i * h2(key)) % M;
if (strcmp(H[h], str) == 0) return 1;
else if (strlen(H[h]) == 0) {
strcpy(H[h], str);
return 0;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for(i = 0; i < M; i++) H[i][0] = '\0'; /* NULL文字 */
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%s %s", com, str);
if(com[0] == 'i'){
insert(str);
} else {
if(find(str)){
printf("yes\n");
} else{
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_245970/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_245970/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
%conv = sext i8 %ch to i32
switch i32 %conv, label %sw.default [
i32 65, label %return
i32 67, label %sw.bb1
i32 71, label %sw.bb2
i32 84, label %sw.bb3
]
sw.bb1: ; preds = %entry
br label %return
sw.bb2: ; preds = %entry
br label %return
sw.bb3: ; preds = %entry
br label %return
sw.default: ; preds = %entry
br label %return
return: ; preds = %entry, %sw.default, %sw.bb3, %sw.bb2, %sw.bb1
%retval.0 = phi i32 [ 0, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, %sw.bb1 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv.i = sext i8 %1 to i32
switch i32 %conv.i, label %sw.default.i [
i32 65, label %getChar.exit
i32 67, label %sw.bb1.i
i32 71, label %sw.bb2.i
i32 84, label %sw.bb3.i
]
sw.bb1.i: ; preds = %for.body
br label %getChar.exit
sw.bb2.i: ; preds = %for.body
br label %getChar.exit
sw.bb3.i: ; preds = %for.body
br label %getChar.exit
sw.default.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %sw.bb1.i, %sw.bb2.i, %sw.bb3.i, %sw.default.i
%retval.0.i = phi i64 [ 0, %sw.default.i ], [ 4, %sw.bb3.i ], [ 3, %sw.bb2.i ], [ 2, %sw.bb1.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%conv.i.1 = sext i8 %2 to i32
switch i32 %conv.i.1, label %sw.default.i.1 [
i32 65, label %getChar.exit.1
i32 67, label %sw.bb1.i.1
i32 71, label %sw.bb2.i.1
i32 84, label %sw.bb3.i.1
]
sw.bb3.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
sw.bb2.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
sw.bb1.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
sw.default.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %sw.default.i.1, %sw.bb1.i.1, %sw.bb2.i.1, %sw.bb3.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 0, %sw.default.i.1 ], [ 4, %sw.bb3.i.1 ], [ 3, %sw.bb2.i.1 ], [ 2, %sw.bb1.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%conv.i.epil = sext i8 %3 to i32
switch i32 %conv.i.epil, label %sw.default.i.epil [
i32 65, label %getChar.exit.epil
i32 67, label %sw.bb1.i.epil
i32 71, label %sw.bb2.i.epil
i32 84, label %sw.bb3.i.epil
]
sw.bb3.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
sw.bb2.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
sw.bb1.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
sw.default.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %sw.default.i.epil, %sw.bb1.i.epil, %sw.bb2.i.epil, %sw.bb3.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 0, %sw.default.i.epil ], [ 4, %sw.bb3.i.epil ], [ 3, %sw.bb2.i.epil ], [ 2, %sw.bb1.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%conv.i.i = sext i8 %1 to i32
switch i32 %conv.i.i, label %sw.default.i.i [
i32 65, label %getChar.exit.i
i32 67, label %sw.bb1.i.i
i32 71, label %sw.bb2.i.i
i32 84, label %sw.bb3.i.i
]
sw.bb1.i.i: ; preds = %for.body.i
br label %getChar.exit.i
sw.bb2.i.i: ; preds = %for.body.i
br label %getChar.exit.i
sw.bb3.i.i: ; preds = %for.body.i
br label %getChar.exit.i
sw.default.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %sw.default.i.i, %sw.bb3.i.i, %sw.bb2.i.i, %sw.bb1.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 0, %sw.default.i.i ], [ 4, %sw.bb3.i.i ], [ 3, %sw.bb2.i.i ], [ 2, %sw.bb1.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%conv.i.i.1 = sext i8 %2 to i32
switch i32 %conv.i.i.1, label %sw.default.i.i.1 [
i32 65, label %getChar.exit.i.1
i32 67, label %sw.bb1.i.i.1
i32 71, label %sw.bb2.i.i.1
i32 84, label %sw.bb3.i.i.1
]
sw.bb3.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
sw.bb2.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
sw.bb1.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
sw.default.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %sw.default.i.i.1, %sw.bb1.i.i.1, %sw.bb2.i.i.1, %sw.bb3.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 0, %sw.default.i.i.1 ], [ 4, %sw.bb3.i.i.1 ], [ 3, %sw.bb2.i.i.1 ], [ 2, %sw.bb1.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
%conv.i.i.epil = sext i8 %3 to i32
switch i32 %conv.i.i.epil, label %sw.default.i.i.epil [
i32 65, label %getChar.exit.i.epil
i32 67, label %sw.bb1.i.i.epil
i32 71, label %sw.bb2.i.i.epil
i32 84, label %sw.bb3.i.i.epil
]
sw.bb3.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
sw.bb2.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
sw.bb1.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
sw.default.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %sw.default.i.i.epil, %sw.bb1.i.i.epil, %sw.bb2.i.i.epil, %sw.bb3.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 0, %sw.default.i.i.epil ], [ 4, %sw.bb3.i.i.epil ], [ 3, %sw.bb2.i.i.epil ], [ 2, %sw.bb1.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%conv.i.i = sext i8 %1 to i32
switch i32 %conv.i.i, label %sw.default.i.i [
i32 65, label %getChar.exit.i
i32 67, label %sw.bb1.i.i
i32 71, label %sw.bb2.i.i
i32 84, label %sw.bb3.i.i
]
sw.bb1.i.i: ; preds = %for.body.i
br label %getChar.exit.i
sw.bb2.i.i: ; preds = %for.body.i
br label %getChar.exit.i
sw.bb3.i.i: ; preds = %for.body.i
br label %getChar.exit.i
sw.default.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %sw.default.i.i, %sw.bb3.i.i, %sw.bb2.i.i, %sw.bb1.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 0, %sw.default.i.i ], [ 4, %sw.bb3.i.i ], [ 3, %sw.bb2.i.i ], [ 2, %sw.bb1.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%conv.i.i.1 = sext i8 %2 to i32
switch i32 %conv.i.i.1, label %sw.default.i.i.1 [
i32 65, label %getChar.exit.i.1
i32 67, label %sw.bb1.i.i.1
i32 71, label %sw.bb2.i.i.1
i32 84, label %sw.bb3.i.i.1
]
sw.bb3.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
sw.bb2.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
sw.bb1.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
sw.default.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %sw.default.i.i.1, %sw.bb1.i.i.1, %sw.bb2.i.i.1, %sw.bb3.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 0, %sw.default.i.i.1 ], [ 4, %sw.bb3.i.i.1 ], [ 3, %sw.bb2.i.i.1 ], [ 2, %sw.bb1.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
%conv.i.i.epil = sext i8 %3 to i32
switch i32 %conv.i.i.epil, label %sw.default.i.i.epil [
i32 65, label %getChar.exit.i.epil
i32 67, label %sw.bb1.i.i.epil
i32 71, label %sw.bb2.i.i.epil
i32 84, label %sw.bb3.i.i.epil
]
sw.bb3.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
sw.bb2.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
sw.bb1.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
sw.default.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %sw.default.i.i.epil, %sw.bb1.i.i.epil, %sw.bb2.i.i.epil, %sw.bb3.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 0, %sw.default.i.i.epil ], [ 4, %sw.bb3.i.i.epil ], [ 3, %sw.bb2.i.i.epil ], [ 2, %sw.bb1.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
#define M 2000000
#define L 14
char H[M][L];
int getChar( char ch )
{
if( ch == 'A') {
return 1;
} else if( ch == 'C') {
return 2;
} else if( ch == 'G') {
return 3;
} else if( ch == 'T') {
return 4;
} else {
return 0;
}
}
long long getKey( char str[] )
{
long long sum = 0, p = 1, i;
for ( i=0; i<strlen(str); i++ ) {
sum += p*( getChar( str[i] ) );
p *= 5;
}
return sum;
}
int find( char str[] )
{
int i;
long long hashkey;
for( i=0; i<M; i++ ) {
hashkey = getKey( str );
hashkey = ( hashkey+ (2*i-1)*hashkey )%M;
if( '\0' == H[ hashkey ][0] ) {
return 0;
} else {
if( 0 == strcmp( H[ hashkey ], str ) ) {
return 1;
}
}
}
return 0;
}
void insert( char str[] )
{
int i;
long long hashkey;
for( i=0; i<M; i++ ) {
hashkey = getKey( str );
hashkey = ( hashkey+ (2*i-1)*hashkey )%M;
if( '\0' == H[ hashkey ][0] ) {
strcpy( H[ hashkey ], str );
break;
}
}
return;
}
int main()
{
int i, n;
char str[L], com[9];
for ( i=0; i<M; i++ ) {
H[i][0] = '\0';
}
scanf( "%d", &n );
for ( i=0; i<n; i++ ) {
scanf( "%s %s", com, str );
if ( com[0] == 'i' ){
insert( str );
} else {
if( find( str ) ){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246012/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246012/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [2000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %entry.split.us, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
%unroll_iter = and i64 %call.i, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.body
entry.split.us: ; preds = %entry
%1 = load i8, ptr @H, align 16, !tbaa !5
%cmp4.us = icmp eq i8 %1, 0
br i1 %cmp4.us, label %cleanup, label %entry.split.us.split
entry.split.us.split: ; preds = %entry.split.us
%call7.us = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @H, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.us = icmp eq i32 %call7.us, 0
%spec.select = zext i1 %cmp8.us to i32
br label %cleanup
for.cond: ; preds = %if.else
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 2000000
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !10
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %for.body.preheader ]
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i
for.body.i: ; preds = %for.body, %getChar.exit.i.1
%i.011.i = phi i64 [ %inc.i.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%p.010.i = phi i64 [ %mul2.i.1, %getChar.exit.i.1 ], [ 1, %for.body ]
%sum.09.i = phi i64 [ %add.i.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%niter = phi i64 [ %niter.next.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i64 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul nsw i64 %retval.0.i.i, %p.010.i
%add.i = add nuw nsw i64 %mul.i, %sum.09.i
%mul2.i = mul nsw i64 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%3 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i64 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul nsw i64 %retval.0.i.i.1, %mul2.i
%add.i.1 = add nuw nsw i64 %mul.i.1, %add.i
%mul2.i.1 = mul i64 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body
%add.i.lcssa.ph = phi i64 [ undef, %for.body ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i64 [ 1, %for.body ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i64 [ 0, %for.body ], [ %add.i.1, %getChar.exit.i.1 ]
br i1 %lcmp.mod.not, label %getKey.exit.loopexit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%4 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %4, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i64 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul nsw i64 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add nuw nsw i64 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit.loopexit
getKey.exit.loopexit: ; preds = %getKey.exit.loopexit.unr-lcssa, %getChar.exit.i.epil
%add.i.lcssa = phi i64 [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%5 = shl nuw nsw i64 %indvars.iv, 1
%add = mul i64 %add.i.lcssa, %5
%rem = srem i64 %add, 2000000
%arrayidx = getelementptr inbounds [2000000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%6 = load i8, ptr %arrayidx, align 4, !tbaa !5
%cmp4 = icmp eq i8 %6, 0
br i1 %cmp4, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit.loopexit
%call7 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8 = icmp eq i32 %call7, 0
br i1 %cmp8, label %cleanup, label %for.cond
cleanup: ; preds = %getKey.exit.loopexit, %if.else, %for.cond, %entry.split.us.split, %entry.split.us
%.us-phi = phi i32 [ 0, %entry.split.us ], [ %spec.select, %entry.split.us.split ], [ 0, %getKey.exit.loopexit ], [ 1, %if.else ], [ 0, %for.cond ]
ret i32 %.us-phi
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %entry.split.us, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
%unroll_iter = and i64 %call.i, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.body
entry.split.us: ; preds = %entry
%1 = load i8, ptr @H, align 16, !tbaa !5
%cmp4.us = icmp eq i8 %1, 0
br i1 %cmp4.us, label %if.then, label %for.end
for.cond: ; preds = %getKey.exit.loopexit
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 2000000
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %for.body.preheader ]
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i
for.body.i: ; preds = %for.body, %getChar.exit.i.1
%i.011.i = phi i64 [ %inc.i.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%p.010.i = phi i64 [ %mul2.i.1, %getChar.exit.i.1 ], [ 1, %for.body ]
%sum.09.i = phi i64 [ %add.i.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%niter = phi i64 [ %niter.next.1, %getChar.exit.i.1 ], [ 0, %for.body ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i64 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul nsw i64 %retval.0.i.i, %p.010.i
%add.i = add nuw nsw i64 %mul.i, %sum.09.i
%mul2.i = mul nsw i64 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%3 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i64 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul nsw i64 %retval.0.i.i.1, %mul2.i
%add.i.1 = add nuw nsw i64 %mul.i.1, %add.i
%mul2.i.1 = mul i64 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body
%add.i.lcssa.ph = phi i64 [ undef, %for.body ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i64 [ 1, %for.body ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i64 [ 0, %for.body ], [ %add.i.1, %getChar.exit.i.1 ]
br i1 %lcmp.mod.not, label %getKey.exit.loopexit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%4 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %4, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i64 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul nsw i64 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add nuw nsw i64 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit.loopexit
getKey.exit.loopexit: ; preds = %getKey.exit.loopexit.unr-lcssa, %getChar.exit.i.epil
%add.i.lcssa = phi i64 [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%5 = shl nuw nsw i64 %indvars.iv, 1
%add = mul i64 %add.i.lcssa, %5
%rem = srem i64 %add, 2000000
%arrayidx = getelementptr inbounds [2000000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%6 = load i8, ptr %arrayidx, align 4, !tbaa !5
%cmp4 = icmp eq i8 %6, 0
br i1 %cmp4, label %if.then, label %for.cond
if.then: ; preds = %getKey.exit.loopexit, %entry.split.us
%.us-phi = phi ptr [ @H, %entry.split.us ], [ %arrayidx, %getKey.exit.loopexit ]
%call7 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %.us-phi, ptr noundef nonnull dereferenceable(1) %str) #11
br label %for.end
for.end: ; preds = %for.cond, %entry.split.us, %if.then
ret void
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [2000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [2000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [2000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [2000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [2000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 2000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%cmp327 = icmp sgt i32 %0, 0
br i1 %cmp327, label %for.body4, label %for.end20
for.body4: ; preds = %for.end, %for.inc18
%i.128 = phi i32 [ %inc19, %for.inc18 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
call void @insert(ptr noundef nonnull %str)
br label %for.inc18
if.else: ; preds = %for.body4
%call12 = call i32 @find(ptr noundef nonnull %str), !range !15
%tobool.not = icmp eq i32 %call12, 0
br i1 %tobool.not, label %if.else15, label %if.then13
if.then13: ; preds = %if.else
%puts25 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc18
if.else15: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc18
for.inc18: ; preds = %if.then, %if.else15, %if.then13
%inc19 = add nuw nsw i32 %i.128, 1
%2 = load i32, ptr %n, align 4, !tbaa !13
%cmp3 = icmp slt i32 %inc19, %2
br i1 %cmp3, label %for.body4, label %for.end20, !llvm.loop !16
for.end20: ; preds = %for.inc18, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = !{i32 0, i32 2}
!16 = distinct !{!16, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1000003
#define L 14
char H[M][L];
int getChar(char ch)
{
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
return 0;
}
// convert a string into an integer value
long long getKey(char str[])
{
long long sum = 0, p = 1, i;
for (i = 0; i < strlen(str); i++)
{
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key)
{
return key % M;
}
int h2(int key)
{
return 1 + key % (M - 20);
}
int find(char str[])
{
long long key;
long long h;
long long d;
key = getKey(str);
h = h1(key);
d = h2(key);
while(1)
{
if(H[h][0] == '\0')
{
return 0;
}
if(strcmp(H[h], str) == 0)
{
return h;
}
h = (h + d) % M;
}
}
int insert(char str[])
{
long long key;
long long h;
long long d;
key = getKey(str);
h = h1(key);
d = h2(key);
while(1)
{
if(H[h][0] == '\0')
{
strcpy(H[h], str);
return h;
}
h = (h + d) % M;
}
}
int main()
{
int i, n, h;
char str[L], com[9];
for (i = 0; i < M; i++) H[i][0] = '\0';
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%s %s", com, str);
if (com[0] == 'i')
{
insert(str);
}
else
{
if(find(str)) printf("yes\n");
else printf("no\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000003 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.end18: ; preds = %entry
br label %return
return: ; preds = %entry, %if.end18, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.end18 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.end18.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.end18.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.end18.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.end18.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.end18.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.end18.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.end18.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.end18.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.end18.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.end18.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000003
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 999983
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.end18.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000003
%conv2 = sext i32 %rem.i to i64
%rem.i23 = srem i32 %sum.0.lcssa.i, 999983
%add.i24 = add nsw i32 %rem.i23, 1
%conv5 = sext i32 %add.i24 to i64
%arrayidx26 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%4 = load i8, ptr %arrayidx26, align 2, !tbaa !5
%cmp27 = icmp eq i8 %4, 0
br i1 %cmp27, label %cleanup, label %if.end
if.end: ; preds = %getKey.exit, %if.end15
%arrayidx29 = phi ptr [ %arrayidx, %if.end15 ], [ %arrayidx26, %getKey.exit ]
%h.028 = phi i64 [ %rem, %if.end15 ], [ %conv2, %getKey.exit ]
%call10 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp11 = icmp eq i32 %call10, 0
br i1 %cmp11, label %if.then13, label %if.end15
if.then13: ; preds = %if.end
%conv14 = trunc i64 %h.028 to i32
br label %cleanup
if.end15: ; preds = %if.end
%add = add nsw i64 %h.028, %conv5
%rem = srem i64 %add, 1000003
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %rem
%5 = load i8, ptr %arrayidx, align 2, !tbaa !5
%cmp = icmp eq i8 %5, 0
br i1 %cmp, label %cleanup, label %if.end
cleanup: ; preds = %if.end15, %getKey.exit, %if.then13
%retval.0 = phi i32 [ %conv14, %if.then13 ], [ 0, %getKey.exit ], [ 0, %if.end15 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.end18.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000003
%conv2 = sext i32 %rem.i to i64
%rem.i17 = srem i32 %sum.0.lcssa.i, 999983
%add.i18 = add nsw i32 %rem.i17, 1
%conv5 = sext i32 %add.i18 to i64
%arrayidx19 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%4 = load i8, ptr %arrayidx19, align 2, !tbaa !5
%cmp20 = icmp eq i8 %4, 0
br i1 %cmp20, label %if.then, label %if.end
if.then.loopexit: ; preds = %if.end
%5 = trunc i64 %rem to i32
br label %if.then
if.then: ; preds = %if.then.loopexit, %getKey.exit
%h.0.lcssa = phi i32 [ %rem.i, %getKey.exit ], [ %5, %if.then.loopexit ]
%arrayidx.lcssa = phi ptr [ %arrayidx19, %getKey.exit ], [ %arrayidx, %if.then.loopexit ]
%call10 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.lcssa, ptr noundef nonnull dereferenceable(1) %str) #11
ret i32 %h.0.lcssa
if.end: ; preds = %getKey.exit, %if.end
%h.021 = phi i64 [ %rem, %if.end ], [ %conv2, %getKey.exit ]
%add = add nsw i64 %h.021, %conv5
%rem = srem i64 %add, 1000003
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %rem
%6 = load i8, ptr %arrayidx, align 2, !tbaa !5
%cmp = icmp eq i8 %6, 0
br i1 %cmp, label %if.then.loopexit, label %if.end
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1000003
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 -1000002, i32 1000003}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
typedef struct
{
int q;
int p;
}elem;
elem buy[1005],sell[1005];
int a[1005][2];
int max(int a,int b)
{
if(a>b)
return a;
else
return b;
}
int min(int a,int b)
{
if(a<b)
return a;
else
return b;
}
int compare (const void * a, const void * b)
{
elem *pi=(elem *) a;
elem *qi=(elem *) b;
if(pi->p > qi->p)
return 1;
return -1;
}
int main()
{
int n,i,j,k,t,s,nb,ns,ptemp,qtemp,flag;
char str[3];
scanf("%d %d",&n,&s);
nb=0;
ns=0;
for(j=0;j<n;j++)
{
scanf("%s %d %d",str,&ptemp,&qtemp);
if(str[0]=='B')
{
flag=0;
for(i=0;i<nb;i++)
{
if(ptemp==buy[i].p)
{
flag=1;
buy[i].q += qtemp;
break;
}
}
if(flag==0)
{
buy[nb].q = qtemp;
buy[nb].p = ptemp;
nb++;
}
}
else
{
flag=0;
for(i=0;i<ns;i++)
{
if(ptemp==sell[i].p)
{
flag=1;
sell[i].q += qtemp;
break;
}
}
if(flag==0)
{
sell[ns].q = qtemp;
sell[ns].p = ptemp;
ns++;
}
}
}
qsort(buy,nb,sizeof(elem),compare);
qsort(sell,ns,sizeof(elem),compare);
k=0;
/*for(i=0;i<ns;i++)
printf("%d %d ",sell[i].p,sell[i].q);
printf("\n");
for(i=0;i<nb;i++)
printf("%d %d ",buy[i].p,buy[i].q);
printf("\n");*/
for(i=0;i<min(ns,s);i++)
{
//printf("S %d %d",sell[i].p,sell[i].q);
a[k][0]=sell[i].p;
a[k][1]=sell[i].q;
k++;
}
for(i=k-1;i>=0;i--)
{
printf("S %d %d\n",a[i][0],a[i][1]);
}
k=0;
for(i=max(0,nb-s);i<nb;i++)
{
//printf("B %d %d",buy[i].p,buy[i].q);
a[k][0]=buy[i].p;
a[k][1]=buy[i].q;
//printf("%d %d ",buy[i].p,buy[i].q);
k++;
}
for(i=k-1;i>=0;i--)
{
printf("B %d %d\n",a[i][0],a[i][1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2461/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2461/source.c"
target datalayout = "e-m:e-p270: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.elem = type { i32, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%s %d %d\00", align 1
@buy = dso_local global [1005 x %struct.elem] zeroinitializer, align 16
@sell = dso_local global [1005 x %struct.elem] zeroinitializer, align 16
@a = dso_local local_unnamed_addr global [1005 x [2 x i32]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [9 x i8] c"S %d %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [9 x i8] c"B %d %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #1 {
entry:
%p = getelementptr inbounds %struct.elem, ptr %a, i64 0, i32 1
%0 = load i32, ptr %p, align 4, !tbaa !5
%p1 = getelementptr inbounds %struct.elem, ptr %b, i64 0, i32 1
%1 = load i32, ptr %p1, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%. = select i1 %cmp, i32 1, i32 -1
ret i32 %.
}
; 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 uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%s = alloca i32, align 4
%ptemp = alloca i32, align 4
%qtemp = alloca i32, align 4
%str = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ptemp) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %qtemp) #7
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %str) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !10
%cmp179 = icmp sgt i32 %0, 0
br i1 %cmp179, label %for.body, label %for.end57
for.body: ; preds = %entry, %for.inc55
%ns.0182 = phi i32 [ %ns.1, %for.inc55 ], [ 0, %entry ]
%nb.0181 = phi i32 [ %nb.1, %for.inc55 ], [ 0, %entry ]
%j.0180 = phi i32 [ %inc56, %for.inc55 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str, ptr noundef nonnull %ptemp, ptr noundef nonnull %qtemp)
%1 = load i8, ptr %str, align 1, !tbaa !11
%cmp2 = icmp eq i8 %1, 66
%.pre226 = load i32, ptr %ptemp, align 4, !tbaa !10
br i1 %cmp2, label %for.cond4.preheader, label %for.cond25.preheader
for.cond25.preheader: ; preds = %for.body
%cmp26.not175 = icmp sgt i32 %ns.0182, 0
br i1 %cmp26.not175, label %for.body28.lr.ph, label %if.then45
for.body28.lr.ph: ; preds = %for.cond25.preheader
%wide.trip.count = zext i32 %ns.0182 to i64
br label %for.body28
for.cond4.preheader: ; preds = %for.body
%cmp5.not177 = icmp sgt i32 %nb.0181, 0
br i1 %cmp5.not177, label %for.body7.lr.ph, label %if.then16
for.body7.lr.ph: ; preds = %for.cond4.preheader
%wide.trip.count202 = zext i32 %nb.0181 to i64
br label %for.body7
for.cond4: ; preds = %for.body7
%indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
%exitcond203.not = icmp eq i64 %indvars.iv.next200, %wide.trip.count202
br i1 %exitcond203.not, label %if.then16, label %for.body7, !llvm.loop !12
for.body7: ; preds = %for.body7.lr.ph, %for.cond4
%indvars.iv199 = phi i64 [ 0, %for.body7.lr.ph ], [ %indvars.iv.next200, %for.cond4 ]
%p = getelementptr inbounds [1005 x %struct.elem], ptr @buy, i64 0, i64 %indvars.iv199, i32 1
%2 = load i32, ptr %p, align 4, !tbaa !5
%cmp9 = icmp eq i32 %.pre226, %2
br i1 %cmp9, label %if.then11, label %for.cond4
if.then11: ; preds = %for.body7
%arrayidx8 = getelementptr inbounds [1005 x %struct.elem], ptr @buy, i64 0, i64 %indvars.iv199
%3 = load i32, ptr %qtemp, align 4, !tbaa !10
%4 = load i32, ptr %arrayidx8, align 8, !tbaa !14
%add = add nsw i32 %4, %3
store i32 %add, ptr %arrayidx8, align 8, !tbaa !14
br label %for.inc55
if.then16: ; preds = %for.cond4, %for.cond4.preheader
%5 = load i32, ptr %qtemp, align 4, !tbaa !10
%idxprom17 = sext i32 %nb.0181 to i64
%arrayidx18 = getelementptr inbounds [1005 x %struct.elem], ptr @buy, i64 0, i64 %idxprom17
store i32 %5, ptr %arrayidx18, align 8, !tbaa !14
%p22 = getelementptr inbounds [1005 x %struct.elem], ptr @buy, i64 0, i64 %idxprom17, i32 1
store i32 %.pre226, ptr %p22, align 4, !tbaa !5
%inc23 = add nsw i32 %nb.0181, 1
br label %for.inc55
for.cond25: ; preds = %for.body28
%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 %if.then45, label %for.body28, !llvm.loop !15
for.body28: ; preds = %for.body28.lr.ph, %for.cond25
%indvars.iv = phi i64 [ 0, %for.body28.lr.ph ], [ %indvars.iv.next, %for.cond25 ]
%p31 = getelementptr inbounds [1005 x %struct.elem], ptr @sell, i64 0, i64 %indvars.iv, i32 1
%6 = load i32, ptr %p31, align 4, !tbaa !5
%cmp32 = icmp eq i32 %.pre226, %6
br i1 %cmp32, label %if.then34, label %for.cond25
if.then34: ; preds = %for.body28
%arrayidx30 = getelementptr inbounds [1005 x %struct.elem], ptr @sell, i64 0, i64 %indvars.iv
%7 = load i32, ptr %qtemp, align 4, !tbaa !10
%8 = load i32, ptr %arrayidx30, align 8, !tbaa !14
%add38 = add nsw i32 %8, %7
store i32 %add38, ptr %arrayidx30, align 8, !tbaa !14
br label %for.inc55
if.then45: ; preds = %for.cond25, %for.cond25.preheader
%9 = load i32, ptr %qtemp, align 4, !tbaa !10
%idxprom46 = sext i32 %ns.0182 to i64
%arrayidx47 = getelementptr inbounds [1005 x %struct.elem], ptr @sell, i64 0, i64 %idxprom46
store i32 %9, ptr %arrayidx47, align 8, !tbaa !14
%p51 = getelementptr inbounds [1005 x %struct.elem], ptr @sell, i64 0, i64 %idxprom46, i32 1
store i32 %.pre226, ptr %p51, align 4, !tbaa !5
%inc52 = add nsw i32 %ns.0182, 1
br label %for.inc55
for.inc55: ; preds = %if.then34, %if.then11, %if.then16, %if.then45
%nb.1 = phi i32 [ %inc23, %if.then16 ], [ %nb.0181, %if.then11 ], [ %nb.0181, %if.then45 ], [ %nb.0181, %if.then34 ]
%ns.1 = phi i32 [ %ns.0182, %if.then16 ], [ %ns.0182, %if.then11 ], [ %inc52, %if.then45 ], [ %ns.0182, %if.then34 ]
%inc56 = add nuw nsw i32 %j.0180, 1
%10 = load i32, ptr %n, align 4, !tbaa !10
%cmp = icmp slt i32 %inc56, %10
br i1 %cmp, label %for.body, label %for.end57, !llvm.loop !16
for.end57: ; preds = %for.inc55, %entry
%nb.0.lcssa = phi i32 [ 0, %entry ], [ %nb.1, %for.inc55 ]
%ns.0.lcssa = phi i32 [ 0, %entry ], [ %ns.1, %for.inc55 ]
%conv58 = sext i32 %nb.0.lcssa to i64
call void @qsort(ptr noundef nonnull @buy, i64 noundef %conv58, i64 noundef 8, ptr noundef nonnull @compare) #7
%conv59 = sext i32 %ns.0.lcssa to i64
call void @qsort(ptr noundef nonnull @sell, i64 noundef %conv59, i64 noundef 8, ptr noundef nonnull @compare) #7
%11 = load i32, ptr %s, align 4, !tbaa !10
%a.b.i = call i32 @llvm.smin.i32(i32 %ns.0.lcssa, i32 %11)
%cmp62184 = icmp sgt i32 %a.b.i, 0
br i1 %cmp62184, label %for.body64.preheader, label %for.end93
for.body64.preheader: ; preds = %for.end57
%wide.trip.count209 = zext i32 %a.b.i to i64
%min.iters.check = icmp ult i32 %a.b.i, 4
br i1 %min.iters.check, label %for.body64.preheader262, label %vector.ph
vector.ph: ; preds = %for.body64.preheader
%n.vec = and i64 %wide.trip.count209, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%12 = or i64 %index, 2
%13 = getelementptr inbounds [1005 x %struct.elem], ptr @sell, i64 0, i64 %index
%14 = getelementptr inbounds [1005 x %struct.elem], ptr @sell, i64 0, i64 %12
%wide.vec = load <4 x i32>, ptr %13, align 16, !tbaa !10
%wide.vec236 = load <4 x i32>, ptr %14, align 16, !tbaa !10
%strided.vec = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
%strided.vec237 = shufflevector <4 x i32> %wide.vec236, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
%strided.vec238 = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
%strided.vec239 = shufflevector <4 x i32> %wide.vec236, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
%15 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %index
%16 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %12
%interleaved.vec = shufflevector <2 x i32> %strided.vec238, <2 x i32> %strided.vec, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %15, align 16, !tbaa !10
%interleaved.vec240 = shufflevector <2 x i32> %strided.vec239, <2 x i32> %strided.vec237, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec240, ptr %16, align 16, !tbaa !10
%index.next = add nuw i64 %index, 4
%17 = icmp eq i64 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !17
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count209
br i1 %cmp.n, label %for.cond81.preheader, label %for.body64.preheader262
for.body64.preheader262: ; preds = %for.body64.preheader, %middle.block
%indvars.iv204.ph = phi i64 [ 0, %for.body64.preheader ], [ %n.vec, %middle.block ]
br label %for.body64
for.cond81.preheader: ; preds = %for.body64, %middle.block
%cmp82188 = icmp sgt i32 %a.b.i, 0
br i1 %cmp82188, label %for.body84.preheader, label %for.end93
for.body84.preheader: ; preds = %for.cond81.preheader
%18 = zext i32 %a.b.i to i64
br label %for.body84
for.body64: ; preds = %for.body64.preheader262, %for.body64
%indvars.iv204 = phi i64 [ %indvars.iv.next205, %for.body64 ], [ %indvars.iv204.ph, %for.body64.preheader262 ]
%arrayidx66 = getelementptr inbounds [1005 x %struct.elem], ptr @sell, i64 0, i64 %indvars.iv204
%arrayidx69 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv204
%19 = load <2 x i32>, ptr %arrayidx66, align 8, !tbaa !10
%20 = shufflevector <2 x i32> %19, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
store <2 x i32> %20, ptr %arrayidx69, align 8, !tbaa !10
%indvars.iv.next205 = add nuw nsw i64 %indvars.iv204, 1
%exitcond210.not = icmp eq i64 %indvars.iv.next205, %wide.trip.count209
br i1 %exitcond210.not, label %for.cond81.preheader, label %for.body64, !llvm.loop !20
for.body84: ; preds = %for.body84.preheader, %for.body84
%indvars.iv211 = phi i64 [ %18, %for.body84.preheader ], [ %indvars.iv.next212, %for.body84 ]
%indvars.iv.next212 = add nsw i64 %indvars.iv211, -1
%arrayidx86 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv.next212
%21 = load i32, ptr %arrayidx86, align 8, !tbaa !10
%arrayidx90 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv.next212, i64 1
%22 = load i32, ptr %arrayidx90, align 4, !tbaa !10
%call91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21, i32 noundef %22)
%cmp82 = icmp ugt i64 %indvars.iv211, 1
br i1 %cmp82, label %for.body84, label %for.end93.loopexit, !llvm.loop !21
for.end93.loopexit: ; preds = %for.body84
%.pre227 = load i32, ptr %s, align 4, !tbaa !10
br label %for.end93
for.end93: ; preds = %for.end57, %for.end93.loopexit, %for.cond81.preheader
%23 = phi i32 [ %.pre227, %for.end93.loopexit ], [ %11, %for.cond81.preheader ], [ %11, %for.end57 ]
%sub94 = sub nsw i32 %nb.0.lcssa, %23
%a.b.i174 = call i32 @llvm.smax.i32(i32 %sub94, i32 0)
%cmp97190 = icmp slt i32 %a.b.i174, %nb.0.lcssa
br i1 %cmp97190, label %for.body99.preheader, label %for.end130
for.body99.preheader: ; preds = %for.end93
%24 = zext i32 %a.b.i174 to i64
%25 = call i32 @llvm.smin.i32(i32 %nb.0.lcssa, i32 %23)
%wide.trip.count221 = zext i32 %25 to i64
%min.iters.check243 = icmp ult i32 %25, 4
br i1 %min.iters.check243, label %for.body99.preheader261, label %vector.ph244
vector.ph244: ; preds = %for.body99.preheader
%n.vec246 = and i64 %wide.trip.count221, 4294967292
%ind.end = add nuw nsw i64 %n.vec246, %24
br label %vector.body250
vector.body250: ; preds = %vector.body250, %vector.ph244
%index251 = phi i64 [ 0, %vector.ph244 ], [ %index.next260, %vector.body250 ]
%offset.idx = add i64 %index251, %24
%26 = add i64 %offset.idx, 2
%27 = or i64 %index251, 2
%28 = getelementptr inbounds [1005 x %struct.elem], ptr @buy, i64 0, i64 %offset.idx
%29 = getelementptr inbounds [1005 x %struct.elem], ptr @buy, i64 0, i64 %26
%wide.vec252 = load <4 x i32>, ptr %28, align 8, !tbaa !10
%wide.vec253 = load <4 x i32>, ptr %29, align 8, !tbaa !10
%strided.vec254 = shufflevector <4 x i32> %wide.vec252, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
%strided.vec255 = shufflevector <4 x i32> %wide.vec253, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
%strided.vec256 = shufflevector <4 x i32> %wide.vec252, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
%strided.vec257 = shufflevector <4 x i32> %wide.vec253, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
%30 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %index251
%31 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %27
%interleaved.vec258 = shufflevector <2 x i32> %strided.vec256, <2 x i32> %strided.vec254, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec258, ptr %30, align 16, !tbaa !10
%interleaved.vec259 = shufflevector <2 x i32> %strided.vec257, <2 x i32> %strided.vec255, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec259, ptr %31, align 16, !tbaa !10
%index.next260 = add nuw i64 %index251, 4
%32 = icmp eq i64 %index.next260, %n.vec246
br i1 %32, label %middle.block241, label %vector.body250, !llvm.loop !22
middle.block241: ; preds = %vector.body250
%cmp.n249 = icmp eq i64 %n.vec246, %wide.trip.count221
br i1 %cmp.n249, label %for.cond117.preheader, label %for.body99.preheader261
for.body99.preheader261: ; preds = %for.body99.preheader, %middle.block241
%indvars.iv216.ph = phi i64 [ 0, %for.body99.preheader ], [ %n.vec246, %middle.block241 ]
%indvars.iv214.ph = phi i64 [ %24, %for.body99.preheader ], [ %ind.end, %middle.block241 ]
br label %for.body99
for.cond117.preheader: ; preds = %for.body99, %middle.block241
%cmp118194 = icmp sgt i32 %25, 0
br i1 %cmp118194, label %for.body120.preheader, label %for.end130
for.body120.preheader: ; preds = %for.cond117.preheader
%33 = zext i32 %25 to i64
br label %for.body120
for.body99: ; preds = %for.body99.preheader261, %for.body99
%indvars.iv216 = phi i64 [ %indvars.iv.next217, %for.body99 ], [ %indvars.iv216.ph, %for.body99.preheader261 ]
%indvars.iv214 = phi i64 [ %indvars.iv.next215, %for.body99 ], [ %indvars.iv214.ph, %for.body99.preheader261 ]
%arrayidx101 = getelementptr inbounds [1005 x %struct.elem], ptr @buy, i64 0, i64 %indvars.iv214
%arrayidx104 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv216
%34 = load <2 x i32>, ptr %arrayidx101, align 8, !tbaa !10
%35 = shufflevector <2 x i32> %34, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
store <2 x i32> %35, ptr %arrayidx104, align 8, !tbaa !10
%indvars.iv.next217 = add nuw nsw i64 %indvars.iv216, 1
%indvars.iv.next215 = add nuw nsw i64 %indvars.iv214, 1
%exitcond222.not = icmp eq i64 %indvars.iv.next217, %wide.trip.count221
br i1 %exitcond222.not, label %for.cond117.preheader, label %for.body99, !llvm.loop !23
for.body120: ; preds = %for.body120.preheader, %for.body120
%indvars.iv223 = phi i64 [ %33, %for.body120.preheader ], [ %indvars.iv.next224, %for.body120 ]
%indvars.iv.next224 = add nsw i64 %indvars.iv223, -1
%idxprom121 = and i64 %indvars.iv.next224, 4294967295
%arrayidx122 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %idxprom121
%36 = load i32, ptr %arrayidx122, align 8, !tbaa !10
%arrayidx126 = getelementptr inbounds [1005 x [2 x i32]], ptr @a, i64 0, i64 %idxprom121, i64 1
%37 = load i32, ptr %arrayidx126, align 4, !tbaa !10
%call127 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %36, i32 noundef %37)
%cmp118 = icmp ugt i64 %indvars.iv223, 1
br i1 %cmp118, label %for.body120, label %for.end130, !llvm.loop !24
for.end130: ; preds = %for.body120, %for.end93, %for.cond117.preheader
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %str) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %qtemp) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ptemp) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree 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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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, !7, i64 4}
!6 = !{!"", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!8, !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!6, !7, i64 0}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !13, !19, !18}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13, !18, !19}
!23 = distinct !{!23, !13, !19, !18}
!24 = distinct !{!24, !13}
|
#include<stdio.h>
#include<string.h>
#define M 20000000 /* your task*/
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else return 4;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int find(char str[]){
if(H[getKey(str)][0] == 0) return 0;
else return 1;
}
void insert(char str[]){
strcpy(H[getKey(str)], str);
}
int main(){
int i, n, h;
char str[L], com[9];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if (com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246142/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246142/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [20000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@switch.table.getChar = private unnamed_addr constant [7 x i32] [i32 1, i32 4, i32 2, i32 4, i32 4, i32 4, i32 3], align 4
@switch.table.main.5 = private unnamed_addr constant [7 x i64] [i64 1, i64 4, i64 2, i64 4, i64 4, i64 4, i64 3], align 8
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
%switch.tableidx = add i8 %ch, -65
%0 = icmp ult i8 %switch.tableidx, 7
br i1 %0, label %switch.lookup, label %return
switch.lookup: ; preds = %entry
%1 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table.getChar, i64 0, i64 %1
%switch.load = load i32, ptr %switch.gep, align 4
br label %return
return: ; preds = %entry, %switch.lookup
%retval.0 = phi i32 [ %switch.load, %switch.lookup ], [ 4, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
%switch.tableidx = add i8 %1, -65
%2 = icmp ult i8 %switch.tableidx, 7
br i1 %2, label %switch.lookup, label %getChar.exit
switch.lookup: ; preds = %for.body
%3 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %3
%switch.load = load i64, ptr %switch.gep, align 8
br label %getChar.exit
getChar.exit: ; preds = %for.body, %switch.lookup
%retval.0.i = phi i64 [ %switch.load, %switch.lookup ], [ 4, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%switch.tableidx.1 = add i8 %4, -65
%5 = icmp ult i8 %switch.tableidx.1, 7
br i1 %5, label %switch.lookup.1, label %getChar.exit.1
switch.lookup.1: ; preds = %getChar.exit
%6 = sext i8 %switch.tableidx.1 to i64
%switch.gep.1 = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %6
%switch.load.1 = load i64, ptr %switch.gep.1, align 8
br label %getChar.exit.1
getChar.exit.1: ; preds = %switch.lookup.1, %getChar.exit
%retval.0.i.1 = phi i64 [ %switch.load.1, %switch.lookup.1 ], [ 4, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%7 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%switch.tableidx.epil = add i8 %7, -65
%8 = icmp ult i8 %switch.tableidx.epil, 7
br i1 %8, label %switch.lookup.epil, label %getChar.exit.epil
switch.lookup.epil: ; preds = %for.body.epil
%9 = sext i8 %switch.tableidx.epil to i64
%switch.gep.epil = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %9
%switch.load.epil = load i64, ptr %switch.gep.epil, align 8
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %switch.lookup.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ %switch.load.epil, %switch.lookup.epil ], [ 4, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%switch.tableidx = add i8 %1, -65
%2 = icmp ult i8 %switch.tableidx, 7
br i1 %2, label %switch.lookup, label %getChar.exit.i
switch.lookup: ; preds = %for.body.i
%3 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %3
%switch.load = load i64, ptr %switch.gep, align 8
br label %getChar.exit.i
getChar.exit.i: ; preds = %for.body.i, %switch.lookup
%retval.0.i.i = phi i64 [ %switch.load, %switch.lookup ], [ 4, %for.body.i ]
%mul.i = mul nsw i64 %retval.0.i.i, %p.010.i
%add.i = add nuw nsw i64 %mul.i, %sum.09.i
%mul2.i = mul nsw i64 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%4 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%switch.tableidx.1 = add i8 %4, -65
%5 = icmp ult i8 %switch.tableidx.1, 7
br i1 %5, label %switch.lookup.1, label %getChar.exit.i.1
switch.lookup.1: ; preds = %getChar.exit.i
%6 = sext i8 %switch.tableidx.1 to i64
%switch.gep.1 = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %6
%switch.load.1 = load i64, ptr %switch.gep.1, align 8
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %switch.lookup.1, %getChar.exit.i
%retval.0.i.i.1 = phi i64 [ %switch.load.1, %switch.lookup.1 ], [ 4, %getChar.exit.i ]
%mul.i.1 = mul nsw i64 %retval.0.i.i.1, %mul2.i
%add.i.1 = add nuw nsw i64 %mul.i.1, %add.i
%mul2.i.1 = mul i64 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%7 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
%switch.tableidx.epil = add i8 %7, -65
%8 = icmp ult i8 %switch.tableidx.epil, 7
br i1 %8, label %switch.lookup.epil, label %getChar.exit.i.epil
switch.lookup.epil: ; preds = %for.body.i.epil
%9 = sext i8 %switch.tableidx.epil to i64
%switch.gep.epil = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %9
%switch.load.epil = load i64, ptr %switch.gep.epil, align 8
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %switch.lookup.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i64 [ %switch.load.epil, %switch.lookup.epil ], [ 4, %for.body.i.epil ]
%mul.i.epil = mul nsw i64 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add nuw nsw i64 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i64 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%arrayidx = getelementptr inbounds [20000000 x [14 x i8]], ptr @H, i64 0, i64 %sum.0.lcssa.i
%10 = load i8, ptr %arrayidx, align 2, !tbaa !5
%cmp = icmp ne i8 %10, 0
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%switch.tableidx = add i8 %1, -65
%2 = icmp ult i8 %switch.tableidx, 7
br i1 %2, label %switch.lookup, label %getChar.exit.i
switch.lookup: ; preds = %for.body.i
%3 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %3
%switch.load = load i64, ptr %switch.gep, align 8
br label %getChar.exit.i
getChar.exit.i: ; preds = %for.body.i, %switch.lookup
%retval.0.i.i = phi i64 [ %switch.load, %switch.lookup ], [ 4, %for.body.i ]
%mul.i = mul nsw i64 %retval.0.i.i, %p.010.i
%add.i = add nuw nsw i64 %mul.i, %sum.09.i
%mul2.i = mul nsw i64 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%4 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%switch.tableidx.1 = add i8 %4, -65
%5 = icmp ult i8 %switch.tableidx.1, 7
br i1 %5, label %switch.lookup.1, label %getChar.exit.i.1
switch.lookup.1: ; preds = %getChar.exit.i
%6 = sext i8 %switch.tableidx.1 to i64
%switch.gep.1 = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %6
%switch.load.1 = load i64, ptr %switch.gep.1, align 8
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %switch.lookup.1, %getChar.exit.i
%retval.0.i.i.1 = phi i64 [ %switch.load.1, %switch.lookup.1 ], [ 4, %getChar.exit.i ]
%mul.i.1 = mul nsw i64 %retval.0.i.i.1, %mul2.i
%add.i.1 = add nuw nsw i64 %mul.i.1, %add.i
%mul2.i.1 = mul i64 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%7 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
%switch.tableidx.epil = add i8 %7, -65
%8 = icmp ult i8 %switch.tableidx.epil, 7
br i1 %8, label %switch.lookup.epil, label %getChar.exit.i.epil
switch.lookup.epil: ; preds = %for.body.i.epil
%9 = sext i8 %switch.tableidx.epil to i64
%switch.gep.epil = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %9
%switch.load.epil = load i64, ptr %switch.gep.epil, align 8
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %switch.lookup.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i64 [ %switch.load.epil, %switch.lookup.epil ], [ 4, %for.body.i.epil ]
%mul.i.epil = mul nsw i64 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add nuw nsw i64 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i64 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%arrayidx = getelementptr inbounds [20000000 x [14 x i8]], ptr @H, i64 0, i64 %sum.0.lcssa.i
%call1 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #11
ret void
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.035 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp3 = icmp eq i8 %1, 105
%call.i.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i.i = icmp eq i64 %call.i.i, 0
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
br i1 %cmp8.not.i.i, label %insert.exit, label %for.body.i.i.preheader
for.body.i.i.preheader: ; preds = %if.then
%xtraiter41 = and i64 %call.i.i, 1
%2 = icmp eq i64 %call.i.i, 1
br i1 %2, label %insert.exit.loopexit.unr-lcssa, label %for.body.i.i.preheader.new
for.body.i.i.preheader.new: ; preds = %for.body.i.i.preheader
%unroll_iter44 = and i64 %call.i.i, -2
br label %for.body.i.i
for.body.i.i: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader.new
%i.011.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i = phi i64 [ 1, %for.body.i.i.preheader.new ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%niter45 = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %niter45.next.1, %getChar.exit.i.i.1 ]
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i
%3 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
%switch.tableidx = add i8 %3, -65
%4 = icmp ult i8 %switch.tableidx, 7
br i1 %4, label %switch.lookup, label %getChar.exit.i.i
switch.lookup: ; preds = %for.body.i.i
%5 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %5
%switch.load = load i64, ptr %switch.gep, align 8
br label %getChar.exit.i.i
getChar.exit.i.i: ; preds = %for.body.i.i, %switch.lookup
%retval.0.i.i.i = phi i64 [ %switch.load, %switch.lookup ], [ 4, %for.body.i.i ]
%mul.i.i = mul nsw i64 %retval.0.i.i.i, %p.010.i.i
%add.i.i = add nuw nsw i64 %mul.i.i, %sum.09.i.i
%mul2.i.i = mul nsw i64 %p.010.i.i, 5
%inc.i.i = or i64 %i.011.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i
%6 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
%switch.tableidx.1 = add i8 %6, -65
%7 = icmp ult i8 %switch.tableidx.1, 7
br i1 %7, label %switch.lookup.1, label %getChar.exit.i.i.1
switch.lookup.1: ; preds = %getChar.exit.i.i
%8 = sext i8 %switch.tableidx.1 to i64
%switch.gep.1 = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %8
%switch.load.1 = load i64, ptr %switch.gep.1, align 8
br label %getChar.exit.i.i.1
getChar.exit.i.i.1: ; preds = %switch.lookup.1, %getChar.exit.i.i
%retval.0.i.i.i.1 = phi i64 [ %switch.load.1, %switch.lookup.1 ], [ 4, %getChar.exit.i.i ]
%mul.i.i.1 = mul nsw i64 %retval.0.i.i.i.1, %mul2.i.i
%add.i.i.1 = add nuw nsw i64 %mul.i.i.1, %add.i.i
%mul2.i.i.1 = mul i64 %p.010.i.i, 25
%inc.i.i.1 = add nuw nsw i64 %i.011.i.i, 2
%niter45.next.1 = add i64 %niter45, 2
%niter45.ncmp.1 = icmp eq i64 %niter45.next.1, %unroll_iter44
br i1 %niter45.ncmp.1, label %insert.exit.loopexit.unr-lcssa, label %for.body.i.i, !llvm.loop !8
insert.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader
%add.i.i.lcssa.ph = phi i64 [ undef, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%i.011.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i.unr = phi i64 [ 1, %for.body.i.i.preheader ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%lcmp.mod42.not = icmp eq i64 %xtraiter41, 0
br i1 %lcmp.mod42.not, label %insert.exit, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %insert.exit.loopexit.unr-lcssa
%arrayidx.i.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i.unr
%9 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
%switch.tableidx.epil = add i8 %9, -65
%10 = icmp ult i8 %switch.tableidx.epil, 7
br i1 %10, label %switch.lookup.epil, label %getChar.exit.i.i.epil
switch.lookup.epil: ; preds = %for.body.i.i.epil
%11 = sext i8 %switch.tableidx.epil to i64
%switch.gep.epil = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %11
%switch.load.epil = load i64, ptr %switch.gep.epil, align 8
br label %getChar.exit.i.i.epil
getChar.exit.i.i.epil: ; preds = %switch.lookup.epil, %for.body.i.i.epil
%retval.0.i.i.i.epil = phi i64 [ %switch.load.epil, %switch.lookup.epil ], [ 4, %for.body.i.i.epil ]
%mul.i.i.epil = mul nsw i64 %retval.0.i.i.i.epil, %p.010.i.i.unr
%add.i.i.epil = add nuw nsw i64 %mul.i.i.epil, %sum.09.i.i.unr
br label %insert.exit
insert.exit: ; preds = %getChar.exit.i.i.epil, %insert.exit.loopexit.unr-lcssa, %if.then
%sum.0.lcssa.i.i = phi i64 [ 0, %if.then ], [ %add.i.i.lcssa.ph, %insert.exit.loopexit.unr-lcssa ], [ %add.i.i.epil, %getChar.exit.i.i.epil ]
%arrayidx.i = getelementptr inbounds [20000000 x [14 x i8]], ptr @H, i64 0, i64 %sum.0.lcssa.i.i
%call1.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.i, ptr noundef nonnull dereferenceable(1) %str) #11
br label %for.inc
if.else: ; preds = %for.body
br i1 %cmp8.not.i.i, label %find.exit, label %for.body.i.i17.preheader
for.body.i.i17.preheader: ; preds = %if.else
%xtraiter = and i64 %call.i.i, 1
%12 = icmp eq i64 %call.i.i, 1
br i1 %12, label %find.exit.loopexit.unr-lcssa, label %for.body.i.i17.preheader.new
for.body.i.i17.preheader.new: ; preds = %for.body.i.i17.preheader
%unroll_iter = and i64 %call.i.i, -2
br label %for.body.i.i17
for.body.i.i17: ; preds = %getChar.exit.i.i23.1, %for.body.i.i17.preheader.new
%i.011.i.i18 = phi i64 [ 0, %for.body.i.i17.preheader.new ], [ %inc.i.i28.1, %getChar.exit.i.i23.1 ]
%p.010.i.i19 = phi i64 [ 1, %for.body.i.i17.preheader.new ], [ %mul2.i.i27.1, %getChar.exit.i.i23.1 ]
%sum.09.i.i20 = phi i64 [ 0, %for.body.i.i17.preheader.new ], [ %add.i.i26.1, %getChar.exit.i.i23.1 ]
%niter = phi i64 [ 0, %for.body.i.i17.preheader.new ], [ %niter.next.1, %getChar.exit.i.i23.1 ]
%arrayidx.i.i21 = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i18
%13 = load i8, ptr %arrayidx.i.i21, align 1, !tbaa !5
%switch.tableidx37 = add i8 %13, -65
%14 = icmp ult i8 %switch.tableidx37, 7
br i1 %14, label %switch.lookup36, label %getChar.exit.i.i23
switch.lookup36: ; preds = %for.body.i.i17
%15 = sext i8 %switch.tableidx37 to i64
%switch.gep38 = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %15
%switch.load39 = load i64, ptr %switch.gep38, align 8
br label %getChar.exit.i.i23
getChar.exit.i.i23: ; preds = %for.body.i.i17, %switch.lookup36
%retval.0.i.i.i24 = phi i64 [ %switch.load39, %switch.lookup36 ], [ 4, %for.body.i.i17 ]
%mul.i.i25 = mul nsw i64 %retval.0.i.i.i24, %p.010.i.i19
%add.i.i26 = add nuw nsw i64 %mul.i.i25, %sum.09.i.i20
%mul2.i.i27 = mul nsw i64 %p.010.i.i19, 5
%inc.i.i28 = or i64 %i.011.i.i18, 1
%arrayidx.i.i21.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i28
%16 = load i8, ptr %arrayidx.i.i21.1, align 1, !tbaa !5
%switch.tableidx37.1 = add i8 %16, -65
%17 = icmp ult i8 %switch.tableidx37.1, 7
br i1 %17, label %switch.lookup36.1, label %getChar.exit.i.i23.1
switch.lookup36.1: ; preds = %getChar.exit.i.i23
%18 = sext i8 %switch.tableidx37.1 to i64
%switch.gep38.1 = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %18
%switch.load39.1 = load i64, ptr %switch.gep38.1, align 8
br label %getChar.exit.i.i23.1
getChar.exit.i.i23.1: ; preds = %switch.lookup36.1, %getChar.exit.i.i23
%retval.0.i.i.i24.1 = phi i64 [ %switch.load39.1, %switch.lookup36.1 ], [ 4, %getChar.exit.i.i23 ]
%mul.i.i25.1 = mul nsw i64 %retval.0.i.i.i24.1, %mul2.i.i27
%add.i.i26.1 = add nuw nsw i64 %mul.i.i25.1, %add.i.i26
%mul2.i.i27.1 = mul i64 %p.010.i.i19, 25
%inc.i.i28.1 = add nuw nsw i64 %i.011.i.i18, 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 %find.exit.loopexit.unr-lcssa, label %for.body.i.i17, !llvm.loop !8
find.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i23.1, %for.body.i.i17.preheader
%add.i.i26.lcssa.ph = phi i64 [ undef, %for.body.i.i17.preheader ], [ %add.i.i26.1, %getChar.exit.i.i23.1 ]
%i.011.i.i18.unr = phi i64 [ 0, %for.body.i.i17.preheader ], [ %inc.i.i28.1, %getChar.exit.i.i23.1 ]
%p.010.i.i19.unr = phi i64 [ 1, %for.body.i.i17.preheader ], [ %mul2.i.i27.1, %getChar.exit.i.i23.1 ]
%sum.09.i.i20.unr = phi i64 [ 0, %for.body.i.i17.preheader ], [ %add.i.i26.1, %getChar.exit.i.i23.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %find.exit, label %for.body.i.i17.epil
for.body.i.i17.epil: ; preds = %find.exit.loopexit.unr-lcssa
%arrayidx.i.i21.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i18.unr
%19 = load i8, ptr %arrayidx.i.i21.epil, align 1, !tbaa !5
%switch.tableidx37.epil = add i8 %19, -65
%20 = icmp ult i8 %switch.tableidx37.epil, 7
br i1 %20, label %switch.lookup36.epil, label %getChar.exit.i.i23.epil
switch.lookup36.epil: ; preds = %for.body.i.i17.epil
%21 = sext i8 %switch.tableidx37.epil to i64
%switch.gep38.epil = getelementptr inbounds [7 x i64], ptr @switch.table.main.5, i64 0, i64 %21
%switch.load39.epil = load i64, ptr %switch.gep38.epil, align 8
br label %getChar.exit.i.i23.epil
getChar.exit.i.i23.epil: ; preds = %switch.lookup36.epil, %for.body.i.i17.epil
%retval.0.i.i.i24.epil = phi i64 [ %switch.load39.epil, %switch.lookup36.epil ], [ 4, %for.body.i.i17.epil ]
%mul.i.i25.epil = mul nsw i64 %retval.0.i.i.i24.epil, %p.010.i.i19.unr
%add.i.i26.epil = add nuw nsw i64 %mul.i.i25.epil, %sum.09.i.i20.unr
br label %find.exit
find.exit: ; preds = %getChar.exit.i.i23.epil, %find.exit.loopexit.unr-lcssa, %if.else
%sum.0.lcssa.i.i30 = phi i64 [ 0, %if.else ], [ %add.i.i26.lcssa.ph, %find.exit.loopexit.unr-lcssa ], [ %add.i.i26.epil, %getChar.exit.i.i23.epil ]
%arrayidx.i31 = getelementptr inbounds [20000000 x [14 x i8]], ptr @H, i64 0, i64 %sum.0.lcssa.i.i30
%22 = load i8, ptr %arrayidx.i31, align 2, !tbaa !5
%cmp.i.not = icmp eq i8 %22, 0
br i1 %cmp.i.not, label %if.else10, label %if.then8
if.then8: ; preds = %find.exit
%puts14 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc
if.else10: ; preds = %find.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.else10, %if.then8
%inc = add nuw nsw i32 %i.035, 1
%23 = load i32, ptr %n, align 4, !tbaa !10
%cmp = icmp slt i32 %inc, %23
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
|
#include<stdio.h>
#include<string.h>
#define N 100000000
char c[14];
int x[N];
int n;
int a(void);
int b(char);
void insert(void);
int find(void);
int main(){
char str[7];
int i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%s",str,c);
if(str[0]=='i'){
insert();
}
else if(str[0]=='f'){
if(find())printf("yes\n");
else printf("no\n");
}
}
return 0;
}
int a(void){
int x=0,i,p=1;
for(i=0;i<strlen(c);i++){
x+=p*(b(c[i]));
p*=5;
}
return x;
}
int b(char c){
if(c=='A'){
return 1;
}
else if(c=='C'){
return 2;
}
else if(c=='G'){
return 3;
}
else return 4;
}
void insert(){
x[a()]=1;
}
int find(){
int key =a();
if(x[key]){
return 1;
}
else return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246186/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246186/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@c = dso_local global [14 x i8] zeroinitializer, align 1
@x = dso_local local_unnamed_addr global [100000000 x i32] zeroinitializer, align 16
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@switch.table.b = private unnamed_addr constant [7 x i32] [i32 1, i32 4, i32 2, i32 4, i32 4, i32 4, i32 3], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %str) #8
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.039 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str, ptr noundef nonnull @c)
%1 = load i8, ptr %str, align 1, !tbaa !9
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 102, label %if.then8
]
if.then: ; preds = %for.body
%call.i.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @c) #9
%cmp8.not.i.i = icmp eq i64 %call.i.i, 0
br i1 %cmp8.not.i.i, label %insert.exit, label %for.body.i.i.preheader
for.body.i.i.preheader: ; preds = %if.then
%xtraiter45 = and i64 %call.i.i, 1
%2 = icmp eq i64 %call.i.i, 1
br i1 %2, label %a.exit.loopexit.i.unr-lcssa, label %for.body.i.i.preheader.new
for.body.i.i.preheader.new: ; preds = %for.body.i.i.preheader
%unroll_iter48 = and i64 %call.i.i, -2
br label %for.body.i.i
for.body.i.i: ; preds = %b.exit.i.i.1, %for.body.i.i.preheader.new
%indvars.iv.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %indvars.iv.next.i.i.1, %b.exit.i.i.1 ]
%p.011.i.i = phi i32 [ 1, %for.body.i.i.preheader.new ], [ %mul3.i.i.1, %b.exit.i.i.1 ]
%x.09.i.i = phi i32 [ 0, %for.body.i.i.preheader.new ], [ %add.i.i.1, %b.exit.i.i.1 ]
%niter49 = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %niter49.next.1, %b.exit.i.i.1 ]
%arrayidx.i.i = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.i.i
%3 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !9
%switch.tableidx = add i8 %3, -65
%4 = icmp ult i8 %switch.tableidx, 7
br i1 %4, label %switch.lookup, label %b.exit.i.i
switch.lookup: ; preds = %for.body.i.i
%5 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %5
%switch.load = load i32, ptr %switch.gep, align 4
br label %b.exit.i.i
b.exit.i.i: ; preds = %for.body.i.i, %switch.lookup
%retval.0.i.i.i = phi i32 [ %switch.load, %switch.lookup ], [ 4, %for.body.i.i ]
%mul.i.i = mul nsw i32 %retval.0.i.i.i, %p.011.i.i
%add.i.i = add nuw nsw i32 %mul.i.i, %x.09.i.i
%mul3.i.i = mul nsw i32 %p.011.i.i, 5
%indvars.iv.next.i.i = or i64 %indvars.iv.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.next.i.i
%6 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !9
%switch.tableidx.1 = add i8 %6, -65
%7 = icmp ult i8 %switch.tableidx.1, 7
br i1 %7, label %switch.lookup.1, label %b.exit.i.i.1
switch.lookup.1: ; preds = %b.exit.i.i
%8 = sext i8 %switch.tableidx.1 to i64
%switch.gep.1 = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %8
%switch.load.1 = load i32, ptr %switch.gep.1, align 4
br label %b.exit.i.i.1
b.exit.i.i.1: ; preds = %switch.lookup.1, %b.exit.i.i
%retval.0.i.i.i.1 = phi i32 [ %switch.load.1, %switch.lookup.1 ], [ 4, %b.exit.i.i ]
%mul.i.i.1 = mul nsw i32 %retval.0.i.i.i.1, %mul3.i.i
%add.i.i.1 = add nuw nsw i32 %mul.i.i.1, %add.i.i
%mul3.i.i.1 = mul i32 %p.011.i.i, 25
%indvars.iv.next.i.i.1 = add nuw nsw i64 %indvars.iv.i.i, 2
%niter49.next.1 = add i64 %niter49, 2
%niter49.ncmp.1 = icmp eq i64 %niter49.next.1, %unroll_iter48
br i1 %niter49.ncmp.1, label %a.exit.loopexit.i.unr-lcssa, label %for.body.i.i, !llvm.loop !10
a.exit.loopexit.i.unr-lcssa: ; preds = %b.exit.i.i.1, %for.body.i.i.preheader
%add.i.i.lcssa.ph = phi i32 [ undef, %for.body.i.i.preheader ], [ %add.i.i.1, %b.exit.i.i.1 ]
%indvars.iv.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %indvars.iv.next.i.i.1, %b.exit.i.i.1 ]
%p.011.i.i.unr = phi i32 [ 1, %for.body.i.i.preheader ], [ %mul3.i.i.1, %b.exit.i.i.1 ]
%x.09.i.i.unr = phi i32 [ 0, %for.body.i.i.preheader ], [ %add.i.i.1, %b.exit.i.i.1 ]
%lcmp.mod46.not = icmp eq i64 %xtraiter45, 0
br i1 %lcmp.mod46.not, label %a.exit.loopexit.i, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %a.exit.loopexit.i.unr-lcssa
%arrayidx.i.i.epil = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.i.i.unr
%9 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !9
%switch.tableidx.epil = add i8 %9, -65
%10 = icmp ult i8 %switch.tableidx.epil, 7
br i1 %10, label %switch.lookup.epil, label %b.exit.i.i.epil
switch.lookup.epil: ; preds = %for.body.i.i.epil
%11 = sext i8 %switch.tableidx.epil to i64
%switch.gep.epil = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %11
%switch.load.epil = load i32, ptr %switch.gep.epil, align 4
br label %b.exit.i.i.epil
b.exit.i.i.epil: ; preds = %switch.lookup.epil, %for.body.i.i.epil
%retval.0.i.i.i.epil = phi i32 [ %switch.load.epil, %switch.lookup.epil ], [ 4, %for.body.i.i.epil ]
%mul.i.i.epil = mul nsw i32 %retval.0.i.i.i.epil, %p.011.i.i.unr
%add.i.i.epil = add nuw nsw i32 %mul.i.i.epil, %x.09.i.i.unr
br label %a.exit.loopexit.i
a.exit.loopexit.i: ; preds = %a.exit.loopexit.i.unr-lcssa, %b.exit.i.i.epil
%add.i.i.lcssa = phi i32 [ %add.i.i.lcssa.ph, %a.exit.loopexit.i.unr-lcssa ], [ %add.i.i.epil, %b.exit.i.i.epil ]
%12 = zext i32 %add.i.i.lcssa to i64
br label %insert.exit
insert.exit: ; preds = %if.then, %a.exit.loopexit.i
%x.0.lcssa.i.i = phi i64 [ 0, %if.then ], [ %12, %a.exit.loopexit.i ]
%arrayidx.i = getelementptr inbounds [100000000 x i32], ptr @x, i64 0, i64 %x.0.lcssa.i.i
store i32 1, ptr %arrayidx.i, align 4, !tbaa !5
br label %for.inc
if.then8: ; preds = %for.body
%call.i.i18 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @c) #9
%cmp8.not.i.i19 = icmp eq i64 %call.i.i18, 0
br i1 %cmp8.not.i.i19, label %find.exit, label %for.body.i.i20.preheader
for.body.i.i20.preheader: ; preds = %if.then8
%xtraiter = and i64 %call.i.i18, 1
%13 = icmp eq i64 %call.i.i18, 1
br i1 %13, label %a.exit.loopexit.i33.unr-lcssa, label %for.body.i.i20.preheader.new
for.body.i.i20.preheader.new: ; preds = %for.body.i.i20.preheader
%unroll_iter = and i64 %call.i.i18, -2
br label %for.body.i.i20
for.body.i.i20: ; preds = %b.exit.i.i26.1, %for.body.i.i20.preheader.new
%indvars.iv.i.i21 = phi i64 [ 0, %for.body.i.i20.preheader.new ], [ %indvars.iv.next.i.i31.1, %b.exit.i.i26.1 ]
%p.011.i.i22 = phi i32 [ 1, %for.body.i.i20.preheader.new ], [ %mul3.i.i30.1, %b.exit.i.i26.1 ]
%x.09.i.i23 = phi i32 [ 0, %for.body.i.i20.preheader.new ], [ %add.i.i29.1, %b.exit.i.i26.1 ]
%niter = phi i64 [ 0, %for.body.i.i20.preheader.new ], [ %niter.next.1, %b.exit.i.i26.1 ]
%arrayidx.i.i24 = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.i.i21
%14 = load i8, ptr %arrayidx.i.i24, align 1, !tbaa !9
%switch.tableidx41 = add i8 %14, -65
%15 = icmp ult i8 %switch.tableidx41, 7
br i1 %15, label %switch.lookup40, label %b.exit.i.i26
switch.lookup40: ; preds = %for.body.i.i20
%16 = sext i8 %switch.tableidx41 to i64
%switch.gep42 = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %16
%switch.load43 = load i32, ptr %switch.gep42, align 4
br label %b.exit.i.i26
b.exit.i.i26: ; preds = %for.body.i.i20, %switch.lookup40
%retval.0.i.i.i27 = phi i32 [ %switch.load43, %switch.lookup40 ], [ 4, %for.body.i.i20 ]
%mul.i.i28 = mul nsw i32 %retval.0.i.i.i27, %p.011.i.i22
%add.i.i29 = add nuw nsw i32 %mul.i.i28, %x.09.i.i23
%mul3.i.i30 = mul nsw i32 %p.011.i.i22, 5
%indvars.iv.next.i.i31 = or i64 %indvars.iv.i.i21, 1
%arrayidx.i.i24.1 = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.next.i.i31
%17 = load i8, ptr %arrayidx.i.i24.1, align 1, !tbaa !9
%switch.tableidx41.1 = add i8 %17, -65
%18 = icmp ult i8 %switch.tableidx41.1, 7
br i1 %18, label %switch.lookup40.1, label %b.exit.i.i26.1
switch.lookup40.1: ; preds = %b.exit.i.i26
%19 = sext i8 %switch.tableidx41.1 to i64
%switch.gep42.1 = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %19
%switch.load43.1 = load i32, ptr %switch.gep42.1, align 4
br label %b.exit.i.i26.1
b.exit.i.i26.1: ; preds = %switch.lookup40.1, %b.exit.i.i26
%retval.0.i.i.i27.1 = phi i32 [ %switch.load43.1, %switch.lookup40.1 ], [ 4, %b.exit.i.i26 ]
%mul.i.i28.1 = mul nsw i32 %retval.0.i.i.i27.1, %mul3.i.i30
%add.i.i29.1 = add nuw nsw i32 %mul.i.i28.1, %add.i.i29
%mul3.i.i30.1 = mul i32 %p.011.i.i22, 25
%indvars.iv.next.i.i31.1 = add nuw nsw i64 %indvars.iv.i.i21, 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 %a.exit.loopexit.i33.unr-lcssa, label %for.body.i.i20, !llvm.loop !10
a.exit.loopexit.i33.unr-lcssa: ; preds = %b.exit.i.i26.1, %for.body.i.i20.preheader
%add.i.i29.lcssa.ph = phi i32 [ undef, %for.body.i.i20.preheader ], [ %add.i.i29.1, %b.exit.i.i26.1 ]
%indvars.iv.i.i21.unr = phi i64 [ 0, %for.body.i.i20.preheader ], [ %indvars.iv.next.i.i31.1, %b.exit.i.i26.1 ]
%p.011.i.i22.unr = phi i32 [ 1, %for.body.i.i20.preheader ], [ %mul3.i.i30.1, %b.exit.i.i26.1 ]
%x.09.i.i23.unr = phi i32 [ 0, %for.body.i.i20.preheader ], [ %add.i.i29.1, %b.exit.i.i26.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %a.exit.loopexit.i33, label %for.body.i.i20.epil
for.body.i.i20.epil: ; preds = %a.exit.loopexit.i33.unr-lcssa
%arrayidx.i.i24.epil = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.i.i21.unr
%20 = load i8, ptr %arrayidx.i.i24.epil, align 1, !tbaa !9
%switch.tableidx41.epil = add i8 %20, -65
%21 = icmp ult i8 %switch.tableidx41.epil, 7
br i1 %21, label %switch.lookup40.epil, label %b.exit.i.i26.epil
switch.lookup40.epil: ; preds = %for.body.i.i20.epil
%22 = sext i8 %switch.tableidx41.epil to i64
%switch.gep42.epil = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %22
%switch.load43.epil = load i32, ptr %switch.gep42.epil, align 4
br label %b.exit.i.i26.epil
b.exit.i.i26.epil: ; preds = %switch.lookup40.epil, %for.body.i.i20.epil
%retval.0.i.i.i27.epil = phi i32 [ %switch.load43.epil, %switch.lookup40.epil ], [ 4, %for.body.i.i20.epil ]
%mul.i.i28.epil = mul nsw i32 %retval.0.i.i.i27.epil, %p.011.i.i22.unr
%add.i.i29.epil = add nuw nsw i32 %mul.i.i28.epil, %x.09.i.i23.unr
br label %a.exit.loopexit.i33
a.exit.loopexit.i33: ; preds = %a.exit.loopexit.i33.unr-lcssa, %b.exit.i.i26.epil
%add.i.i29.lcssa = phi i32 [ %add.i.i29.lcssa.ph, %a.exit.loopexit.i33.unr-lcssa ], [ %add.i.i29.epil, %b.exit.i.i26.epil ]
%23 = zext i32 %add.i.i29.lcssa to i64
br label %find.exit
find.exit: ; preds = %if.then8, %a.exit.loopexit.i33
%x.0.lcssa.i.i34 = phi i64 [ 0, %if.then8 ], [ %23, %a.exit.loopexit.i33 ]
%arrayidx.i35 = getelementptr inbounds [100000000 x i32], ptr @x, i64 0, i64 %x.0.lcssa.i.i34
%24 = load i32, ptr %arrayidx.i35, align 4, !tbaa !5
%tobool.not.i.not = icmp eq i32 %24, 0
br i1 %tobool.not.i.not, label %if.else12, label %if.then10
if.then10: ; preds = %find.exit
%puts17 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc
if.else12: ; preds = %find.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then10, %if.else12
%inc = add nuw nsw i32 %i.039, 1
%25 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %25
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %str) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @insert() local_unnamed_addr #3 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @c) #9
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %a.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %a.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %b.exit.i.1, %for.body.i.preheader.new
%indvars.iv.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %indvars.iv.next.i.1, %b.exit.i.1 ]
%p.011.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul3.i.1, %b.exit.i.1 ]
%x.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %b.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %b.exit.i.1 ]
%arrayidx.i = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !9
%switch.tableidx = add i8 %1, -65
%2 = icmp ult i8 %switch.tableidx, 7
br i1 %2, label %switch.lookup, label %b.exit.i
switch.lookup: ; preds = %for.body.i
%3 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %3
%switch.load = load i32, ptr %switch.gep, align 4
br label %b.exit.i
b.exit.i: ; preds = %for.body.i, %switch.lookup
%retval.0.i.i = phi i32 [ %switch.load, %switch.lookup ], [ 4, %for.body.i ]
%mul.i = mul nsw i32 %retval.0.i.i, %p.011.i
%add.i = add nuw nsw i32 %mul.i, %x.09.i
%mul3.i = mul nsw i32 %p.011.i, 5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.next.i
%4 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !9
%switch.tableidx.1 = add i8 %4, -65
%5 = icmp ult i8 %switch.tableidx.1, 7
br i1 %5, label %switch.lookup.1, label %b.exit.i.1
switch.lookup.1: ; preds = %b.exit.i
%6 = sext i8 %switch.tableidx.1 to i64
%switch.gep.1 = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %6
%switch.load.1 = load i32, ptr %switch.gep.1, align 4
br label %b.exit.i.1
b.exit.i.1: ; preds = %switch.lookup.1, %b.exit.i
%retval.0.i.i.1 = phi i32 [ %switch.load.1, %switch.lookup.1 ], [ 4, %b.exit.i ]
%mul.i.1 = mul nsw i32 %retval.0.i.i.1, %mul3.i
%add.i.1 = add nuw nsw i32 %mul.i.1, %add.i
%mul3.i.1 = mul i32 %p.011.i, 25
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %a.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !10
a.exit.loopexit.unr-lcssa: ; preds = %b.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %b.exit.i.1 ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %indvars.iv.next.i.1, %b.exit.i.1 ]
%p.011.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul3.i.1, %b.exit.i.1 ]
%x.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %b.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %a.exit.loopexit, label %for.body.i.epil
for.body.i.epil: ; preds = %a.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.i.unr
%7 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !9
%switch.tableidx.epil = add i8 %7, -65
%8 = icmp ult i8 %switch.tableidx.epil, 7
br i1 %8, label %switch.lookup.epil, label %b.exit.i.epil
switch.lookup.epil: ; preds = %for.body.i.epil
%9 = sext i8 %switch.tableidx.epil to i64
%switch.gep.epil = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %9
%switch.load.epil = load i32, ptr %switch.gep.epil, align 4
br label %b.exit.i.epil
b.exit.i.epil: ; preds = %switch.lookup.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ %switch.load.epil, %switch.lookup.epil ], [ 4, %for.body.i.epil ]
%mul.i.epil = mul nsw i32 %retval.0.i.i.epil, %p.011.i.unr
%add.i.epil = add nuw nsw i32 %mul.i.epil, %x.09.i.unr
br label %a.exit.loopexit
a.exit.loopexit: ; preds = %a.exit.loopexit.unr-lcssa, %b.exit.i.epil
%add.i.lcssa = phi i32 [ %add.i.lcssa.ph, %a.exit.loopexit.unr-lcssa ], [ %add.i.epil, %b.exit.i.epil ]
%10 = zext i32 %add.i.lcssa to i64
br label %a.exit
a.exit: ; preds = %a.exit.loopexit, %entry
%x.0.lcssa.i = phi i64 [ 0, %entry ], [ %10, %a.exit.loopexit ]
%arrayidx = getelementptr inbounds [100000000 x i32], ptr @x, i64 0, i64 %x.0.lcssa.i
store i32 1, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @find() local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @c) #9
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %a.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %a.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %b.exit.i.1, %for.body.i.preheader.new
%indvars.iv.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %indvars.iv.next.i.1, %b.exit.i.1 ]
%p.011.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul3.i.1, %b.exit.i.1 ]
%x.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %b.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %b.exit.i.1 ]
%arrayidx.i = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !9
%switch.tableidx = add i8 %1, -65
%2 = icmp ult i8 %switch.tableidx, 7
br i1 %2, label %switch.lookup, label %b.exit.i
switch.lookup: ; preds = %for.body.i
%3 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %3
%switch.load = load i32, ptr %switch.gep, align 4
br label %b.exit.i
b.exit.i: ; preds = %for.body.i, %switch.lookup
%retval.0.i.i = phi i32 [ %switch.load, %switch.lookup ], [ 4, %for.body.i ]
%mul.i = mul nsw i32 %retval.0.i.i, %p.011.i
%add.i = add nuw nsw i32 %mul.i, %x.09.i
%mul3.i = mul nsw i32 %p.011.i, 5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.next.i
%4 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !9
%switch.tableidx.1 = add i8 %4, -65
%5 = icmp ult i8 %switch.tableidx.1, 7
br i1 %5, label %switch.lookup.1, label %b.exit.i.1
switch.lookup.1: ; preds = %b.exit.i
%6 = sext i8 %switch.tableidx.1 to i64
%switch.gep.1 = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %6
%switch.load.1 = load i32, ptr %switch.gep.1, align 4
br label %b.exit.i.1
b.exit.i.1: ; preds = %switch.lookup.1, %b.exit.i
%retval.0.i.i.1 = phi i32 [ %switch.load.1, %switch.lookup.1 ], [ 4, %b.exit.i ]
%mul.i.1 = mul nsw i32 %retval.0.i.i.1, %mul3.i
%add.i.1 = add nuw nsw i32 %mul.i.1, %add.i
%mul3.i.1 = mul i32 %p.011.i, 25
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %a.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !10
a.exit.loopexit.unr-lcssa: ; preds = %b.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %b.exit.i.1 ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %indvars.iv.next.i.1, %b.exit.i.1 ]
%p.011.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul3.i.1, %b.exit.i.1 ]
%x.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %b.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %a.exit.loopexit, label %for.body.i.epil
for.body.i.epil: ; preds = %a.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.i.unr
%7 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !9
%switch.tableidx.epil = add i8 %7, -65
%8 = icmp ult i8 %switch.tableidx.epil, 7
br i1 %8, label %switch.lookup.epil, label %b.exit.i.epil
switch.lookup.epil: ; preds = %for.body.i.epil
%9 = sext i8 %switch.tableidx.epil to i64
%switch.gep.epil = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %9
%switch.load.epil = load i32, ptr %switch.gep.epil, align 4
br label %b.exit.i.epil
b.exit.i.epil: ; preds = %switch.lookup.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ %switch.load.epil, %switch.lookup.epil ], [ 4, %for.body.i.epil ]
%mul.i.epil = mul nsw i32 %retval.0.i.i.epil, %p.011.i.unr
%add.i.epil = add nuw nsw i32 %mul.i.epil, %x.09.i.unr
br label %a.exit.loopexit
a.exit.loopexit: ; preds = %a.exit.loopexit.unr-lcssa, %b.exit.i.epil
%add.i.lcssa = phi i32 [ %add.i.lcssa.ph, %a.exit.loopexit.unr-lcssa ], [ %add.i.epil, %b.exit.i.epil ]
%10 = zext i32 %add.i.lcssa to i64
br label %a.exit
a.exit: ; preds = %a.exit.loopexit, %entry
%x.0.lcssa.i = phi i64 [ 0, %entry ], [ %10, %a.exit.loopexit ]
%arrayidx = getelementptr inbounds [100000000 x i32], ptr @x, i64 0, i64 %x.0.lcssa.i
%11 = load i32, ptr %arrayidx, align 4, !tbaa !5
%tobool.not = icmp ne i32 %11, 0
%. = zext i1 %tobool.not to i32
ret i32 %.
}
; 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 memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @a() local_unnamed_addr #4 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @c) #9
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %b.exit.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %b.exit.1 ]
%p.011 = phi i32 [ 1, %for.body.preheader.new ], [ %mul3.1, %b.exit.1 ]
%x.09 = phi i32 [ 0, %for.body.preheader.new ], [ %add.1, %b.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %b.exit.1 ]
%arrayidx = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%switch.tableidx = add i8 %1, -65
%2 = icmp ult i8 %switch.tableidx, 7
br i1 %2, label %switch.lookup, label %b.exit
switch.lookup: ; preds = %for.body
%3 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %3
%switch.load = load i32, ptr %switch.gep, align 4
br label %b.exit
b.exit: ; preds = %for.body, %switch.lookup
%retval.0.i = phi i32 [ %switch.load, %switch.lookup ], [ 4, %for.body ]
%mul = mul nsw i32 %retval.0.i, %p.011
%add = add nuw nsw i32 %mul, %x.09
%mul3 = mul nsw i32 %p.011, 5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%switch.tableidx.1 = add i8 %4, -65
%5 = icmp ult i8 %switch.tableidx.1, 7
br i1 %5, label %switch.lookup.1, label %b.exit.1
switch.lookup.1: ; preds = %b.exit
%6 = sext i8 %switch.tableidx.1 to i64
%switch.gep.1 = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %6
%switch.load.1 = load i32, ptr %switch.gep.1, align 4
br label %b.exit.1
b.exit.1: ; preds = %switch.lookup.1, %b.exit
%retval.0.i.1 = phi i32 [ %switch.load.1, %switch.lookup.1 ], [ 4, %b.exit ]
%mul.1 = mul nsw i32 %retval.0.i.1, %mul3
%add.1 = add nuw nsw i32 %mul.1, %add
%mul3.1 = mul i32 %p.011, 25
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.end.loopexit.unr-lcssa: ; preds = %b.exit.1, %for.body.preheader
%add.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %add.1, %b.exit.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %b.exit.1 ]
%p.011.unr = phi i32 [ 1, %for.body.preheader ], [ %mul3.1, %b.exit.1 ]
%x.09.unr = phi i32 [ 0, %for.body.preheader ], [ %add.1, %b.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [14 x i8], ptr @c, i64 0, i64 %indvars.iv.unr
%7 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
%switch.tableidx.epil = add i8 %7, -65
%8 = icmp ult i8 %switch.tableidx.epil, 7
br i1 %8, label %switch.lookup.epil, label %b.exit.epil
switch.lookup.epil: ; preds = %for.body.epil
%9 = sext i8 %switch.tableidx.epil to i64
%switch.gep.epil = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %9
%switch.load.epil = load i32, ptr %switch.gep.epil, align 4
br label %b.exit.epil
b.exit.epil: ; preds = %switch.lookup.epil, %for.body.epil
%retval.0.i.epil = phi i32 [ %switch.load.epil, %switch.lookup.epil ], [ 4, %for.body.epil ]
%mul.epil = mul nsw i32 %retval.0.i.epil, %p.011.unr
%add.epil = add nuw nsw i32 %mul.epil, %x.09.unr
br label %for.end
for.end: ; preds = %b.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%x.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %b.exit.epil ]
ret i32 %x.0.lcssa
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @b(i8 noundef signext %c) local_unnamed_addr #6 {
entry:
%switch.tableidx = add i8 %c, -65
%0 = icmp ult i8 %switch.tableidx, 7
br i1 %0, label %switch.lookup, label %return
switch.lookup: ; preds = %entry
%1 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table.b, i64 0, i64 %1
%switch.load = load i32, ptr %switch.gep, align 4
br label %return
return: ; preds = %entry, %switch.lookup
%retval.0 = phi i32 [ %switch.load, %switch.lookup ], [ 4, %entry ]
ret i32 %retval.0
}
; 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 = { nofree 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 = { nofree 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 #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 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 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define HASH_SIZE 8388617
typedef struct _node {
int val;
struct _node *next;
} node;
void push(node **p, int val)
{
node *w = (node *)malloc(sizeof(node));
w->val = val;
w->next = *p;
*p = w;
}
void terminate(node **p, int n)
{
int i;
node *w1, *w2;
for (i = 0; i < n; i++)
{
w1 = p[i];
while (w1 != NULL)
{
w2 = w1->next;
free(w1);
w1 = w2;
}
}
}
int getCode(char *s)
{
int code = 1;
int i;
for (i = 0; s[i] != '\0'; i++)
{
s[i] = s[i] & 0x06;
s[i] = s[i] >> 1;
code = code << 2;
code = code | s[i];
}
return code;
}
int isInclude(node *p, int val)
{
while (p != NULL)
{
if (p->val == val) break;
p = p->next;
}
if (p == NULL) return 0;
return 1;
}
int main()
{
int i, n, key, code;
char str[13], order[7];
node **top = (node **)malloc(sizeof(node *) * HASH_SIZE);
for (i = 0; i < HASH_SIZE; i++) top[i] = NULL;
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%s%s", order, str);
code = getCode(str);
key = code % HASH_SIZE;
switch (order[0])
{
case 'i':
push(&top[key], code);
break;
case 'f':
if (isInclude(top[key], code)) printf("yes\n");
else printf("no\n");
break;
}
}
terminate(top, HASH_SIZE);
free(top);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246229/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246229/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._node = type { i32, ptr }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: readwrite) uwtable
define dso_local void @push(ptr nocapture noundef %p, i32 noundef %val) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #10
store i32 %val, ptr %call, align 8, !tbaa !5
%0 = load ptr, ptr %p, align 8, !tbaa !11
%next = getelementptr inbounds %struct._node, ptr %call, i64 0, i32 1
store ptr %0, ptr %next, align 8, !tbaa !12
store ptr %call, ptr %p, align 8, !tbaa !11
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local void @terminate(ptr nocapture noundef readonly %p, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp8 = icmp sgt i32 %n, 0
br i1 %cmp8, 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.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds ptr, ptr %p, i64 %indvars.iv
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !11
%cmp1.not6 = icmp eq ptr %0, null
br i1 %cmp1.not6, label %for.inc, label %while.body
while.body: ; preds = %for.body, %while.body
%w1.07 = phi ptr [ %1, %while.body ], [ %0, %for.body ]
%next = getelementptr inbounds %struct._node, ptr %w1.07, i64 0, i32 1
%1 = load ptr, ptr %next, align 8, !tbaa !12
tail call void @free(ptr noundef nonnull %w1.07) #11
%cmp1.not = icmp eq ptr %1, null
br i1 %cmp1.not, label %for.inc, label %while.body, !llvm.loop !13
for.inc: ; preds = %while.body, %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !15
for.end: ; preds = %for.inc, %entry
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @getCode(ptr nocapture noundef %s) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %s, align 1, !tbaa !16
%cmp.not30 = icmp eq i8 %0, 0
br i1 %cmp.not30, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = phi i8 [ %4, %for.body ], [ %0, %entry ]
%arrayidx33 = phi ptr [ %arrayidx, %for.body ], [ %s, %entry ]
%code.031 = phi i32 [ %or, %for.body ], [ 1, %entry ]
%2 = lshr i8 %1, 1
%3 = and i8 %2, 3
store i8 %3, ptr %arrayidx33, align 1, !tbaa !16
%shl = shl i32 %code.031, 2
%conv16 = zext i8 %3 to i32
%or = or i32 %shl, %conv16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx, align 1, !tbaa !16
%cmp.not = icmp eq i8 %4, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.body, %entry
%code.0.lcssa = phi i32 [ 1, %entry ], [ %or, %for.body ]
ret i32 %code.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @isInclude(ptr noundef readonly %p, i32 noundef %val) local_unnamed_addr #6 {
entry:
%cond9 = icmp eq ptr %p, null
br i1 %cond9, label %return, label %while.body
while.body: ; preds = %entry, %if.end
%p.addr.010 = phi ptr [ %1, %if.end ], [ %p, %entry ]
%0 = load i32, ptr %p.addr.010, align 8, !tbaa !5
%cmp2 = icmp eq i32 %0, %val
br i1 %cmp2, label %return, label %if.end
if.end: ; preds = %while.body
%next = getelementptr inbounds %struct._node, ptr %p.addr.010, i64 0, i32 1
%1 = load ptr, ptr %next, align 8, !tbaa !12
%cond = icmp eq ptr %1, null
br i1 %cond, label %return, label %while.body, !llvm.loop !18
return: ; preds = %if.end, %while.body, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %while.body ], [ 0, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%str = alloca [13 x i8], align 1
%order = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 13, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %order) #11
%calloc = tail call dereferenceable_or_null(67108936) ptr @calloc(i64 1, i64 67108936)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !19
%cmp343 = icmp sgt i32 %0, 0
br i1 %cmp343, label %for.body4, label %for.body.i34.preheader
for.body4: ; preds = %entry, %for.inc18
%i.144 = phi i32 [ %inc19, %for.inc18 ], [ 0, %entry ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %order, ptr noundef nonnull %str)
%1 = load i8, ptr %str, align 1, !tbaa !16
%cmp.not30.i = icmp eq i8 %1, 0
br i1 %cmp.not30.i, label %getCode.exit, label %for.body.i
for.body.i: ; preds = %for.body4, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 0, %for.body4 ]
%2 = phi i8 [ %5, %for.body.i ], [ %1, %for.body4 ]
%arrayidx33.i = phi ptr [ %arrayidx.i, %for.body.i ], [ %str, %for.body4 ]
%code.031.i = phi i32 [ %or.i, %for.body.i ], [ 1, %for.body4 ]
%3 = lshr i8 %2, 1
%4 = and i8 %3, 3
store i8 %4, ptr %arrayidx33.i, align 1, !tbaa !16
%shl.i = shl i32 %code.031.i, 2
%conv16.i = zext i8 %4 to i32
%or.i = or i32 %shl.i, %conv16.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i
%5 = load i8, ptr %arrayidx.i, align 1, !tbaa !16
%cmp.not.i = icmp eq i8 %5, 0
br i1 %cmp.not.i, label %getCode.exit, label %for.body.i, !llvm.loop !17
getCode.exit: ; preds = %for.body.i, %for.body4
%code.0.lcssa.i = phi i32 [ 1, %for.body4 ], [ %or.i, %for.body.i ]
%rem = srem i32 %code.0.lcssa.i, 8388617
%6 = load i8, ptr %order, align 1, !tbaa !16
%conv = sext i8 %6 to i32
switch i32 %conv, label %for.inc18 [
i32 105, label %sw.bb
i32 102, label %sw.bb12
]
sw.bb: ; preds = %getCode.exit
%idxprom10 = sext i32 %rem to i64
%arrayidx11 = getelementptr inbounds ptr, ptr %calloc, i64 %idxprom10
%call.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #10
store i32 %code.0.lcssa.i, ptr %call.i, align 8, !tbaa !5
%7 = load ptr, ptr %arrayidx11, align 8, !tbaa !11
%next.i = getelementptr inbounds %struct._node, ptr %call.i, i64 0, i32 1
store ptr %7, ptr %next.i, align 8, !tbaa !12
store ptr %call.i, ptr %arrayidx11, align 8, !tbaa !11
br label %for.inc18
sw.bb12: ; preds = %getCode.exit
%idxprom13 = sext i32 %rem to i64
%arrayidx14 = getelementptr inbounds ptr, ptr %calloc, i64 %idxprom13
%8 = load ptr, ptr %arrayidx14, align 8, !tbaa !11
%cond9.i = icmp eq ptr %8, null
br i1 %cond9.i, label %if.else, label %while.body.i
while.body.i: ; preds = %sw.bb12, %if.end.i
%p.addr.010.i = phi ptr [ %10, %if.end.i ], [ %8, %sw.bb12 ]
%9 = load i32, ptr %p.addr.010.i, align 8, !tbaa !5
%cmp2.i = icmp eq i32 %9, %code.0.lcssa.i
br i1 %cmp2.i, label %if.then, label %if.end.i
if.end.i: ; preds = %while.body.i
%next.i33 = getelementptr inbounds %struct._node, ptr %p.addr.010.i, i64 0, i32 1
%10 = load ptr, ptr %next.i33, align 8, !tbaa !12
%cond.i = icmp eq ptr %10, null
br i1 %cond.i, label %if.else, label %while.body.i, !llvm.loop !18
if.then: ; preds = %while.body.i
%puts32 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc18
if.else: ; preds = %if.end.i, %sw.bb12
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc18
for.inc18: ; preds = %sw.bb, %getCode.exit, %if.else, %if.then
%inc19 = add nuw nsw i32 %i.144, 1
%11 = load i32, ptr %n, align 4, !tbaa !19
%cmp3 = icmp slt i32 %inc19, %11
br i1 %cmp3, label %for.body4, label %for.body.i34.preheader, !llvm.loop !20
for.body.i34.preheader: ; preds = %for.inc18, %entry
br label %for.body.i34
for.body.i34: ; preds = %for.body.i34.preheader, %for.inc.i
%indvars.iv.i35 = phi i64 [ %indvars.iv.next.i39, %for.inc.i ], [ 0, %for.body.i34.preheader ]
%arrayidx.i36 = getelementptr inbounds ptr, ptr %calloc, i64 %indvars.iv.i35
%12 = load ptr, ptr %arrayidx.i36, align 8, !tbaa !11
%cmp1.not6.i = icmp eq ptr %12, null
br i1 %cmp1.not6.i, label %for.inc.i, label %while.body.i37
while.body.i37: ; preds = %for.body.i34, %while.body.i37
%w1.07.i = phi ptr [ %13, %while.body.i37 ], [ %12, %for.body.i34 ]
%next.i38 = getelementptr inbounds %struct._node, ptr %w1.07.i, i64 0, i32 1
%13 = load ptr, ptr %next.i38, align 8, !tbaa !12
call void @free(ptr noundef nonnull %w1.07.i) #11
%cmp1.not.i = icmp eq ptr %13, null
br i1 %cmp1.not.i, label %for.inc.i, label %while.body.i37, !llvm.loop !13
for.inc.i: ; preds = %while.body.i37, %for.body.i34
%indvars.iv.next.i39 = add nuw nsw i64 %indvars.iv.i35, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i39, 8388617
br i1 %exitcond.not.i, label %terminate.exit, label %for.body.i34, !llvm.loop !15
terminate.exit: ; preds = %for.inc.i
call void @free(ptr noundef %calloc) #11
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %order) #11
call void @llvm.lifetime.end.p0(i64 13, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #9
attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind }
attributes #9 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_node", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!6, !10, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !14}
|
/* Dictionary */
#include <stdio.h>
#include <string.h>
#define M 1046527
//#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch) {
if(ch == 'A') return 1;
else if(ch == 'C') return 2;
else if(ch == 'G') return 3;
else if(ch == 'T') return 4;
else return 0;
}
long long getKey(char str[]) {
long long sum=0, p=1, i;
for(i=0; i < strlen(str); i++){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1));}
int find(char str[]) {
long long key, i, h;
key = getKey(str);
for(i=0;; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h], str) == 0) return 1;
else if(strlen(H[h]) == 0) return 0;
}
return 0;
}
int insert(char str[]) {
long long key, i, h;
key = getKey(str);
for(i=0;; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h], str) == 0) return 1;
else if(strlen(H[h]) == 0) {
strcpy(H[h], str);
return 0;
}
}
return 0;
}
int main() {
int i, n, h;
char str[L], com[9];
for(i=0; i<M; i++){ H[i][0] = '\0'; }
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%s %s", com, str);
if(com[0] == 'i') {
insert(str);
} else {
if(find(str)) {
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246272/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246272/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <string.h>
#define T 1000003
char Hash[T][12];
int getChar(char string){
if(string=='A')return 1;
else if(string=='C')return 2;
else if(string=='G')return 3;
else if(string=='T')return 4;
else return 0;
}
int h1(int key){
return key%T;
}
int h2(int key){
return 1+key%T;
}
int generateKey(char str[]){
int i,char_value=0,rate=1;
for(i=0;i<strlen(str);i++){
char_value+=rate*getChar(str[i]);
rate*=5;
}
return char_value;
}
void insert(char str[],int key){
int h_number,i=0;
while(1){
h_number=(h1(key)+i*h2(key))%T;
//元からあったとき
if(strcmp(Hash[h_number],str)==0)break;
//添字の部分に何もなかったとき(代入コピー操作)
if(strlen(Hash[h_number])==0){
strcpy(Hash[h_number],str);
break;
}
i++;
}
}
int find(char str[],int key){
int h_number,i=0;
while(1){
h_number=(h1(key)+i*h2(key))%T;
if(strcmp(Hash[h_number],str)==0)return 1;//match
else if(strlen(Hash[h_number])==0)break;
i++;
}
return 0;//Not match
}
int main(void){
int i,n,key;
char str[12],command[6];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%s",command,str);
key=generateKey(str);
if(command[0]=='i')insert(str,key);
else{
if(find(str,key)==1)printf("yes\n");
else printf("no\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246315/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246315/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@Hash = dso_local global [1000003 x [12 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %string) local_unnamed_addr #0 {
entry:
switch i8 %string, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000003
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000003
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i32 @generateKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp9.not = icmp eq i64 %call, 0
br i1 %cmp9.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %getChar.exit.1 ]
%rate.012 = phi i32 [ 1, %for.body.preheader.new ], [ %mul3.1, %getChar.exit.1 ]
%char_value.011 = phi i32 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i32 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i32 %retval.0.i, %rate.012
%add = add nuw nsw i32 %mul, %char_value.011
%mul3 = mul nsw i32 %rate.012, 5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i32 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i32 %retval.0.i.1, %mul3
%add.1 = add nuw nsw i32 %mul.1, %add
%mul3.1 = mul i32 %rate.012, 25
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %getChar.exit.1 ]
%rate.012.unr = phi i32 [ 1, %for.body.preheader ], [ %mul3.1, %getChar.exit.1 ]
%char_value.011.unr = phi i32 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i32 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i32 %retval.0.i.epil, %rate.012.unr
%add.epil = add nuw nsw i32 %mul.epil, %char_value.011.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%char_value.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i32 %char_value.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef readonly %str, i32 noundef %key) local_unnamed_addr #4 {
entry:
%rem.i = srem i32 %key, 1000003
%add.i = add nsw i32 %rem.i, 1
%idxprom21 = sext i32 %rem.i to i64
%arrayidx22 = getelementptr inbounds [1000003 x [12 x i8]], ptr @Hash, i64 0, i64 %idxprom21
%call223 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx22, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp24 = icmp eq i32 %call223, 0
br i1 %cmp24, label %while.end, label %if.end
while.cond: ; preds = %if.end
%inc = add nuw nsw i32 %i.025, 1
%mul = mul nsw i32 %inc, %add.i
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 1000003
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [1000003 x [12 x i8]], ptr @Hash, i64 0, i64 %idxprom
%call2 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call2, 0
br i1 %cmp, label %while.end, label %if.end
if.end: ; preds = %entry, %while.cond
%arrayidx26 = phi ptr [ %arrayidx, %while.cond ], [ %arrayidx22, %entry ]
%i.025 = phi i32 [ %inc, %while.cond ], [ 0, %entry ]
%char0 = load i8, ptr %arrayidx26, align 1
%cmp7 = icmp eq i8 %char0, 0
br i1 %cmp7, label %if.then8, label %while.cond
if.then8: ; preds = %if.end
%call12 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx26, ptr noundef nonnull dereferenceable(1) %str) #11
br label %while.end
while.end: ; preds = %while.cond, %entry, %if.then8
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; 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 #5
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str, i32 noundef %key) local_unnamed_addr #6 {
entry:
%rem.i = srem i32 %key, 1000003
%add.i = add nsw i32 %rem.i, 1
%idxprom15 = sext i32 %rem.i to i64
%arrayidx16 = getelementptr inbounds [1000003 x [12 x i8]], ptr @Hash, i64 0, i64 %idxprom15
%call217 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx16, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp18 = icmp eq i32 %call217, 0
br i1 %cmp18, label %cleanup, label %if.else
while.cond: ; preds = %if.else
%inc = add nuw nsw i32 %i.019, 1
%mul = mul nsw i32 %inc, %add.i
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 1000003
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [1000003 x [12 x i8]], ptr @Hash, i64 0, i64 %idxprom
%call2 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call2, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry, %while.cond
%arrayidx20 = phi ptr [ %arrayidx, %while.cond ], [ %arrayidx16, %entry ]
%i.019 = phi i32 [ %inc, %while.cond ], [ 0, %entry ]
%char0 = load i8, ptr %arrayidx20, align 1
%cmp7 = icmp eq i8 %char0, 0
br i1 %cmp7, label %cleanup, label %while.cond
cleanup: ; preds = %while.cond, %if.else, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.else ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [12 x i8], align 1
%command = alloca [6 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %command) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.040 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %command, ptr noundef nonnull %str)
%call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp9.not.i = icmp eq i64 %call.i, 0
br i1 %cmp9.not.i, label %generateKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body
%xtraiter = and i64 %call.i, 1
%1 = icmp eq i64 %call.i, 1
br i1 %1, label %generateKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%indvars.iv.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %indvars.iv.next.i.1, %getChar.exit.i.1 ]
%rate.012.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul3.i.1, %getChar.exit.i.1 ]
%char_value.011.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul nsw i32 %retval.0.i.i, %rate.012.i
%add.i = add nuw nsw i32 %mul.i, %char_value.011.i
%mul3.i = mul nsw i32 %rate.012.i, 5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i
%3 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul nsw i32 %retval.0.i.i.1, %mul3.i
%add.i.1 = add nuw nsw i32 %mul.i.1, %add.i
%mul3.i.1 = mul i32 %rate.012.i, 25
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %generateKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
generateKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %indvars.iv.next.i.1, %getChar.exit.i.1 ]
%rate.012.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul3.i.1, %getChar.exit.i.1 ]
%char_value.011.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %generateKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %generateKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i.unr
%4 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %4, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul nsw i32 %retval.0.i.i.epil, %rate.012.i.unr
%add.i.epil = add nuw nsw i32 %mul.i.epil, %char_value.011.i.unr
br label %generateKey.exit
generateKey.exit: ; preds = %getChar.exit.i.epil, %generateKey.exit.loopexit.unr-lcssa, %for.body
%char_value.0.lcssa.i = phi i32 [ 0, %for.body ], [ %add.i.lcssa.ph, %generateKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%5 = load i8, ptr %command, align 1, !tbaa !5
%cmp5 = icmp eq i8 %5, 105
%rem.i.i = srem i32 %char_value.0.lcssa.i, 1000003
%add.i.i = add nsw i32 %rem.i.i, 1
%idxprom21.i = sext i32 %rem.i.i to i64
%arrayidx22.i = getelementptr inbounds [1000003 x [12 x i8]], ptr @Hash, i64 0, i64 %idxprom21.i
%call223.i = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx22.i, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp24.i = icmp eq i32 %call223.i, 0
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %generateKey.exit
br i1 %cmp24.i, label %for.inc, label %if.end.i
while.cond.i: ; preds = %if.end.i
%inc.i = add nuw nsw i32 %i.025.i, 1
%mul.i20 = mul nsw i32 %inc.i, %add.i.i
%add.i21 = add nsw i32 %mul.i20, %rem.i.i
%rem.i = srem i32 %add.i21, 1000003
%idxprom.i = sext i32 %rem.i to i64
%arrayidx.i22 = getelementptr inbounds [1000003 x [12 x i8]], ptr @Hash, i64 0, i64 %idxprom.i
%call2.i = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i22, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp.i = icmp eq i32 %call2.i, 0
br i1 %cmp.i, label %for.inc, label %if.end.i
if.end.i: ; preds = %if.then, %while.cond.i
%arrayidx26.i = phi ptr [ %arrayidx.i22, %while.cond.i ], [ %arrayidx22.i, %if.then ]
%i.025.i = phi i32 [ %inc.i, %while.cond.i ], [ 0, %if.then ]
%char0.i = load i8, ptr %arrayidx26.i, align 1
%cmp7.i = icmp eq i8 %char0.i, 0
br i1 %cmp7.i, label %if.then8.i, label %while.cond.i
if.then8.i: ; preds = %if.end.i
%call12.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx26.i, ptr noundef nonnull dereferenceable(1) %str) #11
br label %for.inc
if.else: ; preds = %generateKey.exit
br i1 %cmp24.i, label %if.then12, label %if.else.i
while.cond.i27: ; preds = %if.else.i
%inc.i28 = add nuw nsw i32 %i.019.i, 1
%mul.i29 = mul nsw i32 %inc.i28, %add.i.i
%add.i30 = add nsw i32 %mul.i29, %rem.i.i
%rem.i31 = srem i32 %add.i30, 1000003
%idxprom.i32 = sext i32 %rem.i31 to i64
%arrayidx.i33 = getelementptr inbounds [1000003 x [12 x i8]], ptr @Hash, i64 0, i64 %idxprom.i32
%call2.i34 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i33, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp.i35 = icmp eq i32 %call2.i34, 0
br i1 %cmp.i35, label %if.then12, label %if.else.i
if.else.i: ; preds = %if.else, %while.cond.i27
%arrayidx20.i = phi ptr [ %arrayidx.i33, %while.cond.i27 ], [ %arrayidx22.i, %if.else ]
%i.019.i = phi i32 [ %inc.i28, %while.cond.i27 ], [ 0, %if.else ]
%char0.i25 = load i8, ptr %arrayidx20.i, align 1
%cmp7.i26 = icmp eq i8 %char0.i25, 0
br i1 %cmp7.i26, label %if.else14, label %while.cond.i27
if.then12: ; preds = %while.cond.i27, %if.else
%puts19 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc
if.else14: ; preds = %if.else.i
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
for.inc: ; preds = %while.cond.i, %if.then8.i, %if.then, %if.else14, %if.then12
%inc = add nuw nsw i32 %i.040, 1
%6 = load i32, ptr %n, align 4, !tbaa !10
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %command) #11
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nofree 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
|
/*s1190073 Rina Sato
File name: prog4c.c
This is double hashing program.
*/
#include <stdio.h>
#include <string.h>
#define M 1000003
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch){
if(ch == 'A') return 1;
else if(ch == 'C') return 2;
else if(ch == 'G') return 3;
else if(ch == 'T') return 4;
}
/*convert a string into an integer value*/
long long getKey(char str[]){
long long sum=0,p=1,i;
for(i = 0 ; i < strlen(str) ; i++){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){
return key%M;
}
int h2(int key){
return 1+(key%(M-1));
}
int find(char str[]){
int i,g,x=0;
g = (int)getKey(str);
for(i = 0 ; i < M ; i++){
x = (h1(g)+i*h2(g))%M;
if(strcmp(H[x],str) == 0) return 1;
else if(strlen(H[x]) == 0) return 0;
}
}
void insert(char str[]){
int i,x=0,g;
g = (int)getKey(str);
for(i = 0 ; i < M ; i++){
x = (h1(g)+i*h2(g))%M;
if(strlen(H[x]) == 0){
strcpy(H[x],str);
return;
}
}
}
int main(void){
int i,n,h;
char str[L],com[9];
for(i = 0 ; i < M ; i++){
H[i][0] = '\0';
}
scanf("%d",&n);
for(i = 0 ; i < n ; i++){
scanf("%s %s",com,str);
if(com[0] == 'i'){
insert(str);
}
else {
if(find(str)){
printf("yes\n");
}
else printf("no\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246380/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246380/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000003 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000003
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000002
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000003
%rem.i22 = srem i32 %sum.0.lcssa.i, 1000002
%add.i23 = add nsw i32 %rem.i22, 1
br label %for.body
for.cond: ; preds = %if.else
%inc = add nuw nsw i32 %i.024, 1
%exitcond.not = icmp eq i32 %inc, 1000003
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !10
for.body: ; preds = %getKey.exit, %for.cond
%i.024 = phi i32 [ 0, %getKey.exit ], [ %inc, %for.cond ]
%mul = mul nsw i32 %i.024, %add.i23
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 1000003
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom
%call4 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp5 = icmp eq i32 %call4, 0
br i1 %cmp5, label %cleanup, label %if.else
if.else: ; preds = %for.body
%char0 = load i8, ptr %arrayidx, align 2
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %for.body
%retval.0 = phi i32 [ 1, %for.body ], [ 0, %if.else ], [ undef, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000003
%rem.i18 = srem i32 %sum.0.lcssa.i, 1000002
%add.i19 = add nsw i32 %rem.i18, 1
br label %for.body
for.cond: ; preds = %for.body
%inc = or i32 %i.020, 1
%exitcond.not = icmp eq i32 %inc, 1000003
br i1 %exitcond.not, label %cleanup, label %for.body.1, !llvm.loop !11
for.body.1: ; preds = %for.cond
%mul.1 = mul nsw i32 %inc, %add.i19
%add.1 = add nsw i32 %mul.1, %rem.i
%rem.1 = srem i32 %add.1, 1000003
%idxprom.1 = sext i32 %rem.1 to i64
%arrayidx.1 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom.1
%char0.1 = load i8, ptr %arrayidx.1, align 2
%cmp5.1 = icmp eq i8 %char0.1, 0
br i1 %cmp5.1, label %if.then, label %for.cond.1
for.cond.1: ; preds = %for.body.1
%inc.1 = add nuw nsw i32 %i.020, 2
br label %for.body
for.body: ; preds = %for.cond.1, %getKey.exit
%i.020 = phi i32 [ 0, %getKey.exit ], [ %inc.1, %for.cond.1 ]
%mul = mul nsw i32 %i.020, %add.i19
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 1000003
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom
%char0 = load i8, ptr %arrayidx, align 2
%cmp5 = icmp eq i8 %char0, 0
br i1 %cmp5, label %if.then, label %for.cond
if.then: ; preds = %for.body.1, %for.body
%arrayidx.lcssa = phi ptr [ %arrayidx, %for.body ], [ %arrayidx.1, %for.body.1 ]
%call10 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.lcssa, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %if.then
ret void
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1000003
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !12
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%cmp367 = icmp sgt i32 %0, 0
br i1 %cmp367, label %for.body4, label %for.end20
for.body4: ; preds = %for.end, %for.inc18
%i.168 = phi i32 [ %inc19, %for.inc18 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
%call.i.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i.i = icmp eq i64 %call.i.i, 0
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
br i1 %cmp8.not.i.i, label %getKey.exit.i, label %for.body.i.i.preheader
for.body.i.i.preheader: ; preds = %if.then
%xtraiter75 = and i64 %call.i.i, 1
%2 = icmp eq i64 %call.i.i, 1
br i1 %2, label %getKey.exit.i.loopexit.unr-lcssa, label %for.body.i.i.preheader.new
for.body.i.i.preheader.new: ; preds = %for.body.i.i.preheader
%unroll_iter78 = and i64 %call.i.i, -2
br label %for.body.i.i
for.body.i.i: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader.new
%i.011.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i = phi i32 [ 1, %for.body.i.i.preheader.new ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i = phi i32 [ 0, %for.body.i.i.preheader.new ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%niter79 = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %niter79.next.1, %getChar.exit.i.i.1 ]
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i
%3 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.i [
i8 84, label %if.then15.i.i.i
i8 67, label %if.then5.i.i.i
i8 71, label %if.then10.i.i.i
]
if.then5.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then10.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then15.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
getChar.exit.i.i: ; preds = %if.then15.i.i.i, %if.then10.i.i.i, %if.then5.i.i.i, %for.body.i.i
%retval.0.i.i.i = phi i32 [ 2, %if.then5.i.i.i ], [ 3, %if.then10.i.i.i ], [ 4, %if.then15.i.i.i ], [ 1, %for.body.i.i ]
%mul.i.i = mul i32 %retval.0.i.i.i, %p.010.i.i
%add.i.i = add i32 %mul.i.i, %sum.09.i.i
%mul2.i.i = mul i32 %p.010.i.i, 5
%inc.i.i = or i64 %i.011.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i
%4 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
switch i8 %4, label %getChar.exit.i.i.1 [
i8 84, label %if.then15.i.i.i.1
i8 67, label %if.then5.i.i.i.1
i8 71, label %if.then10.i.i.i.1
]
if.then10.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then5.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then15.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
getChar.exit.i.i.1: ; preds = %if.then15.i.i.i.1, %if.then5.i.i.i.1, %if.then10.i.i.i.1, %getChar.exit.i.i
%retval.0.i.i.i.1 = phi i32 [ 2, %if.then5.i.i.i.1 ], [ 3, %if.then10.i.i.i.1 ], [ 4, %if.then15.i.i.i.1 ], [ 1, %getChar.exit.i.i ]
%mul.i.i.1 = mul i32 %retval.0.i.i.i.1, %mul2.i.i
%add.i.i.1 = add i32 %mul.i.i.1, %add.i.i
%mul2.i.i.1 = mul i32 %p.010.i.i, 25
%inc.i.i.1 = add nuw nsw i64 %i.011.i.i, 2
%niter79.next.1 = add i64 %niter79, 2
%niter79.ncmp.1 = icmp eq i64 %niter79.next.1, %unroll_iter78
br i1 %niter79.ncmp.1, label %getKey.exit.i.loopexit.unr-lcssa, label %for.body.i.i, !llvm.loop !8
getKey.exit.i.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader
%add.i.i.lcssa.ph = phi i32 [ undef, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%i.011.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i.unr = phi i32 [ 1, %for.body.i.i.preheader ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i.unr = phi i32 [ 0, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter75, 0
br i1 %lcmp.mod76.not, label %getKey.exit.i, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %getKey.exit.i.loopexit.unr-lcssa
%arrayidx.i.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i.unr
%5 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
switch i8 %5, label %getChar.exit.i.i.epil [
i8 84, label %if.then15.i.i.i.epil
i8 67, label %if.then5.i.i.i.epil
i8 71, label %if.then10.i.i.i.epil
]
if.then10.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then5.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then15.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
getChar.exit.i.i.epil: ; preds = %if.then15.i.i.i.epil, %if.then5.i.i.i.epil, %if.then10.i.i.i.epil, %for.body.i.i.epil
%retval.0.i.i.i.epil = phi i32 [ 2, %if.then5.i.i.i.epil ], [ 3, %if.then10.i.i.i.epil ], [ 4, %if.then15.i.i.i.epil ], [ 1, %for.body.i.i.epil ]
%mul.i.i.epil = mul i32 %retval.0.i.i.i.epil, %p.010.i.i.unr
%add.i.i.epil = add i32 %mul.i.i.epil, %sum.09.i.i.unr
br label %getKey.exit.i
getKey.exit.i: ; preds = %getChar.exit.i.i.epil, %getKey.exit.i.loopexit.unr-lcssa, %if.then
%sum.0.lcssa.i.i = phi i32 [ 0, %if.then ], [ %add.i.i.lcssa.ph, %getKey.exit.i.loopexit.unr-lcssa ], [ %add.i.i.epil, %getChar.exit.i.i.epil ]
%rem.i.i = srem i32 %sum.0.lcssa.i.i, 1000003
%rem.i18.i = srem i32 %sum.0.lcssa.i.i, 1000002
%add.i19.i = add nsw i32 %rem.i18.i, 1
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = or i32 %i.020.i, 1
%exitcond.not.i = icmp eq i32 %inc.i, 1000003
br i1 %exitcond.not.i, label %for.inc18, label %for.body.i.1, !llvm.loop !11
for.body.i.1: ; preds = %for.cond.i
%mul.i.1 = mul nsw i32 %inc.i, %add.i19.i
%add.i.1 = add nsw i32 %mul.i.1, %rem.i.i
%rem.i.1 = srem i32 %add.i.1, 1000003
%idxprom.i.1 = sext i32 %rem.i.1 to i64
%arrayidx.i.1 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom.i.1
%char0.i.1 = load i8, ptr %arrayidx.i.1, align 2
%cmp5.i.1 = icmp eq i8 %char0.i.1, 0
br i1 %cmp5.i.1, label %if.then.i, label %for.cond.i.1
for.cond.i.1: ; preds = %for.body.i.1
%inc.i.1 = add nuw nsw i32 %i.020.i, 2
br label %for.body.i
for.body.i: ; preds = %for.cond.i.1, %getKey.exit.i
%i.020.i = phi i32 [ 0, %getKey.exit.i ], [ %inc.i.1, %for.cond.i.1 ]
%mul.i = mul nsw i32 %i.020.i, %add.i19.i
%add.i = add nsw i32 %mul.i, %rem.i.i
%rem.i = srem i32 %add.i, 1000003
%idxprom.i = sext i32 %rem.i to i64
%arrayidx.i = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom.i
%char0.i = load i8, ptr %arrayidx.i, align 2
%cmp5.i = icmp eq i8 %char0.i, 0
br i1 %cmp5.i, label %if.then.i, label %for.cond.i
if.then.i: ; preds = %for.body.i.1, %for.body.i
%arrayidx.i.lcssa = phi ptr [ %arrayidx.i, %for.body.i ], [ %arrayidx.i.1, %for.body.i.1 ]
%call10.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.i.lcssa, ptr noundef nonnull dereferenceable(1) %str) #11
br label %for.inc18
if.else: ; preds = %for.body4
br i1 %cmp8.not.i.i, label %getKey.exit.i41, label %for.body.i.i28.preheader
for.body.i.i28.preheader: ; preds = %if.else
%xtraiter = and i64 %call.i.i, 1
%6 = icmp eq i64 %call.i.i, 1
br i1 %6, label %getKey.exit.i41.loopexit.unr-lcssa, label %for.body.i.i28.preheader.new
for.body.i.i28.preheader.new: ; preds = %for.body.i.i28.preheader
%unroll_iter = and i64 %call.i.i, -2
br label %for.body.i.i28
for.body.i.i28: ; preds = %getChar.exit.i.i34.1, %for.body.i.i28.preheader.new
%i.011.i.i29 = phi i64 [ 0, %for.body.i.i28.preheader.new ], [ %inc.i.i39.1, %getChar.exit.i.i34.1 ]
%p.010.i.i30 = phi i32 [ 1, %for.body.i.i28.preheader.new ], [ %mul2.i.i38.1, %getChar.exit.i.i34.1 ]
%sum.09.i.i31 = phi i32 [ 0, %for.body.i.i28.preheader.new ], [ %add.i.i37.1, %getChar.exit.i.i34.1 ]
%niter = phi i64 [ 0, %for.body.i.i28.preheader.new ], [ %niter.next.1, %getChar.exit.i.i34.1 ]
%arrayidx.i.i32 = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i29
%7 = load i8, ptr %arrayidx.i.i32, align 1, !tbaa !5
switch i8 %7, label %getChar.exit.i.i34 [
i8 84, label %if.then15.i.i.i56
i8 67, label %if.then5.i.i.i55
i8 71, label %if.then10.i.i.i33
]
if.then5.i.i.i55: ; preds = %for.body.i.i28
br label %getChar.exit.i.i34
if.then10.i.i.i33: ; preds = %for.body.i.i28
br label %getChar.exit.i.i34
if.then15.i.i.i56: ; preds = %for.body.i.i28
br label %getChar.exit.i.i34
getChar.exit.i.i34: ; preds = %if.then15.i.i.i56, %if.then10.i.i.i33, %if.then5.i.i.i55, %for.body.i.i28
%retval.0.i.i.i35 = phi i32 [ 2, %if.then5.i.i.i55 ], [ 3, %if.then10.i.i.i33 ], [ 4, %if.then15.i.i.i56 ], [ 1, %for.body.i.i28 ]
%mul.i.i36 = mul i32 %retval.0.i.i.i35, %p.010.i.i30
%add.i.i37 = add i32 %mul.i.i36, %sum.09.i.i31
%mul2.i.i38 = mul i32 %p.010.i.i30, 5
%inc.i.i39 = or i64 %i.011.i.i29, 1
%arrayidx.i.i32.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i39
%8 = load i8, ptr %arrayidx.i.i32.1, align 1, !tbaa !5
switch i8 %8, label %getChar.exit.i.i34.1 [
i8 84, label %if.then15.i.i.i56.1
i8 67, label %if.then5.i.i.i55.1
i8 71, label %if.then10.i.i.i33.1
]
if.then10.i.i.i33.1: ; preds = %getChar.exit.i.i34
br label %getChar.exit.i.i34.1
if.then5.i.i.i55.1: ; preds = %getChar.exit.i.i34
br label %getChar.exit.i.i34.1
if.then15.i.i.i56.1: ; preds = %getChar.exit.i.i34
br label %getChar.exit.i.i34.1
getChar.exit.i.i34.1: ; preds = %if.then15.i.i.i56.1, %if.then5.i.i.i55.1, %if.then10.i.i.i33.1, %getChar.exit.i.i34
%retval.0.i.i.i35.1 = phi i32 [ 2, %if.then5.i.i.i55.1 ], [ 3, %if.then10.i.i.i33.1 ], [ 4, %if.then15.i.i.i56.1 ], [ 1, %getChar.exit.i.i34 ]
%mul.i.i36.1 = mul i32 %retval.0.i.i.i35.1, %mul2.i.i38
%add.i.i37.1 = add i32 %mul.i.i36.1, %add.i.i37
%mul2.i.i38.1 = mul i32 %p.010.i.i30, 25
%inc.i.i39.1 = add nuw nsw i64 %i.011.i.i29, 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 %getKey.exit.i41.loopexit.unr-lcssa, label %for.body.i.i28, !llvm.loop !8
getKey.exit.i41.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i34.1, %for.body.i.i28.preheader
%add.i.i37.lcssa.ph = phi i32 [ undef, %for.body.i.i28.preheader ], [ %add.i.i37.1, %getChar.exit.i.i34.1 ]
%i.011.i.i29.unr = phi i64 [ 0, %for.body.i.i28.preheader ], [ %inc.i.i39.1, %getChar.exit.i.i34.1 ]
%p.010.i.i30.unr = phi i32 [ 1, %for.body.i.i28.preheader ], [ %mul2.i.i38.1, %getChar.exit.i.i34.1 ]
%sum.09.i.i31.unr = phi i32 [ 0, %for.body.i.i28.preheader ], [ %add.i.i37.1, %getChar.exit.i.i34.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit.i41, label %for.body.i.i28.epil
for.body.i.i28.epil: ; preds = %getKey.exit.i41.loopexit.unr-lcssa
%arrayidx.i.i32.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i29.unr
%9 = load i8, ptr %arrayidx.i.i32.epil, align 1, !tbaa !5
switch i8 %9, label %getChar.exit.i.i34.epil [
i8 84, label %if.then15.i.i.i56.epil
i8 67, label %if.then5.i.i.i55.epil
i8 71, label %if.then10.i.i.i33.epil
]
if.then10.i.i.i33.epil: ; preds = %for.body.i.i28.epil
br label %getChar.exit.i.i34.epil
if.then5.i.i.i55.epil: ; preds = %for.body.i.i28.epil
br label %getChar.exit.i.i34.epil
if.then15.i.i.i56.epil: ; preds = %for.body.i.i28.epil
br label %getChar.exit.i.i34.epil
getChar.exit.i.i34.epil: ; preds = %if.then15.i.i.i56.epil, %if.then5.i.i.i55.epil, %if.then10.i.i.i33.epil, %for.body.i.i28.epil
%retval.0.i.i.i35.epil = phi i32 [ 2, %if.then5.i.i.i55.epil ], [ 3, %if.then10.i.i.i33.epil ], [ 4, %if.then15.i.i.i56.epil ], [ 1, %for.body.i.i28.epil ]
%mul.i.i36.epil = mul i32 %retval.0.i.i.i35.epil, %p.010.i.i30.unr
%add.i.i37.epil = add i32 %mul.i.i36.epil, %sum.09.i.i31.unr
br label %getKey.exit.i41
getKey.exit.i41: ; preds = %getChar.exit.i.i34.epil, %getKey.exit.i41.loopexit.unr-lcssa, %if.else
%sum.0.lcssa.i.i42 = phi i32 [ 0, %if.else ], [ %add.i.i37.lcssa.ph, %getKey.exit.i41.loopexit.unr-lcssa ], [ %add.i.i37.epil, %getChar.exit.i.i34.epil ]
%rem.i.i43 = srem i32 %sum.0.lcssa.i.i42, 1000003
%rem.i22.i = srem i32 %sum.0.lcssa.i.i42, 1000002
%add.i23.i = add nsw i32 %rem.i22.i, 1
br label %for.body.i44
for.body.i44: ; preds = %if.else.i, %getKey.exit.i41
%i.024.i = phi i32 [ 0, %getKey.exit.i41 ], [ %inc.i53, %if.else.i ]
%mul.i45 = mul nsw i32 %i.024.i, %add.i23.i
%add.i46 = add nsw i32 %mul.i45, %rem.i.i43
%rem.i47 = srem i32 %add.i46, 1000003
%idxprom.i48 = sext i32 %rem.i47 to i64
%arrayidx.i49 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom.i48
%call4.i = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i49, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp5.i50 = icmp eq i32 %call4.i, 0
br i1 %cmp5.i50, label %if.then13, label %if.else.i
if.else.i: ; preds = %for.body.i44
%char0.i51 = load i8, ptr %arrayidx.i49, align 2
%cmp11.i = icmp eq i8 %char0.i51, 0
%inc.i53 = add nuw nsw i32 %i.024.i, 1
%exitcond.not.i54 = icmp eq i32 %inc.i53, 1000003
%or.cond = select i1 %cmp11.i, i1 true, i1 %exitcond.not.i54
br i1 %or.cond, label %if.else15, label %for.body.i44, !llvm.loop !10
if.then13: ; preds = %for.body.i44
%puts25 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc18
if.else15: ; preds = %if.else.i
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc18
for.inc18: ; preds = %for.cond.i, %if.then.i, %if.else15, %if.then13
%inc19 = add nuw nsw i32 %i.168, 1
%10 = load i32, ptr %n, align 4, !tbaa !13
%cmp3 = icmp slt i32 %inc19, %10
br i1 %cmp3, label %for.body4, label %for.end20, !llvm.loop !15
for.end20: ; preds = %for.inc18, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = distinct !{!15, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1000003 /* your task 1000003 or 999983 */
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key%M; }
int h2(int key){ return 1+key%(M-1); }
int find(char str[]){
int i=0,j=0;
int he1,he2,key=0;
key=getKey(str);
he1=h1(key);
he2=h2(key);
for(i=he1;j<M;i+=he2)
{
if(i>=M) i=i%M;
if(strcmp(H[i],"")==0) return 0;
else if(strcmp(H[i],str)== 0)return 1;
j++;
}
return 0;
}
int insert(char str[]){
int i=0,j=0,he1=0,he2=0;
he1=h1(getKey(str));
he2=h2(getKey(str));
for(i=he1;j<M;i+=he2)
{
if(i>=M) i=i%M;
if(strcmp(H[i],"")==0)
{
strcpy(H[i],str);
return 1;
}
j++;
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246423/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246423/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000003 x [14 x i8]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000003
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000002
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000003
%rem.i30 = srem i32 %sum.0.lcssa.i, 1000002
%add.i31 = add nsw i32 %rem.i30, 1
br label %for.body
for.body: ; preds = %getKey.exit, %if.end18
%i.033 = phi i32 [ %rem.i, %getKey.exit ], [ %add, %if.end18 ]
%j.032 = phi i32 [ 0, %getKey.exit ], [ %inc, %if.end18 ]
%cmp4 = icmp sgt i32 %i.033, 1000002
%rem = urem i32 %i.033, 1000003
%i.1 = select i1 %cmp4, i32 %rem, i32 %i.033
%idxprom = sext i32 %i.1 to i64
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom
%strcmpload = load i8, ptr %arrayidx, align 2
%cmp7 = icmp eq i8 %strcmpload, 0
br i1 %cmp7, label %cleanup, label %if.else
if.else: ; preds = %for.body
%call13 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp14 = icmp eq i32 %call13, 0
br i1 %cmp14, label %cleanup, label %if.end18
if.end18: ; preds = %if.else
%inc = add nuw nsw i32 %j.032, 1
%add = add nsw i32 %add.i31, %i.1
%exitcond.not = icmp eq i32 %inc, 1000003
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !10
cleanup: ; preds = %if.end18, %if.else, %for.body
%retval.0 = phi i32 [ 0, %for.body ], [ 1, %if.else ], [ 0, %if.end18 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit45, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%0 = add i64 %call.i, -1
%xtraiter = and i64 %call.i, 1
%1 = icmp eq i64 %0, 0
br i1 %1, label %for.body.i29.preheader.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%3 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.body.i29.preheader.unr-lcssa, label %for.body.i, !llvm.loop !8
for.body.i29.preheader.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i29.preheader, label %for.body.i.epil
for.body.i.epil: ; preds = %for.body.i29.preheader.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%4 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %4, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %for.body.i29.preheader
for.body.i29.preheader: ; preds = %for.body.i29.preheader.unr-lcssa, %getChar.exit.i.epil
%add.i.lcssa = phi i32 [ %add.i.lcssa.ph, %for.body.i29.preheader.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%xtraiter59 = and i64 %call.i, 1
%5 = icmp eq i64 %0, 0
br i1 %5, label %getKey.exit45.loopexit.unr-lcssa, label %for.body.i29.preheader.new
for.body.i29.preheader.new: ; preds = %for.body.i29.preheader
%unroll_iter62 = and i64 %call.i, -2
br label %for.body.i29
for.body.i29: ; preds = %getChar.exit.i35.1, %for.body.i29.preheader.new
%i.011.i30 = phi i64 [ 0, %for.body.i29.preheader.new ], [ %inc.i40.1, %getChar.exit.i35.1 ]
%p.010.i31 = phi i32 [ 1, %for.body.i29.preheader.new ], [ %mul2.i39.1, %getChar.exit.i35.1 ]
%sum.09.i32 = phi i32 [ 0, %for.body.i29.preheader.new ], [ %add.i38.1, %getChar.exit.i35.1 ]
%niter63 = phi i64 [ 0, %for.body.i29.preheader.new ], [ %niter63.next.1, %getChar.exit.i35.1 ]
%arrayidx.i33 = getelementptr inbounds i8, ptr %str, i64 %i.011.i30
%6 = load i8, ptr %arrayidx.i33, align 1, !tbaa !5
switch i8 %6, label %getChar.exit.i35 [
i8 84, label %if.then15.i.i44
i8 67, label %if.then5.i.i43
i8 71, label %if.then10.i.i34
]
if.then5.i.i43: ; preds = %for.body.i29
br label %getChar.exit.i35
if.then10.i.i34: ; preds = %for.body.i29
br label %getChar.exit.i35
if.then15.i.i44: ; preds = %for.body.i29
br label %getChar.exit.i35
getChar.exit.i35: ; preds = %if.then15.i.i44, %if.then10.i.i34, %if.then5.i.i43, %for.body.i29
%retval.0.i.i36 = phi i32 [ 2, %if.then5.i.i43 ], [ 3, %if.then10.i.i34 ], [ 4, %if.then15.i.i44 ], [ 1, %for.body.i29 ]
%mul.i37 = mul i32 %retval.0.i.i36, %p.010.i31
%add.i38 = add i32 %mul.i37, %sum.09.i32
%mul2.i39 = mul i32 %p.010.i31, 5
%inc.i40 = or i64 %i.011.i30, 1
%arrayidx.i33.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i40
%7 = load i8, ptr %arrayidx.i33.1, align 1, !tbaa !5
switch i8 %7, label %getChar.exit.i35.1 [
i8 84, label %if.then15.i.i44.1
i8 67, label %if.then5.i.i43.1
i8 71, label %if.then10.i.i34.1
]
if.then10.i.i34.1: ; preds = %getChar.exit.i35
br label %getChar.exit.i35.1
if.then5.i.i43.1: ; preds = %getChar.exit.i35
br label %getChar.exit.i35.1
if.then15.i.i44.1: ; preds = %getChar.exit.i35
br label %getChar.exit.i35.1
getChar.exit.i35.1: ; preds = %if.then15.i.i44.1, %if.then5.i.i43.1, %if.then10.i.i34.1, %getChar.exit.i35
%retval.0.i.i36.1 = phi i32 [ 2, %if.then5.i.i43.1 ], [ 3, %if.then10.i.i34.1 ], [ 4, %if.then15.i.i44.1 ], [ 1, %getChar.exit.i35 ]
%mul.i37.1 = mul i32 %retval.0.i.i36.1, %mul2.i39
%add.i38.1 = add i32 %mul.i37.1, %add.i38
%mul2.i39.1 = mul i32 %p.010.i31, 25
%inc.i40.1 = add nuw nsw i64 %i.011.i30, 2
%niter63.next.1 = add i64 %niter63, 2
%niter63.ncmp.1 = icmp eq i64 %niter63.next.1, %unroll_iter62
br i1 %niter63.ncmp.1, label %getKey.exit45.loopexit.unr-lcssa, label %for.body.i29, !llvm.loop !8
getKey.exit45.loopexit.unr-lcssa: ; preds = %getChar.exit.i35.1, %for.body.i29.preheader
%add.i38.lcssa.ph = phi i32 [ undef, %for.body.i29.preheader ], [ %add.i38.1, %getChar.exit.i35.1 ]
%i.011.i30.unr = phi i64 [ 0, %for.body.i29.preheader ], [ %inc.i40.1, %getChar.exit.i35.1 ]
%p.010.i31.unr = phi i32 [ 1, %for.body.i29.preheader ], [ %mul2.i39.1, %getChar.exit.i35.1 ]
%sum.09.i32.unr = phi i32 [ 0, %for.body.i29.preheader ], [ %add.i38.1, %getChar.exit.i35.1 ]
%lcmp.mod60.not = icmp eq i64 %xtraiter59, 0
br i1 %lcmp.mod60.not, label %getKey.exit45.loopexit, label %for.body.i29.epil
for.body.i29.epil: ; preds = %getKey.exit45.loopexit.unr-lcssa
%arrayidx.i33.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i30.unr
%8 = load i8, ptr %arrayidx.i33.epil, align 1, !tbaa !5
switch i8 %8, label %getChar.exit.i35.epil [
i8 84, label %if.then15.i.i44.epil
i8 67, label %if.then5.i.i43.epil
i8 71, label %if.then10.i.i34.epil
]
if.then10.i.i34.epil: ; preds = %for.body.i29.epil
br label %getChar.exit.i35.epil
if.then5.i.i43.epil: ; preds = %for.body.i29.epil
br label %getChar.exit.i35.epil
if.then15.i.i44.epil: ; preds = %for.body.i29.epil
br label %getChar.exit.i35.epil
getChar.exit.i35.epil: ; preds = %if.then15.i.i44.epil, %if.then5.i.i43.epil, %if.then10.i.i34.epil, %for.body.i29.epil
%retval.0.i.i36.epil = phi i32 [ 2, %if.then5.i.i43.epil ], [ 3, %if.then10.i.i34.epil ], [ 4, %if.then15.i.i44.epil ], [ 1, %for.body.i29.epil ]
%mul.i37.epil = mul i32 %retval.0.i.i36.epil, %p.010.i31.unr
%add.i38.epil = add i32 %mul.i37.epil, %sum.09.i32.unr
br label %getKey.exit45.loopexit
getKey.exit45.loopexit: ; preds = %getKey.exit45.loopexit.unr-lcssa, %getChar.exit.i35.epil
%add.i38.lcssa = phi i32 [ %add.i38.lcssa.ph, %getKey.exit45.loopexit.unr-lcssa ], [ %add.i38.epil, %getChar.exit.i35.epil ]
%rem.i = srem i32 %add.i.lcssa, 1000003
%9 = srem i32 %add.i38.lcssa, 1000002
%10 = add nsw i32 %9, 1
br label %getKey.exit45
getKey.exit45: ; preds = %getKey.exit45.loopexit, %entry
%rem.i51 = phi i32 [ 0, %entry ], [ %rem.i, %getKey.exit45.loopexit ]
%sum.0.lcssa.i42 = phi i32 [ 1, %entry ], [ %10, %getKey.exit45.loopexit ]
br label %for.body
for.body: ; preds = %if.end16.1, %getKey.exit45
%j.053 = phi i32 [ 0, %getKey.exit45 ], [ %inc.1, %if.end16.1 ]
%i.052 = phi i32 [ %rem.i51, %getKey.exit45 ], [ %add.1, %if.end16.1 ]
%cmp6 = icmp sgt i32 %i.052, 1000002
%rem = urem i32 %i.052, 1000003
%i.1 = select i1 %cmp6, i32 %rem, i32 %i.052
%idxprom = sext i32 %i.1 to i64
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom
%strcmpload = load i8, ptr %arrayidx, align 2
%cmp9 = icmp eq i8 %strcmpload, 0
br i1 %cmp9, label %if.then11, label %if.end16
if.then11: ; preds = %for.body.1, %for.body
%arrayidx.lcssa = phi ptr [ %arrayidx, %for.body ], [ %arrayidx.1, %for.body.1 ]
%call15 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx.lcssa, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
if.end16: ; preds = %for.body
%exitcond.not = icmp eq i32 %j.053, 1000002
br i1 %exitcond.not, label %cleanup, label %for.body.1, !llvm.loop !11
for.body.1: ; preds = %if.end16
%add = add nsw i32 %sum.0.lcssa.i42, %i.1
%cmp6.1 = icmp sgt i32 %add, 1000002
%rem.1 = urem i32 %add, 1000003
%i.1.1 = select i1 %cmp6.1, i32 %rem.1, i32 %add
%idxprom.1 = sext i32 %i.1.1 to i64
%arrayidx.1 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom.1
%strcmpload.1 = load i8, ptr %arrayidx.1, align 2
%cmp9.1 = icmp eq i8 %strcmpload.1, 0
br i1 %cmp9.1, label %if.then11, label %if.end16.1
if.end16.1: ; preds = %for.body.1
%inc.1 = add nuw nsw i32 %j.053, 2
%add.1 = add nsw i32 %sum.0.lcssa.i42, %i.1.1
br label %for.body
cleanup: ; preds = %if.end16, %if.then11
%retval.0 = phi i32 [ 1, %if.then11 ], [ 0, %if.end16 ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1000003
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !12
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%cmp330 = icmp sgt i32 %0, 0
br i1 %cmp330, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.131 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !15
br label %for.inc19
if.else: ; preds = %for.body4
%call.i.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i.i = icmp eq i64 %call.i.i, 0
br i1 %cmp8.not.i.i, label %getKey.exit.i, label %for.body.i.i.preheader
for.body.i.i.preheader: ; preds = %if.else
%xtraiter = and i64 %call.i.i, 1
%2 = icmp eq i64 %call.i.i, 1
br i1 %2, label %getKey.exit.i.loopexit.unr-lcssa, label %for.body.i.i.preheader.new
for.body.i.i.preheader.new: ; preds = %for.body.i.i.preheader
%unroll_iter = and i64 %call.i.i, -2
br label %for.body.i.i
for.body.i.i: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader.new
%i.011.i.i = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i = phi i32 [ 1, %for.body.i.i.preheader.new ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i = phi i32 [ 0, %for.body.i.i.preheader.new ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%niter = phi i64 [ 0, %for.body.i.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.i.1 ]
%arrayidx.i.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i
%3 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.i [
i8 84, label %if.then15.i.i.i
i8 67, label %if.then5.i.i.i
i8 71, label %if.then10.i.i.i
]
if.then5.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then10.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
if.then15.i.i.i: ; preds = %for.body.i.i
br label %getChar.exit.i.i
getChar.exit.i.i: ; preds = %if.then15.i.i.i, %if.then10.i.i.i, %if.then5.i.i.i, %for.body.i.i
%retval.0.i.i.i = phi i32 [ 2, %if.then5.i.i.i ], [ 3, %if.then10.i.i.i ], [ 4, %if.then15.i.i.i ], [ 1, %for.body.i.i ]
%mul.i.i = mul i32 %retval.0.i.i.i, %p.010.i.i
%add.i.i = add i32 %mul.i.i, %sum.09.i.i
%mul2.i.i = mul i32 %p.010.i.i, 5
%inc.i.i = or i64 %i.011.i.i, 1
%arrayidx.i.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i.i
%4 = load i8, ptr %arrayidx.i.i.1, align 1, !tbaa !5
switch i8 %4, label %getChar.exit.i.i.1 [
i8 84, label %if.then15.i.i.i.1
i8 67, label %if.then5.i.i.i.1
i8 71, label %if.then10.i.i.i.1
]
if.then10.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then5.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
if.then15.i.i.i.1: ; preds = %getChar.exit.i.i
br label %getChar.exit.i.i.1
getChar.exit.i.i.1: ; preds = %if.then15.i.i.i.1, %if.then5.i.i.i.1, %if.then10.i.i.i.1, %getChar.exit.i.i
%retval.0.i.i.i.1 = phi i32 [ 2, %if.then5.i.i.i.1 ], [ 3, %if.then10.i.i.i.1 ], [ 4, %if.then15.i.i.i.1 ], [ 1, %getChar.exit.i.i ]
%mul.i.i.1 = mul i32 %retval.0.i.i.i.1, %mul2.i.i
%add.i.i.1 = add i32 %mul.i.i.1, %add.i.i
%mul2.i.i.1 = mul i32 %p.010.i.i, 25
%inc.i.i.1 = add nuw nsw i64 %i.011.i.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.i.loopexit.unr-lcssa, label %for.body.i.i, !llvm.loop !8
getKey.exit.i.loopexit.unr-lcssa: ; preds = %getChar.exit.i.i.1, %for.body.i.i.preheader
%add.i.i.lcssa.ph = phi i32 [ undef, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%i.011.i.i.unr = phi i64 [ 0, %for.body.i.i.preheader ], [ %inc.i.i.1, %getChar.exit.i.i.1 ]
%p.010.i.i.unr = phi i32 [ 1, %for.body.i.i.preheader ], [ %mul2.i.i.1, %getChar.exit.i.i.1 ]
%sum.09.i.i.unr = phi i32 [ 0, %for.body.i.i.preheader ], [ %add.i.i.1, %getChar.exit.i.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit.i, label %for.body.i.i.epil
for.body.i.i.epil: ; preds = %getKey.exit.i.loopexit.unr-lcssa
%arrayidx.i.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.i.unr
%5 = load i8, ptr %arrayidx.i.i.epil, align 1, !tbaa !5
switch i8 %5, label %getChar.exit.i.i.epil [
i8 84, label %if.then15.i.i.i.epil
i8 67, label %if.then5.i.i.i.epil
i8 71, label %if.then10.i.i.i.epil
]
if.then10.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then5.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
if.then15.i.i.i.epil: ; preds = %for.body.i.i.epil
br label %getChar.exit.i.i.epil
getChar.exit.i.i.epil: ; preds = %if.then15.i.i.i.epil, %if.then5.i.i.i.epil, %if.then10.i.i.i.epil, %for.body.i.i.epil
%retval.0.i.i.i.epil = phi i32 [ 2, %if.then5.i.i.i.epil ], [ 3, %if.then10.i.i.i.epil ], [ 4, %if.then15.i.i.i.epil ], [ 1, %for.body.i.i.epil ]
%mul.i.i.epil = mul i32 %retval.0.i.i.i.epil, %p.010.i.i.unr
%add.i.i.epil = add i32 %mul.i.i.epil, %sum.09.i.i.unr
br label %getKey.exit.i
getKey.exit.i: ; preds = %getChar.exit.i.i.epil, %getKey.exit.i.loopexit.unr-lcssa, %if.else
%sum.0.lcssa.i.i = phi i32 [ 0, %if.else ], [ %add.i.i.lcssa.ph, %getKey.exit.i.loopexit.unr-lcssa ], [ %add.i.i.epil, %getChar.exit.i.i.epil ]
%rem.i.i = srem i32 %sum.0.lcssa.i.i, 1000003
%rem.i30.i = srem i32 %sum.0.lcssa.i.i, 1000002
%add.i31.i = add nsw i32 %rem.i30.i, 1
br label %for.body.i
for.body.i: ; preds = %if.end18.i, %getKey.exit.i
%i.033.i = phi i32 [ %rem.i.i, %getKey.exit.i ], [ %add.i, %if.end18.i ]
%j.032.i = phi i32 [ 0, %getKey.exit.i ], [ %inc.i, %if.end18.i ]
%cmp4.i = icmp sgt i32 %i.033.i, 1000002
%rem.i = urem i32 %i.033.i, 1000003
%i.1.i = select i1 %cmp4.i, i32 %rem.i, i32 %i.033.i
%idxprom.i = sext i32 %i.1.i to i64
%arrayidx.i = getelementptr inbounds [1000003 x [14 x i8]], ptr @H, i64 0, i64 %idxprom.i
%strcmpload.i = load i8, ptr %arrayidx.i, align 2
%cmp7.i = icmp eq i8 %strcmpload.i, 0
br i1 %cmp7.i, label %if.else16, label %if.else.i
if.else.i: ; preds = %for.body.i
%call13.i = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx.i, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp14.i = icmp eq i32 %call13.i, 0
br i1 %cmp14.i, label %if.then14, label %if.end18.i
if.end18.i: ; preds = %if.else.i
%inc.i = add nuw nsw i32 %j.032.i, 1
%add.i = add nsw i32 %add.i31.i, %i.1.i
%exitcond.not.i = icmp eq i32 %inc.i, 1000003
br i1 %exitcond.not.i, label %if.else16, label %for.body.i, !llvm.loop !10
if.then14: ; preds = %if.else.i
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %for.inc19
if.else16: ; preds = %for.body.i, %if.end18.i
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.131, 1
%6 = load i32, ptr %n, align 4, !tbaa !13
%cmp3 = icmp slt i32 %inc20, %6
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !16
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = !{i32 0, i32 2}
!16 = distinct !{!16, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch){
if(ch == 'A') return 1;
else if (ch == 'C') return 2;
else if (ch == 'G') return 3;
else if (ch == 'T') return 4;
else return 0;
}
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for(i = 0; i < strlen(str); i++){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }
int find(char str[]) {
long long key, i, h;
key = getKey(str);
for(i = 0; ; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h],str) == 0) return 1;
else if (strlen(H[h]) == 0) return 0;
}
return 0;
}
int insert(char str[]) {
long long key, i, h;
key = getKey(str);
for(i=0; ; i++) {
h = (h1(key) + i * h2(key)) %M;
if(strcmp(H[h],str) == 0) return 1;
else if(strlen(H[h]) == 0) {
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int main(void) {
int i, n;
char str[L], com[9];
for(i=0;i<M;i++) H[i][0] = '\0';
scanf("%d",&n);
for(i=0;i<n;i++) {
scanf("%s %s",com,str);
if(com[0] == 'i') {
insert(str);
} else {
if(find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246474/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246474/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <string.h>
#define M 1000005
#define L 14
char H[M][L];
int gtchar(char m){
if(m=='A')return 1;
else if(m=='C')return 2;
else if(m== 'G')return 3;
else if(m== 'T')return 4;
else return 0;
}
int h1(int key){
return key % M;
}
int h2(int key){
return (key % (M-1)) + 1;
}
long long gtkey(char m[]){
long long total = 0, p=1,i;
for(i=0;i<strlen(m);i++){
total += p * gtchar(m[i]);
p *=5;
}
return total;
}
int insert(char m[]){
long long key,i,h;
key = gtkey(m);
for(i=0;;i++){
h=(h1(key) + i * h2(key))%M;
if( strcmp(H[h],m) == 0)return 1;
else if( strlen(H[h]) == 0) {
strcpy(H[h],m);
return 0;
}
}
return 0;
}
int find(char m[]){
long long key,i,h;
int ct=0,j;
key=gtkey(m);
for(i=0;;i++){
h=(h1(key) + i * h2(key)) %M;
if(strcmp(H[h],m)==0)return 1;
else if(strlen(H[h])==0)return 0;
}
return 0;
}
int main(void){
int i,n,ct=0;
char com[9],m[L],ans[M][4];
for(i=0;i<M;i++)H[i][0] = '\0';
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%s",com,m);
if(com[0]=='i'){
insert(m);
}
else if(find(m)==1){
strcpy(ans[ct],"yes");
ct++;
continue;
}
else {
strcpy(ans[ct],"no");
ct++;
continue;
}
}
for(i=0;i<ct;i++){
printf("%s\n",ans[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246517/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246517/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000005 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"no\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @gtchar(i8 noundef signext %m) local_unnamed_addr #0 {
entry:
switch i8 %m, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000005
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000004
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @gtkey(ptr nocapture noundef readonly %m) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %m) #11
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %gtchar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %gtchar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %gtchar.exit.1 ]
%total.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %gtchar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %gtchar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %m, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %gtchar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %gtchar.exit
if.then10.i: ; preds = %for.body
br label %gtchar.exit
if.then15.i: ; preds = %for.body
br label %gtchar.exit
if.else16.i: ; preds = %for.body
br label %gtchar.exit
gtchar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %total.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %m, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %gtchar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %gtchar.exit
br label %gtchar.exit.1
if.then10.i.1: ; preds = %gtchar.exit
br label %gtchar.exit.1
if.then5.i.1: ; preds = %gtchar.exit
br label %gtchar.exit.1
if.else16.i.1: ; preds = %gtchar.exit
br label %gtchar.exit.1
gtchar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %gtchar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %gtchar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %gtchar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %gtchar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %gtchar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %gtchar.exit.1 ]
%total.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %gtchar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %m, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %gtchar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %gtchar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %gtchar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %gtchar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %gtchar.exit.epil
gtchar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %total.09.unr
br label %for.end
for.end: ; preds = %gtchar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%total.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %gtchar.exit.epil ]
ret i64 %total.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %m) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %m) #11
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %gtkey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %gtkey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %gtchar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %gtchar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %gtchar.exit.i.1 ]
%total.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %gtchar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %gtchar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %m, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %gtchar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %gtchar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %gtchar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %gtchar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %gtchar.exit.i
gtchar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %total.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %m, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %gtchar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %gtchar.exit.i
br label %gtchar.exit.i.1
if.then10.i.i.1: ; preds = %gtchar.exit.i
br label %gtchar.exit.i.1
if.then5.i.i.1: ; preds = %gtchar.exit.i
br label %gtchar.exit.i.1
if.else16.i.i.1: ; preds = %gtchar.exit.i
br label %gtchar.exit.i.1
gtchar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %gtchar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %gtchar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %gtkey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
gtkey.exit.loopexit.unr-lcssa: ; preds = %gtchar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %gtchar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %gtchar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %gtchar.exit.i.1 ]
%total.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %gtchar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %gtkey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %gtkey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %m, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %gtchar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %gtchar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %gtchar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %gtchar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %gtchar.exit.i.epil
gtchar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %total.09.i.unr
br label %gtkey.exit
gtkey.exit: ; preds = %gtchar.exit.i.epil, %gtkey.exit.loopexit.unr-lcssa, %entry
%total.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %gtkey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %gtchar.exit.i.epil ]
%rem.i = srem i32 %total.0.lcssa.i, 1000005
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %total.0.lcssa.i, 1000004
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %m) #11
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000005
%arrayidx = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %m) #11
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %gtkey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %gtkey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %gtkey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %m) #12
br label %cleanup
cleanup: ; preds = %for.cond, %gtkey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %gtkey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; 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 #5
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %m) local_unnamed_addr #6 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %m) #11
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %gtkey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %gtkey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %gtchar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %gtchar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %gtchar.exit.i.1 ]
%total.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %gtchar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %gtchar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %m, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %gtchar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %gtchar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %gtchar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %gtchar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %gtchar.exit.i
gtchar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %total.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %m, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %gtchar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %gtchar.exit.i
br label %gtchar.exit.i.1
if.then10.i.i.1: ; preds = %gtchar.exit.i
br label %gtchar.exit.i.1
if.then5.i.i.1: ; preds = %gtchar.exit.i
br label %gtchar.exit.i.1
if.else16.i.i.1: ; preds = %gtchar.exit.i
br label %gtchar.exit.i.1
gtchar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %gtchar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %gtchar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %gtkey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
gtkey.exit.loopexit.unr-lcssa: ; preds = %gtchar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %gtchar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %gtchar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %gtchar.exit.i.1 ]
%total.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %gtchar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %gtkey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %gtkey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %m, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %gtchar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %gtchar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %gtchar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %gtchar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %gtchar.exit.i.epil
gtchar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %total.09.i.unr
br label %gtkey.exit
gtkey.exit: ; preds = %gtchar.exit.i.epil, %gtkey.exit.loopexit.unr-lcssa, %entry
%total.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %gtkey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %gtchar.exit.i.epil ]
%rem.i = srem i32 %total.0.lcssa.i, 1000005
%conv2 = sext i32 %rem.i to i64
%rem.i23 = srem i32 %total.0.lcssa.i, 1000004
%add.i24 = add nsw i32 %rem.i23, 1
%conv5 = sext i32 %add.i24 to i64
%arrayidx25 = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call626 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx25, ptr noundef nonnull dereferenceable(1) %m) #11
%cmp27 = icmp eq i32 %call626, 0
br i1 %cmp27, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.028, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000005
%arrayidx = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %m) #11
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %gtkey.exit, %for.cond
%arrayidx29 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx25, %gtkey.exit ]
%i.028 = phi i64 [ %inc, %for.cond ], [ 0, %gtkey.exit ]
%char0 = load i8, ptr %arrayidx29, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %gtkey.exit
%retval.0 = phi i32 [ 1, %gtkey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%com = alloca [9 x i8], align 1
%m = alloca [14 x i8], align 1
%ans = alloca [1000005 x [4 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #12
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #12
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %m) #12
call void @llvm.lifetime.start.p0(i64 4000020, ptr nonnull %ans) #12
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000005 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000005
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp354 = icmp sgt i32 %0, 0
br i1 %cmp354, label %for.body4, label %for.end41
for.cond31.preheader: ; preds = %for.inc28
%cmp3257 = icmp sgt i32 %ct.1, 0
br i1 %cmp3257, label %for.body34.preheader, label %for.end41
for.body34.preheader: ; preds = %for.cond31.preheader
%wide.trip.count = zext i32 %ct.1 to i64
br label %for.body34
for.body4: ; preds = %for.end, %for.inc28
%ct.056 = phi i32 [ %ct.1, %for.inc28 ], [ 0, %for.end ]
%i.155 = phi i32 [ %inc29, %for.inc28 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %m)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %m), !range !13
br label %for.inc28
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %m), !range !13
%cmp14.not = icmp eq i32 %call13, 0
%idxprom23 = sext i32 %ct.056 to i64
%arrayidx24 = getelementptr inbounds [1000005 x [4 x i8]], ptr %ans, i64 0, i64 %idxprom23
%inc27 = add nsw i32 %ct.056, 1
br i1 %cmp14.not, label %if.else22, label %if.then16
if.then16: ; preds = %if.else
store i32 7562617, ptr %arrayidx24, align 4
br label %for.inc28
if.else22: ; preds = %if.else
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(3) %arrayidx24, ptr noundef nonnull align 1 dereferenceable(3) @.str.3, i64 3, i1 false) #12
br label %for.inc28
for.inc28: ; preds = %if.then, %if.else22, %if.then16
%ct.1 = phi i32 [ %ct.056, %if.then ], [ %inc27, %if.then16 ], [ %inc27, %if.else22 ]
%inc29 = add nuw nsw i32 %i.155, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc29, %2
br i1 %cmp3, label %for.body4, label %for.cond31.preheader, !llvm.loop !14
for.body34: ; preds = %for.body34.preheader, %for.body34
%indvars.iv60 = phi i64 [ 0, %for.body34.preheader ], [ %indvars.iv.next61, %for.body34 ]
%arrayidx36 = getelementptr inbounds [1000005 x [4 x i8]], ptr %ans, i64 0, i64 %indvars.iv60
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx36)
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%exitcond63.not = icmp eq i64 %indvars.iv.next61, %wide.trip.count
br i1 %exitcond63.not, label %for.end41, label %for.body34, !llvm.loop !15
for.end41: ; preds = %for.body34, %for.end, %for.cond31.preheader
call void @llvm.lifetime.end.p0(i64 4000020, ptr nonnull %ans) #12
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %m) #12
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #12
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #10
attributes #0 = { 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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nofree 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
!15 = distinct !{!15, !9}
|
#include<stdio.h>
#include<string.h>
#define Mtw 1046527
#define NIL (-1)
#define Ltw 14
char Htw[Mtw][Ltw];
int getChar(char ch){
if(ch=='A')return 1;
else if(ch=='C')return 2;
else if(ch=='G')return 3;
else if(ch=='T')return 4;
else return 0;
}
long long getKey(char str[]){
long long sum=0,p=1,i;
for(i=0;i<strlen(str);i++){
sum += p*(getChar(str[i]));
p*=5;
}
return sum;
}
int h1(int key){return key % Mtw; }
int h2(int key){return 1+(key%(Mtw-1));}
int find(char str[]){
long long key, i, h;
key=getKey(str);
for(i=0;;i++){
h=(h1(key)+i*h2(key))%Mtw;
if(strcmp(Htw[h],str)==0)return 1;
else if(strlen(Htw[h])==0)return 0;
}
return 0;
}
int insert(char str[]){
long long key,i,h;
key=getKey(str);
for(i=0;;i++){
h=(h1(key)+i*h2(key))%Mtw;
if(strcmp(Htw[h],str)==0)return 1;
else if(strlen(Htw[h])==0){
strcpy(Htw[h],str);
return 0;
}
}
return 0;
}
int main(){
int i,n,h;
char strtw[Ltw],comtw[9];
for(i=0;i<Mtw;i++)Htw[i][0]='\0';
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %s",comtw,strtw);
if(comtw[0]=='i'){
insert(strtw);
}else{
if(find(strtw)){
printf("yes\n");
}else{
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246560/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246560/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@Htw = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @Htw, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @Htw, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @Htw, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @Htw, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%strtw = alloca [14 x i8], align 1
%comtw = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %strtw) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %comtw) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @Htw, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @Htw, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @Htw, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @Htw, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %comtw, ptr noundef nonnull %strtw)
%1 = load i8, ptr %comtw, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %strtw), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %strtw), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %comtw) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %strtw) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1000000
#define L 14
char H[M][L];
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
else return 0;
}
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key%M; }
int h2(int key){ return 1+(key%(M-1)); }
int find(char str[]){
long long key, i,h;
key=getKey(str);
for(i=0;;i++){
h=(h1(key)+i*h2(key))%M;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0)return 0;
}
return 0;
}
int insert(char str[]){
long long key, i,h;
key=getKey(str);
for(i=0; ;i++){
h=(h1(key)+i*h2(key))%M;
if(strcmp(H[h],str)==0)return 1;
else if(strlen(H[h])==0){
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i=0; i<M; i++ )H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246603/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246603/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 999999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 999999
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 999999
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
else return 0;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }
int find(char str[]){
long long key, i, h;
key = getKey(str);
for (i = 0;; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h], str) == 0) return 1;
else if(strlen(H[h]) == 0) return 0;
}
return 0;
}
int insert(char str[]){
long long key, i, h;
key = getKey(str);
for(i = 0;; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h],str) == 0) return 1;
else if(strlen(H[h]) == 0){
strcpy(H[h], str);
return 0;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246647/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246647/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <string.h>
#define M 1000000
#define L 14
char H[M][L]; /*Hash Table*/
int getChar(char ch){
if(ch == 'A')return 1;
else if(ch == 'C')return 2;
else if(ch == 'G')return 3;
else if(ch == 'T')return 4;
}
/*convert a string into an integer value*/
long long getkey(char str[]){
long long sum=0, p=1, i;
for(i = 0; i < strlen(str); i++){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key) {return key % M;}
int h2(int key) {return 1 + (key % (M-1));}
int find(char str[]){
long long key, i, h;
key = getkey(str);
for(i = 0; ; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h], str) == 0)return 1;
else if(strlen(H[h]) == 0)return 0;
}
return 0;
}
int insert(char str[]){
long long key, i, h;
key = getkey(str);
for(i = 0; ; i++){
h = (h1(key) + i * h2(key)) % M;
if(strcmp(H[h], str) == 0)return 1;
if(strlen(H[h]) == 0){
strcpy(H[h], str);
return 0;
}
}
}
int main(void)
{
int i, n, h;
char str[L], com[9];
for(i = 0; i < M; i++)H[i][0] = '\0';
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%s %s", com, str);
if(com[0] == 'i'){
insert(str);
}
else {
if(find(str))printf("yes\n");
else printf("no\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246698/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246698/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1000000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getkey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1000000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 999999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getkey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getkey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getkey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getkey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getkey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getkey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getkey.exit
getkey.exit: ; preds = %getChar.exit.i.epil, %getkey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getkey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 999999
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getkey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getkey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getkey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getkey.exit
%retval.0 = phi i32 [ 1, %getkey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getkey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getkey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getkey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getkey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getkey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getkey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getkey.exit
getkey.exit: ; preds = %getChar.exit.i.epil, %getkey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getkey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1000000
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 999999
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.end
for.cond: ; preds = %if.end
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1000000
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %getkey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getkey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getkey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.end
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getkey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getkey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 2, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 2, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1000000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 2, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
br i1 %exitcond.not.4, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <string.h>
#define M 1046257
#define NIL (-1)
#define L 14
char H[M][L];
// 文字から数値に変換
int getChar(char ch) {
if ( ch == 'A' ) return 1;
else if ( ch == 'C' ) return 2;
else if ( ch == 'G' ) return 3;
else if ( ch == 'T' ) return 4;
return 0;
}
// 文字列から数値へ変換して key を生成する
long long getKey(char str[]) {
long long sum =0, p = 1, i;
for(i=0;i<strlen(str);i++) {
sum += p*(getChar(str[i]));
p*= 5;
}
return sum;
}
int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }
int find(char str[]) {
long long key, i, h;
key = getKey(str); // 文字列を数値に変換
for(i=0; ;i++) {
h = (h1(key) + i*h2(key)) %M;
if( strcmp(H[h],str) == 0) return 1;
else if ( strlen(H[h]) == 0 ) return 0;
}
return 0;
}
int insert(char str[]) {
long long key, i, h;
key = getKey(str); // 文字列を数値に変換
for(i=0; ; i++) {
h = (h1(key) + i * h2(key)) %M;
if(strcmp(H[h],str) == 0) return 1;
else if(strlen(H[h]) == 0) {
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int main(void) {
int i, n;
char str[L], com[9];
for(i=0;i<M;i++) H[i][0] = '\0';
scanf("%d",&n);
for(i=0;i<n;i++) {
scanf("%s %s",com,str); // より高速なscanfを使用
if(com[0] == 'i') {
insert(str);
} else {
if(find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246740/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246740/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046257 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.end18: ; preds = %entry
br label %return
return: ; preds = %entry, %if.end18, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.end18 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.end18.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.end18.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.end18.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.end18.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.end18.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.end18.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.end18.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.end18.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.end18.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.end18.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046257
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046256
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.end18.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046257
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046256
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046257
%arrayidx = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.end18.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046257
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046256
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046257
%arrayidx = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.1, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.1 ]
%arrayidx = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1046257
br i1 %exitcond.not, label %for.end, label %for.body.1, !llvm.loop !10
for.body.1: ; preds = %for.body
%arrayidx.1 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1046257 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <string.h>
#define M 3442871/* your task*/
#define L 14
char H[M][L]; /* Hash Table */
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
return 0;
}
/* convert a string into an integer value */
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key % M/* your task */; }
int h2(int key){ return 1 + (key % (M-1))/* your task */; }
int find(char str[]){
/* your task */
int i=0,flag=0;
long long k,h;
k = getKey(str);
while(1) {
h = (h1(k) + i * h2(k)) % M;
if(strcmp(H[h],str) == 0) {
flag = 1;
break;
}
else if(strlen(H[h]) == 0) {
break;
}
else {
i++;
continue;
}
}
return flag;
}
int insert(char str[]){
/* your task */
int i=0;
long long k,h;
k = getKey(str);
while(1) {
h = (h1(k) + i * h2(k)) % M;
if(strcmp(H[h],str) == 0) {
break;
}
else if(strlen(H[h]) == 0) {
strcpy(H[h],str);
break;
}
else {
i++;
continue;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246791/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246791/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [3442871 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.end18: ; preds = %entry
br label %return
return: ; preds = %entry, %if.end18, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.end18 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.end18.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.end18.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.end18.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.end18.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.end18.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.end18.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.end18.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.end18.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.end18.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.end18.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 3442871
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 3442870
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.end18.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 3442871
%rem.i18 = srem i32 %sum.0.lcssa.i, 3442870
%add.i19 = add nsw i32 %rem.i18, 1
%conv420 = sext i32 %rem.i to i64
%arrayidx21 = getelementptr inbounds [3442871 x [14 x i8]], ptr @H, i64 0, i64 %conv420
%call522 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx21, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp23 = icmp eq i32 %call522, 0
br i1 %cmp23, label %while.end, label %if.else
while.cond: ; preds = %if.else
%inc = add nuw nsw i32 %i.024, 1
%mul = mul nsw i32 %inc, %add.i19
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 3442871
%conv4 = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [3442871 x [14 x i8]], ptr @H, i64 0, i64 %conv4
%call5 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call5, 0
br i1 %cmp, label %while.end, label %if.else
if.else: ; preds = %getKey.exit, %while.cond
%arrayidx25 = phi ptr [ %arrayidx, %while.cond ], [ %arrayidx21, %getKey.exit ]
%i.024 = phi i32 [ %inc, %while.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx25, align 1
%cmp10 = icmp eq i8 %char0, 0
br i1 %cmp10, label %while.end, label %while.cond
while.end: ; preds = %if.else, %while.cond, %getKey.exit
%flag.0 = phi i32 [ 1, %getKey.exit ], [ 1, %while.cond ], [ 0, %if.else ]
ret i32 %flag.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.end18.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.end18.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.end18.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.end18.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end18.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.end18.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.end18.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.end18.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.end18.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.end18.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.end18.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.end18.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 3442871
%rem.i23 = srem i32 %sum.0.lcssa.i, 3442870
%add.i24 = add nsw i32 %rem.i23, 1
%conv426 = sext i32 %rem.i to i64
%arrayidx27 = getelementptr inbounds [3442871 x [14 x i8]], ptr @H, i64 0, i64 %conv426
%call528 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx27, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp29 = icmp eq i32 %call528, 0
br i1 %cmp29, label %while.end, label %if.else
while.cond: ; preds = %if.else
%inc = add nuw nsw i32 %i.030, 1
%mul = mul nsw i32 %inc, %add.i24
%add = add nsw i32 %mul, %rem.i
%rem = srem i32 %add, 3442871
%conv4 = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [3442871 x [14 x i8]], ptr @H, i64 0, i64 %conv4
%call5 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call5, 0
br i1 %cmp, label %while.end, label %if.else
if.else: ; preds = %getKey.exit, %while.cond
%arrayidx31 = phi ptr [ %arrayidx, %while.cond ], [ %arrayidx27, %getKey.exit ]
%i.030 = phi i32 [ %inc, %while.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx31, align 1
%cmp10 = icmp eq i8 %char0, 0
br i1 %cmp10, label %if.then12, label %while.cond
if.then12: ; preds = %if.else
%call15 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx31, ptr noundef nonnull dereferenceable(1) %str) #11
br label %while.end
while.end: ; preds = %while.cond, %getKey.exit, %if.then12
ret i32 0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [3442871 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [3442871 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [3442871 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 3442871
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [3442871 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str)
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
#define M 1046527
#define L 14
#define NIL (-1)
char H[M][L];
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
else return 0;
}
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }
int find(char str[]){
long long key,i,h;
key = getKey(str);
for(i=0;;i++)
{
h=(h1(key) + i * h2(key))% M;
if(strcmp(H[h],str)==0) return 1;
else if(strlen(H[h])==0) return 0;
}
return 0;
}
int insert(char str[]){
long long key,i,h;
key = getKey(str);
for(i=0; ;i++)
{
h=(h1(key) + i * h2(key))%M;
if(strcmp(H[h],str)==0) return 1;
else if (strlen(H[h])==0)
{
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L], com[9];
for ( i = 0; i < M; i++ ) H[i][0] = '\0';
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s %s", com, str);
if ( com[0] == 'i' ){
insert(str);
} else {
if (find(str)){
printf("yes\n");
} else {
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246841/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1046527 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.else16 [
i8 65, label %return
i8 67, label %if.then5
i8 71, label %if.then10
i8 84, label %if.then15
]
if.then5: ; preds = %entry
br label %return
if.then10: ; preds = %entry
br label %return
if.then15: ; preds = %entry
br label %return
if.else16: ; preds = %entry
br label %return
return: ; preds = %entry, %if.else16, %if.then15, %if.then10, %if.then5
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 0, %if.else16 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %if.else16.i [
i8 65, label %getChar.exit
i8 67, label %if.then5.i
i8 71, label %if.then10.i
i8 84, label %if.then15.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
if.else16.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i, %if.else16.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 0, %if.else16.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.1 [
i8 65, label %getChar.exit.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
i8 84, label %if.then15.i.1
]
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.else16.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.else16.i.1, %if.then5.i.1, %if.then10.i.1, %if.then15.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 0, %if.else16.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.epil [
i8 65, label %getChar.exit.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
i8 84, label %if.then15.i.epil
]
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.else16.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.else16.i.epil, %if.then5.i.epil, %if.then10.i.epil, %if.then15.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 0, %if.else16.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046527
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1046526
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1046526
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %if.else16.i.i [
i8 65, label %getChar.exit.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
i8 84, label %if.then15.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.else16.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.else16.i.i, %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 0, %if.else16.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.else16.i.i.1 [
i8 65, label %getChar.exit.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
i8 84, label %if.then15.i.i.1
]
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.else16.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.else16.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %if.then15.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 0, %if.else16.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %if.else16.i.i.epil [
i8 65, label %getChar.exit.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
i8 84, label %if.then15.i.i.epil
]
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.else16.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.else16.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %if.then15.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 0, %if.else16.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1046527
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1046526
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1046527
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 1046527
br i1 %exitcond.not.2, label %for.end, label %for.body.3, !llvm.loop !10
for.body.3: ; preds = %for.body
%arrayidx.3 = getelementptr inbounds [1046527 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include<stdio.h>
#include<string.h>
char h[1<<21],k[256];
int main(int argc,char *argv[]){
int fg;
int vl,s,t;
char c;
k['T'] = 1;
k['G'] = 2;
k['C'] = 3;
k['A'] = 4;
scanf("%d", &vl);
getchar();
while (vl--) {
s = 0;
t = 1;
fg = ( c = getchar() ) == 'i';
while ( ( c = getchar() ) != ' ' );
while ( ( c = k[getchar()] ) != 0 ) {
s += c * t;
t *= 4;
}
if (fg) h[s] = 1; else puts( h[s] ? "yes" : "no" );
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246885/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@k = dso_local local_unnamed_addr global [256 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@h = dso_local local_unnamed_addr global [2097152 x i8] zeroinitializer, align 16
@.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
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%vl = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %vl) #3
store i8 1, ptr getelementptr inbounds ([256 x i8], ptr @k, i64 0, i64 84), align 4, !tbaa !5
store i8 2, ptr getelementptr inbounds ([256 x i8], ptr @k, i64 0, i64 71), align 1, !tbaa !5
store i8 3, ptr getelementptr inbounds ([256 x i8], ptr @k, i64 0, i64 67), align 1, !tbaa !5
store i8 4, ptr getelementptr inbounds ([256 x i8], ptr @k, i64 0, i64 65), align 1, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %vl)
%0 = load ptr, ptr @stdin, align 8, !tbaa !8
%call.i = call i32 @getc(ptr noundef %0)
%1 = load i32, ptr %vl, align 4, !tbaa !10
%dec43 = add nsw i32 %1, -1
store i32 %dec43, ptr %vl, align 4, !tbaa !10
%tobool.not44 = icmp eq i32 %1, 0
br i1 %tobool.not44, label %while.end29, label %while.body
while.body: ; preds = %entry, %if.end
%2 = load ptr, ptr @stdin, align 8, !tbaa !8
%call.i34 = call i32 @getc(ptr noundef %2)
%sext.mask = and i32 %call.i34, 255
br label %while.cond5
while.cond5: ; preds = %while.cond5, %while.body
%3 = load ptr, ptr @stdin, align 8, !tbaa !8
%call.i35 = call i32 @getc(ptr noundef %3)
%sext.mask33 = and i32 %call.i35, 255
%cmp9.not = icmp eq i32 %sext.mask33, 32
br i1 %cmp9.not, label %while.cond12.preheader, label %while.cond5, !llvm.loop !12
while.cond12.preheader: ; preds = %while.cond5
%cmp = icmp eq i32 %sext.mask, 105
%4 = load ptr, ptr @stdin, align 8, !tbaa !8
%call.i3637 = call i32 @getc(ptr noundef %4)
%idxprom38 = sext i32 %call.i3637 to i64
%arrayidx39 = getelementptr inbounds [256 x i8], ptr @k, i64 0, i64 %idxprom38
%5 = load i8, ptr %arrayidx39, align 1, !tbaa !5
%cmp15.not40 = icmp eq i8 %5, 0
br i1 %cmp15.not40, label %while.end20, label %while.body17
while.body17: ; preds = %while.cond12.preheader, %while.body17
%6 = phi i8 [ %8, %while.body17 ], [ %5, %while.cond12.preheader ]
%t.042 = phi i32 [ %mul19, %while.body17 ], [ 1, %while.cond12.preheader ]
%s.041 = phi i32 [ %add, %while.body17 ], [ 0, %while.cond12.preheader ]
%conv14 = sext i8 %6 to i32
%mul = mul nsw i32 %t.042, %conv14
%add = add nsw i32 %mul, %s.041
%mul19 = shl nsw i32 %t.042, 2
%7 = load ptr, ptr @stdin, align 8, !tbaa !8
%call.i36 = call i32 @getc(ptr noundef %7)
%idxprom = sext i32 %call.i36 to i64
%arrayidx = getelementptr inbounds [256 x i8], ptr @k, i64 0, i64 %idxprom
%8 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp15.not = icmp eq i8 %8, 0
br i1 %cmp15.not, label %while.end20, label %while.body17, !llvm.loop !14
while.end20: ; preds = %while.body17, %while.cond12.preheader
%s.0.lcssa = phi i32 [ 0, %while.cond12.preheader ], [ %add, %while.body17 ]
%idxprom22 = sext i32 %s.0.lcssa to i64
%arrayidx23 = getelementptr inbounds [2097152 x i8], ptr @h, i64 0, i64 %idxprom22
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.end20
store i8 1, ptr %arrayidx23, align 1, !tbaa !5
br label %if.end
if.else: ; preds = %while.end20
%9 = load i8, ptr %arrayidx23, align 1, !tbaa !5
%tobool27.not = icmp eq i8 %9, 0
%cond = select i1 %tobool27.not, ptr @.str.2, ptr @.str.1
%call28 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
br label %if.end
if.end: ; preds = %if.else, %if.then
%10 = load i32, ptr %vl, align 4, !tbaa !10
%dec = add nsw i32 %10, -1
store i32 %dec, ptr %vl, align 4, !tbaa !10
%tobool.not = icmp eq i32 %10, 0
br i1 %tobool.not, label %while.end29, label %while.body, !llvm.loop !15
while.end29: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %vl) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
|
#include<stdio.h>
#include<string.h>
#define M 1500000
#define N (-1)
#define L 14
char H[M][L];
int getChar(char ch){
if ( ch == 'A') return 1;
else if ( ch == 'C') return 2;
else if ( ch == 'G') return 3;
else if ( ch == 'T') return 4;
}
long long getKey(char str[]){
long long sum = 0, p = 1, i;
for ( i = 0; i < strlen(str); i++ ){
sum += p*(getChar(str[i]));
p *= 5;
}
return sum;
}
int h1(int key){ return key%M;}
int h2(int key){ return 1+(key%(M-1));}
int find(char str[])
{
long long i,k,h;
k = getKey(str);
for(i=0 ;; i++){
h = (h1(k)+i*h2(k))%M;
if(strcmp(H[h],str) == 0)
return 1;
else if(strlen(H[h]) == 0)
return 0;
}
return 0;
}
int insert(char str[])
{
long long i,k,h;
k = getKey(str);
for(i=0 ;; i++){
h = (h1(k)+i*h2(k))%M;
if(strcmp(H[h],str) == 0)
return 1;
else if(strlen(H[h]) == 0 ){
strcpy(H[h],str);
return 0;
}
}
return 0;
}
int main(){
int i, n, h;
char str[L],com[9];
for (i=0; i<M; i++)
H[i][0] = '\0';
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%s %s",com,str);
if(com[0] == 'i'){
insert(str);
}
else{
if(find(str)){
printf("yes\n");
}
else{
printf("no\n");
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246935/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246935/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@H = dso_local global [1500000 x [14 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @getChar(i8 noundef signext %ch) local_unnamed_addr #0 {
entry:
switch i8 %ch, label %if.end18 [
i8 84, label %if.then15
i8 67, label %if.then5
i8 71, label %if.then10
]
if.then5: ; preds = %entry
br label %if.end18
if.then10: ; preds = %entry
br label %if.end18
if.then15: ; preds = %entry
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then10, %if.then15
%retval.0 = phi i32 [ 2, %if.then5 ], [ 3, %if.then10 ], [ 4, %if.then15 ], [ 1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @getKey(ptr nocapture noundef readonly %str) local_unnamed_addr #1 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not = icmp eq i64 %call, 0
br i1 %cmp8.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call, -2
br label %for.body
for.body: ; preds = %getChar.exit.1, %for.body.preheader.new
%i.011 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %getChar.exit.1 ]
%p.010 = phi i64 [ 1, %for.body.preheader.new ], [ %mul2.1, %getChar.exit.1 ]
%sum.09 = phi i64 [ 0, %for.body.preheader.new ], [ %add.1, %getChar.exit.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %getChar.exit.1 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %i.011
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %getChar.exit [
i8 84, label %if.then15.i
i8 67, label %if.then5.i
i8 71, label %if.then10.i
]
if.then5.i: ; preds = %for.body
br label %getChar.exit
if.then10.i: ; preds = %for.body
br label %getChar.exit
if.then15.i: ; preds = %for.body
br label %getChar.exit
getChar.exit: ; preds = %for.body, %if.then5.i, %if.then10.i, %if.then15.i
%retval.0.i = phi i64 [ 2, %if.then5.i ], [ 3, %if.then10.i ], [ 4, %if.then15.i ], [ 1, %for.body ]
%mul = mul nsw i64 %retval.0.i, %p.010
%add = add nuw nsw i64 %mul, %sum.09
%mul2 = mul nsw i64 %p.010, 5
%inc = or i64 %i.011, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.1 [
i8 84, label %if.then15.i.1
i8 67, label %if.then5.i.1
i8 71, label %if.then10.i.1
]
if.then10.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then5.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
if.then15.i.1: ; preds = %getChar.exit
br label %getChar.exit.1
getChar.exit.1: ; preds = %if.then15.i.1, %if.then5.i.1, %if.then10.i.1, %getChar.exit
%retval.0.i.1 = phi i64 [ 2, %if.then5.i.1 ], [ 3, %if.then10.i.1 ], [ 4, %if.then15.i.1 ], [ 1, %getChar.exit ]
%mul.1 = mul nsw i64 %retval.0.i.1, %mul2
%add.1 = add nuw nsw i64 %mul.1, %add
%mul2.1 = mul i64 %p.010, 25
%inc.1 = add nuw nsw i64 %i.011, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %getChar.exit.1, %for.body.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%i.011.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %getChar.exit.1 ]
%p.010.unr = phi i64 [ 1, %for.body.preheader ], [ %mul2.1, %getChar.exit.1 ]
%sum.09.unr = phi i64 [ 0, %for.body.preheader ], [ %add.1, %getChar.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.epil [
i8 84, label %if.then15.i.epil
i8 67, label %if.then5.i.epil
i8 71, label %if.then10.i.epil
]
if.then10.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then5.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
if.then15.i.epil: ; preds = %for.body.epil
br label %getChar.exit.epil
getChar.exit.epil: ; preds = %if.then15.i.epil, %if.then5.i.epil, %if.then10.i.epil, %for.body.epil
%retval.0.i.epil = phi i64 [ 2, %if.then5.i.epil ], [ 3, %if.then10.i.epil ], [ 4, %if.then15.i.epil ], [ 1, %for.body.epil ]
%mul.epil = mul nsw i64 %retval.0.i.epil, %p.010.unr
%add.epil = add nuw nsw i64 %mul.epil, %sum.09.unr
br label %for.end
for.end: ; preds = %getChar.exit.epil, %for.end.loopexit.unr-lcssa, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %getChar.exit.epil ]
ret i64 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress 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) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h1(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1500000
ret i32 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @h2(i32 noundef %key) local_unnamed_addr #0 {
entry:
%rem = srem i32 %key, 1499999
%add = add nsw i32 %rem, 1
ret i32 %add
}
; Function Attrs: nofree nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find(ptr nocapture noundef readonly %str) local_unnamed_addr #4 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1500000
%conv2 = sext i32 %rem.i to i64
%rem.i21 = srem i32 %sum.0.lcssa.i, 1499999
%add.i22 = add nsw i32 %rem.i21, 1
%conv5 = sext i32 %add.i22 to i64
%arrayidx23 = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call624 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx23, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp25 = icmp eq i32 %call624, 0
br i1 %cmp25, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.026, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1500000
%arrayidx = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx27 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx23, %getKey.exit ]
%i.026 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx27, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %if.else, %getKey.exit
%retval.0 = phi i32 [ 1, %getKey.exit ], [ 0, %if.else ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insert(ptr nocapture noundef readonly %str) local_unnamed_addr #5 {
entry:
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #10
%cmp8.not.i = icmp eq i64 %call.i, 0
br i1 %cmp8.not.i, label %getKey.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %getChar.exit.i.1, %for.body.i.preheader.new
%i.011.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i = phi i32 [ 0, %for.body.i.preheader.new ], [ %add.i.1, %getChar.exit.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %getChar.exit.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %i.011.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %1, label %getChar.exit.i [
i8 84, label %if.then15.i.i
i8 67, label %if.then5.i.i
i8 71, label %if.then10.i.i
]
if.then5.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then10.i.i: ; preds = %for.body.i
br label %getChar.exit.i
if.then15.i.i: ; preds = %for.body.i
br label %getChar.exit.i
getChar.exit.i: ; preds = %if.then15.i.i, %if.then10.i.i, %if.then5.i.i, %for.body.i
%retval.0.i.i = phi i32 [ 2, %if.then5.i.i ], [ 3, %if.then10.i.i ], [ 4, %if.then15.i.i ], [ 1, %for.body.i ]
%mul.i = mul i32 %retval.0.i.i, %p.010.i
%add.i = add i32 %mul.i, %sum.09.i
%mul2.i = mul i32 %p.010.i, 5
%inc.i = or i64 %i.011.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %str, i64 %inc.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %getChar.exit.i.1 [
i8 84, label %if.then15.i.i.1
i8 67, label %if.then5.i.i.1
i8 71, label %if.then10.i.i.1
]
if.then10.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then5.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
if.then15.i.i.1: ; preds = %getChar.exit.i
br label %getChar.exit.i.1
getChar.exit.i.1: ; preds = %if.then15.i.i.1, %if.then5.i.i.1, %if.then10.i.i.1, %getChar.exit.i
%retval.0.i.i.1 = phi i32 [ 2, %if.then5.i.i.1 ], [ 3, %if.then10.i.i.1 ], [ 4, %if.then15.i.i.1 ], [ 1, %getChar.exit.i ]
%mul.i.1 = mul i32 %retval.0.i.i.1, %mul2.i
%add.i.1 = add i32 %mul.i.1, %add.i
%mul2.i.1 = mul i32 %p.010.i, 25
%inc.i.1 = add nuw nsw i64 %i.011.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %getKey.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
getKey.exit.loopexit.unr-lcssa: ; preds = %getChar.exit.i.1, %for.body.i.preheader
%add.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%i.011.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc.i.1, %getChar.exit.i.1 ]
%p.010.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %mul2.i.1, %getChar.exit.i.1 ]
%sum.09.i.unr = phi i32 [ 0, %for.body.i.preheader ], [ %add.i.1, %getChar.exit.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %getKey.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %getKey.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %str, i64 %i.011.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %getChar.exit.i.epil [
i8 84, label %if.then15.i.i.epil
i8 67, label %if.then5.i.i.epil
i8 71, label %if.then10.i.i.epil
]
if.then10.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then5.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
if.then15.i.i.epil: ; preds = %for.body.i.epil
br label %getChar.exit.i.epil
getChar.exit.i.epil: ; preds = %if.then15.i.i.epil, %if.then5.i.i.epil, %if.then10.i.i.epil, %for.body.i.epil
%retval.0.i.i.epil = phi i32 [ 2, %if.then5.i.i.epil ], [ 3, %if.then10.i.i.epil ], [ 4, %if.then15.i.i.epil ], [ 1, %for.body.i.epil ]
%mul.i.epil = mul i32 %retval.0.i.i.epil, %p.010.i.unr
%add.i.epil = add i32 %mul.i.epil, %sum.09.i.unr
br label %getKey.exit
getKey.exit: ; preds = %getChar.exit.i.epil, %getKey.exit.loopexit.unr-lcssa, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i.lcssa.ph, %getKey.exit.loopexit.unr-lcssa ], [ %add.i.epil, %getChar.exit.i.epil ]
%rem.i = srem i32 %sum.0.lcssa.i, 1500000
%conv2 = sext i32 %rem.i to i64
%rem.i26 = srem i32 %sum.0.lcssa.i, 1499999
%add.i27 = add nsw i32 %rem.i26, 1
%conv5 = sext i32 %add.i27 to i64
%arrayidx29 = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %conv2
%call630 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx29, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp31 = icmp eq i32 %call630, 0
br i1 %cmp31, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%inc = add nuw nsw i64 %i.032, 1
%mul = mul nsw i64 %inc, %conv5
%add = add nsw i64 %mul, %conv2
%rem = srem i64 %add, 1500000
%arrayidx = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %rem
%call6 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %str) #10
%cmp = icmp eq i32 %call6, 0
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %getKey.exit, %for.cond
%arrayidx33 = phi ptr [ %arrayidx, %for.cond ], [ %arrayidx29, %getKey.exit ]
%i.032 = phi i64 [ %inc, %for.cond ], [ 0, %getKey.exit ]
%char0 = load i8, ptr %arrayidx33, align 1
%cmp11 = icmp eq i8 %char0, 0
br i1 %cmp11, label %if.then13, label %for.cond
if.then13: ; preds = %if.else
%call16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx33, ptr noundef nonnull dereferenceable(1) %str) #11
br label %cleanup
cleanup: ; preds = %for.cond, %getKey.exit, %if.then13
%retval.0 = phi i32 [ 0, %if.then13 ], [ 1, %getKey.exit ], [ 1, %for.cond ]
ret i32 %retval.0
}
; 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 #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%str = alloca [14 x i8], align 1
%com = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %com) #11
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.5, %for.body ]
%arrayidx = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next
store i8 0, ptr %arrayidx.1, align 2, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.1
store i8 0, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.2
store i8 0, ptr %arrayidx.3, align 2, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.4 = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.3
store i8 0, ptr %arrayidx.4, align 4, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%arrayidx.5 = getelementptr inbounds [1500000 x [14 x i8]], ptr @H, i64 0, i64 %indvars.iv.next.4
store i8 0, ptr %arrayidx.5, align 2, !tbaa !5
%indvars.iv.next.5 = add nuw nsw i64 %indvars.iv, 6
%exitcond.not.5 = icmp eq i64 %indvars.iv.next.5, 1500000
br i1 %exitcond.not.5, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp328 = icmp sgt i32 %0, 0
br i1 %cmp328, label %for.body4, label %for.end21
for.body4: ; preds = %for.end, %for.inc19
%i.129 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com, ptr noundef nonnull %str)
%1 = load i8, ptr %com, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 105
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body4
%call11 = call i32 @insert(ptr noundef nonnull %str), !range !13
br label %for.inc19
if.else: ; preds = %for.body4
%call13 = call i32 @find(ptr noundef nonnull %str), !range !13
%tobool.not = icmp eq i32 %call13, 0
br i1 %tobool.not, label %if.else16, label %if.then14
if.then14: ; preds = %if.else
%puts26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc19
if.else16: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc19
for.inc19: ; preds = %if.then, %if.else16, %if.then14
%inc20 = add nuw nsw i32 %i.129, 1
%2 = load i32, ptr %n, align 4, !tbaa !11
%cmp3 = icmp slt i32 %inc20, %2
br i1 %cmp3, label %for.body4, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.inc19, %for.end
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %com) #11
call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %str) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
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(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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
int main(void)
{
int n;
int i;
int age;
int than_ten, ten, twen, thir, four, fif, six;
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
than_ten = ten = twen = thir = four = fif = six = 0;
for (i = 0; i < n; i++){
scanf("%d", &age);
if (age >= 0 && age <= 9){
than_ten++;
}
else if (age <= 19){
ten++;
}
else if (age <= 29){
twen++;
}
else if (age <= 39){
thir++;
}
else if (age <= 49){
four++;
}
else if (age <= 59){
fif++;
}
else if (age >= 60){
six++;
}
}
printf("%d\n%d\n%d\n%d\n%d\n%d\n%d\n", than_ten, ten, twen, thir, four, fif, six);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_246986/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_246986/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [22 x i8] c"%d\0A%d\0A%d\0A%d\0A%d\0A%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%age = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %age) #3
%call61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp62 = icmp eq i32 %0, 0
br i1 %cmp62, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %4, %for.end ], [ %0, %entry ]
%cmp146 = icmp sgt i32 %1, 0
br i1 %cmp146, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.inc
%six.054 = phi i32 [ %six.1, %for.inc ], [ 0, %for.cond.preheader ]
%fif.053 = phi i32 [ %fif.1, %for.inc ], [ 0, %for.cond.preheader ]
%four.052 = phi i32 [ %four.1, %for.inc ], [ 0, %for.cond.preheader ]
%thir.051 = phi i32 [ %thir.1, %for.inc ], [ 0, %for.cond.preheader ]
%twen.050 = phi i32 [ %twen.1, %for.inc ], [ 0, %for.cond.preheader ]
%ten.049 = phi i32 [ %ten.1, %for.inc ], [ 0, %for.cond.preheader ]
%than_ten.048 = phi i32 [ %than_ten.1, %for.inc ], [ 0, %for.cond.preheader ]
%i.047 = phi i32 [ %inc36, %for.inc ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %age)
%2 = load i32, ptr %age, align 4
%or.cond = icmp ult i32 %2, 10
br i1 %or.cond, label %if.then5, label %if.else
if.then5: ; preds = %for.body
%inc = add nsw i32 %than_ten.048, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp6 = icmp slt i32 %2, 20
br i1 %cmp6, label %if.then7, label %if.else9
if.then7: ; preds = %if.else
%inc8 = add nsw i32 %ten.049, 1
br label %for.inc
if.else9: ; preds = %if.else
%cmp10 = icmp ult i32 %2, 30
br i1 %cmp10, label %if.then11, label %if.else13
if.then11: ; preds = %if.else9
%inc12 = add nsw i32 %twen.050, 1
br label %for.inc
if.else13: ; preds = %if.else9
%cmp14 = icmp ult i32 %2, 40
br i1 %cmp14, label %if.then15, label %if.else17
if.then15: ; preds = %if.else13
%inc16 = add nsw i32 %thir.051, 1
br label %for.inc
if.else17: ; preds = %if.else13
%cmp18 = icmp ult i32 %2, 50
br i1 %cmp18, label %if.then19, label %if.else21
if.then19: ; preds = %if.else17
%inc20 = add nsw i32 %four.052, 1
br label %for.inc
if.else21: ; preds = %if.else17
%cmp22 = icmp ult i32 %2, 60
br i1 %cmp22, label %if.then23, label %if.then27
if.then23: ; preds = %if.else21
%inc24 = add nsw i32 %fif.053, 1
br label %for.inc
if.then27: ; preds = %if.else21
%inc28 = add nsw i32 %six.054, 1
br label %for.inc
for.inc: ; preds = %if.then5, %if.then11, %if.then19, %if.then27, %if.then23, %if.then15, %if.then7
%than_ten.1 = phi i32 [ %inc, %if.then5 ], [ %than_ten.048, %if.then7 ], [ %than_ten.048, %if.then11 ], [ %than_ten.048, %if.then15 ], [ %than_ten.048, %if.then19 ], [ %than_ten.048, %if.then23 ], [ %than_ten.048, %if.then27 ]
%ten.1 = phi i32 [ %ten.049, %if.then5 ], [ %inc8, %if.then7 ], [ %ten.049, %if.then11 ], [ %ten.049, %if.then15 ], [ %ten.049, %if.then19 ], [ %ten.049, %if.then23 ], [ %ten.049, %if.then27 ]
%twen.1 = phi i32 [ %twen.050, %if.then5 ], [ %twen.050, %if.then7 ], [ %inc12, %if.then11 ], [ %twen.050, %if.then15 ], [ %twen.050, %if.then19 ], [ %twen.050, %if.then23 ], [ %twen.050, %if.then27 ]
%thir.1 = phi i32 [ %thir.051, %if.then5 ], [ %thir.051, %if.then7 ], [ %thir.051, %if.then11 ], [ %inc16, %if.then15 ], [ %thir.051, %if.then19 ], [ %thir.051, %if.then23 ], [ %thir.051, %if.then27 ]
%four.1 = phi i32 [ %four.052, %if.then5 ], [ %four.052, %if.then7 ], [ %four.052, %if.then11 ], [ %four.052, %if.then15 ], [ %inc20, %if.then19 ], [ %four.052, %if.then23 ], [ %four.052, %if.then27 ]
%fif.1 = phi i32 [ %fif.053, %if.then5 ], [ %fif.053, %if.then7 ], [ %fif.053, %if.then11 ], [ %fif.053, %if.then15 ], [ %fif.053, %if.then19 ], [ %inc24, %if.then23 ], [ %fif.053, %if.then27 ]
%six.1 = phi i32 [ %six.054, %if.then5 ], [ %six.054, %if.then7 ], [ %six.054, %if.then11 ], [ %six.054, %if.then15 ], [ %six.054, %if.then19 ], [ %six.054, %if.then23 ], [ %inc28, %if.then27 ]
%inc36 = add nuw nsw i32 %i.047, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc36, %3
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%than_ten.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %than_ten.1, %for.inc ]
%ten.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %ten.1, %for.inc ]
%twen.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %twen.1, %for.inc ]
%thir.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %thir.1, %for.inc ]
%four.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %four.1, %for.inc ]
%fif.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %fif.1, %for.inc ]
%six.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %six.1, %for.inc ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %than_ten.0.lcssa, i32 noundef %ten.0.lcssa, i32 noundef %twen.0.lcssa, i32 noundef %thir.0.lcssa, i32 noundef %four.0.lcssa, i32 noundef %fif.0.lcssa, i32 noundef %six.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %4, 0
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 %age) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
/** Application main entry point. */
int main (
int argc,
char * argv[ ]
)
{
for ( ; ; )
{
int r[ 7 ] = { 0 };
int n;
scanf ( "%d", &n );
if ( !( n ) ) break ;
while ( n-- )
{
int d;
scanf ( "%d", &d );
r[ 0 ] += !!( d < 10 );
r[ 1 ] += !!( d >= 10 && d < 20 );
r[ 2 ] += !!( d >= 20 && d < 30 );
r[ 3 ] += !!( d >= 30 && d < 40 );
r[ 4 ] += !!( d >= 40 && d < 50 );
r[ 5 ] += !!( d >= 50 && d < 60 );
r[ 6 ] += !!( d >= 60 );
}
printf ( "%d\n%d\n%d\n%d\n%d\n%d\n%d\n"
, r[ 0 ], r[ 1 ], r[ 2 ], r[ 3 ]
, r[ 4 ], r[ 5 ], r[ 6 ] );
}
return ( 0 );
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247035/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247035/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [22 x i8] c"%d\0A%d\0A%d\0A%d\0A%d\0A%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call98 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not99 = icmp eq i32 %0, 0
br i1 %tobool.not99, label %for.end, label %while.body.preheader
while.body.preheader: ; preds = %entry, %cleanup
%1 = phi i32 [ %17, %cleanup ], [ %0, %entry ]
%dec83 = add nsw i32 %1, -1
store i32 %dec83, ptr %n, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%r.sroa.21.191 = phi i32 [ %add58, %while.body ], [ 0, %while.body.preheader ]
%r.sroa.6.186 = phi i32 [ %add11, %while.body ], [ 0, %while.body.preheader ]
%r.sroa.0.185 = phi i32 [ %add, %while.body ], [ 0, %while.body.preheader ]
%2 = phi <4 x i32> [ %11, %while.body ], [ zeroinitializer, %while.body.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%3 = load i32, ptr %d, align 4
%cmp = icmp slt i32 %3, 10
%lnot.ext = zext i1 %cmp to i32
%add = add nuw nsw i32 %r.sroa.0.185, %lnot.ext
%4 = add i32 %3, -10
%5 = icmp ult i32 %4, 10
%lnot.ext9 = zext i1 %5 to i32
%add11 = add nuw nsw i32 %r.sroa.6.186, %lnot.ext9
%6 = insertelement <4 x i32> poison, i32 %3, i64 0
%7 = shufflevector <4 x i32> %6, <4 x i32> poison, <4 x i32> zeroinitializer
%8 = add <4 x i32> %7, <i32 -50, i32 -40, i32 -30, i32 -20>
%9 = icmp ult <4 x i32> %8, <i32 10, i32 10, i32 10, i32 10>
%10 = zext <4 x i1> %9 to <4 x i32>
%11 = add nuw nsw <4 x i32> %2, %10
%cmp52 = icmp sgt i32 %3, 59
%lnot.ext56 = zext i1 %cmp52 to i32
%add58 = add nuw nsw i32 %r.sroa.21.191, %lnot.ext56
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
%12 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %12, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool1.not = icmp eq i32 %12, 0
br i1 %tobool1.not, label %cleanup, label %while.body, !llvm.loop !9
cleanup: ; preds = %while.body
%13 = extractelement <4 x i32> %11, i64 0
%14 = extractelement <4 x i32> %11, i64 1
%15 = extractelement <4 x i32> %11, i64 2
%16 = extractelement <4 x i32> %11, i64 3
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add, i32 noundef %add11, i32 noundef %16, i32 noundef %15, i32 noundef %14, i32 noundef %13, i32 noundef %add58)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 %n)
%17 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %17, 0
br i1 %tobool.not, label %for.end, label %while.body.preheader
for.end: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
// AOJ 3051 Lunch
// 2018.3.16 bal4u
#include <stdio.h>
#include <stdlib.h>
int main()
{
int max, a, i, id;
max = 0; for (i = 0; i < 3; i++) {
scanf("%d", &a);
if (a > max) max = a, id = i;
}
printf("%c\n", 'A' + id);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247086/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247086/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%c\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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %0, i32 0)
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp1.1 = icmp sgt i32 %1, %spec.select
%spec.select.1 = call i32 @llvm.smax.i32(i32 %1, i32 %spec.select)
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp1.2 = icmp sgt i32 %2, %spec.select.1
%3 = select i1 %cmp1.1, i32 66, i32 65
%add = select i1 %cmp1.2, i32 67, i32 %3
%call2 = 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) #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>
#include<stdlib.h>
#include<string.h>
#define df 0
int dc=100000;
#define MAX 100010
int comp(const void*a,const void *b){
int x=*((int*)a),y=*((int*)b);
return x-y;
}
int main(){
if(df)printf("*** debug mode ***\n");
int n;
scanf("%d",&n);
int a[n],i;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
qsort(a,n,sizeof(int),comp);
int s=0,temp=0,prev=a[0];
for(i=0;i<n;i++){
if(prev==a[i])temp^=1;
else{
s+=temp;
temp=1;
prev=a[i];
}
}
s+=temp;
printf("%d",s);
return 0;
}
/// confirm df==0 ///
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247136/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247136/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dc = dso_local local_unnamed_addr global i32 100000, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
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
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %3, 0
br i1 %cmp29, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %3 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 i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %5, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @comp) #6
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp431 = icmp sgt i32 %6, 0
br i1 %cmp431, label %for.body6.preheader, label %for.end15
for.body6.preheader: ; preds = %for.end
%7 = load i32, ptr %vla, align 16, !tbaa !5
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count, 1
%8 = icmp eq i32 %6, 1
br i1 %8, label %for.end15.loopexit.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.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv40 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next41.1, %for.body6 ]
%prev.035 = phi i32 [ %7, %for.body6.preheader.new ], [ %10, %for.body6 ]
%temp.034 = phi i32 [ 0, %for.body6.preheader.new ], [ %temp.1.1, %for.body6 ]
%s.033 = phi i32 [ 0, %for.body6.preheader.new ], [ %s.1.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv40
%9 = load i32, ptr %arrayidx8, align 8, !tbaa !5
%cmp9 = icmp eq i32 %prev.035, %9
%xor = xor i32 %temp.034, 1
%add = select i1 %cmp9, i32 0, i32 %temp.034
%s.1 = add nsw i32 %add, %s.033
%temp.1 = select i1 %cmp9, i32 %xor, i32 1
%indvars.iv.next41 = or i64 %indvars.iv40, 1
%arrayidx8.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next41
%10 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%cmp9.1 = icmp eq i32 %9, %10
%xor.1 = xor i32 %temp.1, 1
%add.1 = select i1 %cmp9.1, i32 0, i32 %temp.1
%s.1.1 = add nsw i32 %add.1, %s.1
%temp.1.1 = select i1 %cmp9.1, i32 %xor.1, i32 1
%indvars.iv.next41.1 = add nuw nsw i64 %indvars.iv40, 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.end15.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11
for.end15.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%s.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %s.1.1, %for.body6 ]
%temp.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %temp.1.1, %for.body6 ]
%indvars.iv40.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next41.1, %for.body6 ]
%prev.035.unr = phi i32 [ %7, %for.body6.preheader ], [ %10, %for.body6 ]
%temp.034.unr = phi i32 [ 0, %for.body6.preheader ], [ %temp.1.1, %for.body6 ]
%s.033.unr = phi i32 [ 0, %for.body6.preheader ], [ %s.1.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end15.loopexit, label %for.body6.epil
for.body6.epil: ; preds = %for.end15.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv40.unr
%11 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%cmp9.epil = icmp eq i32 %prev.035.unr, %11
%xor.epil = xor i32 %temp.034.unr, 1
%add.epil = select i1 %cmp9.epil, i32 0, i32 %temp.034.unr
%s.1.epil = add nsw i32 %add.epil, %s.033.unr
%temp.1.epil = select i1 %cmp9.epil, i32 %xor.epil, i32 1
br label %for.end15.loopexit
for.end15.loopexit: ; preds = %for.end15.loopexit.unr-lcssa, %for.body6.epil
%s.1.lcssa = phi i32 [ %s.1.lcssa.ph, %for.end15.loopexit.unr-lcssa ], [ %s.1.epil, %for.body6.epil ]
%temp.1.lcssa = phi i32 [ %temp.1.lcssa.ph, %for.end15.loopexit.unr-lcssa ], [ %temp.1.epil, %for.body6.epil ]
%12 = add nsw i32 %temp.1.lcssa, %s.1.lcssa
br label %for.end15
for.end15: ; preds = %for.end15.loopexit, %for.end
%add16 = phi i32 [ 0, %for.end ], [ %12, %for.end15.loopexit ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add16)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int i,n,mid,mid1,mid2;
char c,arr[2007],arr1[2007];
scanf("%d",&n);
scanf("%c",&c);
if(n%2==0)
mid=n/2;
else
mid=(n+1)/2;
for(i=1;i<=n;i++)
scanf("%c",&arr[i]);
if(n%2==0)
{
arr1[mid]=arr[1];
mid1=mid+1;
mid2=mid-1;
for(i=2;i<=n;i++)
{
if(i%2!=0)
{
arr1[mid2]=arr[i];
mid2--;
}
else
{
arr1[mid1]=arr[i];
mid1++;
}
}
}
else
{
arr1[mid]=arr[1];
mid1=mid+1;
mid2=mid-1;
for(i=2;i<=n;i++)
{
if(i%2==0)
{
arr1[mid2]=arr[i];
mid2--;
}
else
{
arr1[mid1]=arr[i];
mid1++;
}
}
}
for(i=1;i<=n;i++)
printf("%c",arr1[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24718/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24718/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%c = alloca i8, align 1
%arr = alloca [2007 x i8], align 16
%arr1 = alloca [2007 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 2007, ptr nonnull %arr) #4
call void @llvm.lifetime.start.p0(i64 2007, ptr nonnull %arr1) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%mid.0.in = add i32 %1, %0
%mid.0 = sdiv i32 %mid.0.in, 2
%cmp3.not96 = icmp slt i32 %0, 1
br i1 %cmp3.not96, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [2007 x i8], ptr %arr, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp3.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%4 = phi i32 [ %0, %entry ], [ %2, %for.body ]
%5 = and i32 %4, 1
%cmp6 = icmp eq i32 %5, 0
%arrayidx8 = getelementptr inbounds [2007 x i8], ptr %arr, i64 0, i64 1
%6 = load i8, ptr %arrayidx8, align 1, !tbaa !11
%idxprom9 = sext i32 %mid.0 to i64
%arrayidx10 = getelementptr inbounds [2007 x i8], ptr %arr1, i64 0, i64 %idxprom9
store i8 %6, ptr %arrayidx10, align 1, !tbaa !11
%cmp13.not102 = icmp slt i32 %4, 2
br i1 %cmp6, label %if.then7, label %if.else32
if.then7: ; preds = %for.end
br i1 %cmp13.not102, label %if.end59, label %for.body14.preheader
for.body14.preheader: ; preds = %if.then7
%sub = add nsw i32 %mid.0, -1
%add11 = add nsw i32 %mid.0, 1
%7 = add nuw i32 %4, 1
%wide.trip.count117 = zext i32 %7 to i64
br label %for.body14
for.body14: ; preds = %for.body14.preheader, %for.inc29
%indvars.iv114 = phi i64 [ 2, %for.body14.preheader ], [ %indvars.iv.next115, %for.inc29 ]
%mid2.0105 = phi i32 [ %sub, %for.body14.preheader ], [ %mid2.1, %for.inc29 ]
%mid1.0104 = phi i32 [ %add11, %for.body14.preheader ], [ %mid1.1, %for.inc29 ]
%rem15123 = and i64 %indvars.iv114, 1
%cmp16.not = icmp eq i64 %rem15123, 0
%arrayidx24 = getelementptr inbounds [2007 x i8], ptr %arr, i64 0, i64 %indvars.iv114
%8 = load i8, ptr %arrayidx24, align 1, !tbaa !11
br i1 %cmp16.not, label %if.else22, label %if.then17
if.then17: ; preds = %for.body14
%idxprom20 = sext i32 %mid2.0105 to i64
%arrayidx21 = getelementptr inbounds [2007 x i8], ptr %arr1, i64 0, i64 %idxprom20
store i8 %8, ptr %arrayidx21, align 1, !tbaa !11
%dec = add nsw i32 %mid2.0105, -1
br label %for.inc29
if.else22: ; preds = %for.body14
%idxprom25 = sext i32 %mid1.0104 to i64
%arrayidx26 = getelementptr inbounds [2007 x i8], ptr %arr1, i64 0, i64 %idxprom25
store i8 %8, ptr %arrayidx26, align 1, !tbaa !11
%inc27 = add nsw i32 %mid1.0104, 1
br label %for.inc29
for.inc29: ; preds = %if.then17, %if.else22
%mid1.1 = phi i32 [ %mid1.0104, %if.then17 ], [ %inc27, %if.else22 ]
%mid2.1 = phi i32 [ %dec, %if.then17 ], [ %mid2.0105, %if.else22 ]
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%exitcond118.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count117
br i1 %exitcond118.not, label %if.end59, label %for.body14, !llvm.loop !12
if.else32: ; preds = %for.end
br i1 %cmp13.not102, label %if.end59, label %for.body40.preheader
for.body40.preheader: ; preds = %if.else32
%sub37 = add nsw i32 %mid.0, -1
%add36 = add nsw i32 %mid.0, 1
%9 = add nuw i32 %4, 1
%wide.trip.count = zext i32 %9 to i64
br label %for.body40
for.body40: ; preds = %for.body40.preheader, %for.inc56
%indvars.iv111 = phi i64 [ 2, %for.body40.preheader ], [ %indvars.iv.next112, %for.inc56 ]
%mid2.2101 = phi i32 [ %sub37, %for.body40.preheader ], [ %mid2.3, %for.inc56 ]
%mid1.2100 = phi i32 [ %add36, %for.body40.preheader ], [ %mid1.3, %for.inc56 ]
%rem41122 = and i64 %indvars.iv111, 1
%cmp42 = icmp eq i64 %rem41122, 0
%arrayidx45 = getelementptr inbounds [2007 x i8], ptr %arr, i64 0, i64 %indvars.iv111
%10 = load i8, ptr %arrayidx45, align 1, !tbaa !11
br i1 %cmp42, label %if.then43, label %if.else49
if.then43: ; preds = %for.body40
%idxprom46 = sext i32 %mid2.2101 to i64
%arrayidx47 = getelementptr inbounds [2007 x i8], ptr %arr1, i64 0, i64 %idxprom46
store i8 %10, ptr %arrayidx47, align 1, !tbaa !11
%dec48 = add nsw i32 %mid2.2101, -1
br label %for.inc56
if.else49: ; preds = %for.body40
%idxprom52 = sext i32 %mid1.2100 to i64
%arrayidx53 = getelementptr inbounds [2007 x i8], ptr %arr1, i64 0, i64 %idxprom52
store i8 %10, ptr %arrayidx53, align 1, !tbaa !11
%inc54 = add nsw i32 %mid1.2100, 1
br label %for.inc56
for.inc56: ; preds = %if.then43, %if.else49
%mid1.3 = phi i32 [ %mid1.2100, %if.then43 ], [ %inc54, %if.else49 ]
%mid2.3 = phi i32 [ %dec48, %if.then43 ], [ %mid2.2101, %if.else49 ]
%indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
%exitcond.not = icmp eq i64 %indvars.iv.next112, %wide.trip.count
br i1 %exitcond.not, label %if.end59, label %for.body40, !llvm.loop !13
if.end59: ; preds = %for.inc56, %for.inc29, %if.else32, %if.then7
%cmp61.not106 = icmp slt i32 %4, 1
br i1 %cmp61.not106, label %for.end68, label %for.body62
for.body62: ; preds = %if.end59, %for.body62
%indvars.iv119 = phi i64 [ %indvars.iv.next120, %for.body62 ], [ 1, %if.end59 ]
%arrayidx64 = getelementptr inbounds [2007 x i8], ptr %arr1, i64 0, i64 %indvars.iv119
%11 = load i8, ptr %arrayidx64, align 1, !tbaa !11
%conv = sext i8 %11 to i32
%putchar = call i32 @putchar(i32 %conv)
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp61.not.not = icmp slt i64 %indvars.iv119, %13
br i1 %cmp61.not.not, label %for.body62, label %for.end68, !llvm.loop !14
for.end68: ; preds = %for.body62, %if.end59
call void @llvm.lifetime.end.p0(i64 2007, ptr nonnull %arr1) #4
call void @llvm.lifetime.end.p0(i64 2007, ptr nonnull %arr) #4
call void @llvm.lifetime.end.p0(i64 1, 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: 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main()
{
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
b/=2;
scanf("%d",&c);
c/=4;
if(b<a)
a=b;
if(c<a)
a=c;
a*=7;
printf("%d",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24723/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24723/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
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)
%0 = load i32, ptr %b, align 4, !tbaa !5
%div = sdiv i32 %0, 2
store i32 %div, ptr %b, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%1 = load i32, ptr %c, align 4, !tbaa !5
%div3 = sdiv i32 %1, 4
store i32 %div3, ptr %c, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %a, align 4, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %2, i32 %3)
%4 = call i32 @llvm.smin.i32(i32 %div3, i32 %spec.select)
%mul = mul nsw i32 %4, 7
store i32 %mul, ptr %a, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul)
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.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"}
|
// 1041
#include <stdio.h>
int main()
{
int i, n, sum, a;
while (1) {
scanf("%d", &n);
if (n == 0)
break;
sum = 0;
for (i = 0; i < n / 4; i++) {
scanf("%d", &a);
sum += a;
}
printf("%d\n", sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247295/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247295/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11 = icmp eq i32 %0, 0
br i1 %cmp11, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %4, %for.end ], [ %0, %entry ]
%cmp17 = icmp sgt i32 %1, 3
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%sum.09 = phi i32 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %2, %sum.09
%inc = add nuw nsw i32 %i.08, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %3, 4
%cmp1 = icmp slt i32 %inc, %div
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %add, %for.body ]
%call3 = 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 %n)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %4, 0
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 %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
typedef const void cv;
int downint(cv *a, cv *b) {
return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0;
}
int main(void){
int n,a[200000],i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
qsort(a,n,sizeof(int),downint);
for(i=0;i<n-1;i++){
if(a[i] == a[i+1]){
printf("NO");
return 0;
}
}
printf("YES");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247338/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247338/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"NO\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downint(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 sgt i32 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%a = alloca [200000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, 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 [200000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @downint) #6
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = call i32 @llvm.smax.i32(i32 %3, i32 1)
%smax = add nsw i32 %4, -1
%wide.trip.count = zext i32 %smax to i64
br label %for.cond2
for.cond2: ; preds = %for.body5, %for.end
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body5 ], [ 0, %for.end ]
%exitcond.not = icmp eq i64 %indvars.iv30, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body5
for.body5: ; preds = %for.cond2
%arrayidx7 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv30
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%arrayidx9 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv.next31
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %5, %6
br i1 %cmp10, label %cleanup, label %for.cond2, !llvm.loop !11
cleanup: ; preds = %for.cond2, %for.body5
%.str.2.sink = phi ptr [ @.str.1, %for.body5 ], [ @.str.2, %for.cond2 ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
int int_sort( const void * a , const void * b ) {
if( *( int * )a < *( int * )b ) {
return -1;
}
else
if( *( int * )a == *( int * )b ) {
return 0;
}
return 1;
}
int main(void){
int N;
int A[200000];
int i,j;
size_t data_cnt;
scanf("%d\n",&N);
for(i=0;i<N;i++){
scanf("%d ",&A[i]);
}
data_cnt =N;
qsort((void*)A, data_cnt , sizeof(A[0]), int_sort );
int y=1;
for(i=0;i<N-1;i++){
if(A[i]==A[i+1]){
y=0;
}
}
if(y==1){
printf("YES\n");
}else{printf("NO\n");}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247389/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247389/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @int_sort(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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
%A = alloca [200000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %A) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre39 = 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 [200000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre39, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %A, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @int_sort) #6
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp330 = icmp sgt i32 %3, 1
br i1 %cmp330, label %for.body5.preheader, label %if.end20
for.body5.preheader: ; preds = %for.end
%sub = add nsw i32 %3, -1
%wide.trip.count = zext i32 %sub to i64
%.pre = load i32, ptr %A, align 16, !tbaa !5
%min.iters.check = icmp ult i32 %3, 9
br i1 %min.iters.check, label %for.body5.preheader47, label %vector.ph
vector.ph: ; preds = %for.body5.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load43, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %11, %vector.body ]
%vec.phi42 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %12, %vector.body ]
%4 = or i64 %index, 1
%5 = getelementptr inbounds [200000 x i32], ptr %A, i64 0, i64 %4
%wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load43 = load <4 x i32>, ptr %6, align 4, !tbaa !5
%7 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%8 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load43, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%9 = icmp eq <4 x i32> %7, %wide.load
%10 = icmp eq <4 x i32> %8, %wide.load43
%11 = select <4 x i1> %9, <4 x i32> zeroinitializer, <4 x i32> %vec.phi
%12 = select <4 x i1> %10, <4 x i32> zeroinitializer, <4 x i32> %vec.phi42
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %11, <i32 1, i32 1, i32 1, i32 1>
%rdx.select.cmp4446 = icmp ne <4 x i32> %12, <i32 1, i32 1, i32 1, i32 1>
%rdx.select.cmp44 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp4446
%14 = bitcast <4 x i1> %rdx.select.cmp44 to i4
%.not = icmp eq i4 %14, 0
%rdx.select45 = zext i1 %.not to i32
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
%vector.recur.extract = extractelement <4 x i32> %wide.load43, i64 3
br i1 %cmp.n, label %for.end14, label %for.body5.preheader47
for.body5.preheader47: ; preds = %for.body5.preheader, %middle.block
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body5.preheader ]
%indvars.iv36.ph = phi i64 [ %n.vec, %middle.block ], [ 0, %for.body5.preheader ]
%y.032.ph = phi i32 [ %rdx.select45, %middle.block ], [ 1, %for.body5.preheader ]
br label %for.body5
for.body5: ; preds = %for.body5.preheader47, %for.body5
%scalar.recur = phi i32 [ %15, %for.body5 ], [ %scalar.recur.ph, %for.body5.preheader47 ]
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %for.body5 ], [ %indvars.iv36.ph, %for.body5.preheader47 ]
%y.032 = phi i32 [ %spec.select, %for.body5 ], [ %y.032.ph, %for.body5.preheader47 ]
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%arrayidx9 = getelementptr inbounds [200000 x i32], ptr %A, i64 0, i64 %indvars.iv.next37
%15 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %scalar.recur, %15
%spec.select = select i1 %cmp10, i32 0, i32 %y.032
%exitcond.not = icmp eq i64 %indvars.iv.next37, %wide.trip.count
br i1 %exitcond.not, label %for.end14.loopexit, label %for.body5, !llvm.loop !14
for.end14.loopexit: ; preds = %for.body5
%16 = icmp eq i32 %spec.select, 1
br label %for.end14
for.end14: ; preds = %for.end14.loopexit, %middle.block
%spec.select.lcssa = phi i1 [ %.not, %middle.block ], [ %16, %for.end14.loopexit ]
%spec.select41 = select i1 %spec.select.lcssa, ptr @str.4, ptr @str
br label %if.end20
if.end20: ; preds = %for.end14, %for.end
%str.sink = phi ptr [ @str.4, %for.end ], [ %spec.select41, %for.end14 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %A) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) 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 nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include<stdio.h>
#include<stdlib.h>
#define MAX 200000
void merge_sort (int array[], int left, int right) {
int i, j, k, mid;
int work[MAX];
if (left >= right) return;
else{
mid = (left + right)/2;
merge_sort(array, left, mid);
merge_sort(array, mid+1, right);
for (i = mid; i >= left; i--) { work[i] = array[i]; }
for (j = mid+1; j <= right; j++) {
work[right-(j-(mid+1))] = array[j];
}
i = left; j = right;
for (k = left; k <= right; k++) {
if (work[i] < work[j]) { array[k] = work[i++]; }
else { array[k] = work[j--]; }
}
}
}
int main(void){
int A[MAX];
int i;
int N,flag=0;
scanf("%d",&N);
for(i=0;i<N-1;i++){
scanf("%d ",&A[i]);
}
scanf("%d",&A[N-1]);
merge_sort(A,0,N-1);
for(i=0;i<N-1;i++){
if(A[i] == A[i+1]){
flag++;
break;
}
}
if(flag) printf("NO");
else printf("YES");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247431/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247431/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [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 nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @merge_sort(ptr noundef %array, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%work = alloca [200000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %work) #6
%cmp.not = icmp slt i32 %left, %right
br i1 %cmp.not, label %if.else, label %cleanup
if.else: ; preds = %entry
%add = add nsw i32 %right, %left
%div = sdiv i32 %add, 2
tail call void @merge_sort(ptr noundef %array, i32 noundef %left, i32 noundef %div)
%add1 = add nsw i32 %div, 1
tail call void @merge_sort(ptr noundef %array, i32 noundef %add1, i32 noundef %right)
%cmp2.not79 = icmp slt i32 %div, %left
br i1 %cmp2.not79, label %for.cond6.preheader, label %for.body.preheader
for.body.preheader: ; preds = %if.else
%0 = sext i32 %div to i64
%1 = sub i32 %div, %left
%2 = zext i32 %1 to i64
%3 = shl nuw nsw i64 %2, 2
%4 = sub nsw i64 %0, %2
%5 = shl nsw i64 %4, 2
%scevgep = getelementptr i8, ptr %work, i64 %5
%scevgep87 = getelementptr i8, ptr %array, i64 %5
%6 = add nuw nsw i64 %3, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, ptr noundef nonnull align 4 dereferenceable(1) %scevgep87, i64 %6, i1 false), !tbaa !5
br label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body.preheader, %if.else
%cmp7.not81.not = icmp slt i32 %div, %right
br i1 %cmp7.not81.not, label %for.body8.lr.ph, label %for.cond17.preheader
for.body8.lr.ph: ; preds = %for.cond6.preheader
%sub.neg = add i32 %add1, %right
%narrow = add nsw i32 %div, 1
%7 = sext i32 %narrow to i64
%8 = add i32 %right, 1
%9 = xor i32 %div, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = add nuw nsw i64 %11, 1
%min.iters.check = icmp ugt i32 %10, 10
br i1 %min.iters.check, label %vector.ph, label %for.body8.preheader
vector.ph: ; preds = %for.body8.lr.ph
%n.vec = and i64 %12, 8589934584
%ind.end = add nsw i64 %n.vec, %7
%invariant.gep = getelementptr i32, ptr %array, i64 %7
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%13 = trunc i64 %index to i32
%14 = add i32 %narrow, %13
%gep = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %gep, align 4, !tbaa !5
%15 = getelementptr inbounds i32, ptr %gep, i64 4
%wide.load96 = load <4 x i32>, ptr %15, align 4, !tbaa !5
%16 = sub i32 %sub.neg, %14
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [200000 x i32], ptr %work, i64 0, i64 %17
%reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%19 = getelementptr inbounds i32, ptr %18, i64 -3
store <4 x i32> %reverse, ptr %19, align 4, !tbaa !5
%reverse97 = shufflevector <4 x i32> %wide.load96, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%20 = getelementptr inbounds i32, ptr %18, i64 -7
store <4 x i32> %reverse97, ptr %20, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %12, %n.vec
br i1 %cmp.n, label %for.cond17.preheader, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body8.lr.ph, %middle.block
%indvars.iv.ph = phi i64 [ %7, %for.body8.lr.ph ], [ %ind.end, %middle.block ]
%22 = add i32 %right, 1
%23 = trunc i64 %indvars.iv.ph to i32
%24 = sub i32 %22, %23
%25 = sub i32 %right, %23
%xtraiter = and i32 %24, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body8.prol.loopexit, label %for.body8.prol
for.body8.prol: ; preds = %for.body8.preheader, %for.body8.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body8.prol ], [ %indvars.iv.ph, %for.body8.preheader ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body8.prol ], [ 0, %for.body8.preheader ]
%arrayidx10.prol = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.prol
%26 = load i32, ptr %arrayidx10.prol, align 4, !tbaa !5
%27 = trunc i64 %indvars.iv.prol to i32
%sub12.prol = sub i32 %sub.neg, %27
%idxprom13.prol = sext i32 %sub12.prol to i64
%arrayidx14.prol = getelementptr inbounds [200000 x i32], ptr %work, i64 0, i64 %idxprom13.prol
store i32 %26, ptr %arrayidx14.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body8.prol.loopexit, label %for.body8.prol, !llvm.loop !13
for.body8.prol.loopexit: ; preds = %for.body8.prol, %for.body8.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body8.preheader ], [ %indvars.iv.next.prol, %for.body8.prol ]
%28 = icmp ult i32 %25, 3
br i1 %28, label %for.cond17.preheader, label %for.body8
for.cond17.preheader: ; preds = %for.body8.prol.loopexit, %for.body8, %middle.block, %for.cond6.preheader
%cmp18.not83 = icmp sgt i32 %left, %right
br i1 %cmp18.not83, label %cleanup, label %for.body19.preheader
for.body19.preheader: ; preds = %for.cond17.preheader
%29 = sext i32 %left to i64
%30 = add i32 %right, 1
br label %for.body19
for.body8: ; preds = %for.body8.prol.loopexit, %for.body8
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body8 ], [ %indvars.iv.unr, %for.body8.prol.loopexit ]
%arrayidx10 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%31 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%32 = trunc i64 %indvars.iv to i32
%sub12 = sub i32 %sub.neg, %32
%idxprom13 = sext i32 %sub12 to i64
%arrayidx14 = getelementptr inbounds [200000 x i32], ptr %work, i64 0, i64 %idxprom13
store i32 %31, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx10.1 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.next
%33 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%34 = trunc i64 %indvars.iv.next to i32
%sub12.1 = sub i32 %sub.neg, %34
%idxprom13.1 = sext i32 %sub12.1 to i64
%arrayidx14.1 = getelementptr inbounds [200000 x i32], ptr %work, i64 0, i64 %idxprom13.1
store i32 %33, ptr %arrayidx14.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%arrayidx10.2 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.next.1
%35 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%36 = trunc i64 %indvars.iv.next.1 to i32
%sub12.2 = sub i32 %sub.neg, %36
%idxprom13.2 = sext i32 %sub12.2 to i64
%arrayidx14.2 = getelementptr inbounds [200000 x i32], ptr %work, i64 0, i64 %idxprom13.2
store i32 %35, ptr %arrayidx14.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nsw i64 %indvars.iv, 3
%arrayidx10.3 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.next.2
%37 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%38 = trunc i64 %indvars.iv.next.2 to i32
%sub12.3 = sub i32 %sub.neg, %38
%idxprom13.3 = sext i32 %sub12.3 to i64
%arrayidx14.3 = getelementptr inbounds [200000 x i32], ptr %work, i64 0, i64 %idxprom13.3
store i32 %37, ptr %arrayidx14.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nsw i64 %indvars.iv, 4
%lftr.wideiv.3 = trunc i64 %indvars.iv.next.3 to i32
%exitcond.not.3 = icmp eq i32 %8, %lftr.wideiv.3
br i1 %exitcond.not.3, label %for.cond17.preheader, label %for.body8, !llvm.loop !15
for.body19: ; preds = %for.body19.preheader, %for.body19
%indvars.iv90 = phi i64 [ %29, %for.body19.preheader ], [ %indvars.iv.next91, %for.body19 ]
%i.186 = phi i32 [ %left, %for.body19.preheader ], [ %i.2, %for.body19 ]
%j.184 = phi i32 [ %right, %for.body19.preheader ], [ %j.2, %for.body19 ]
%idxprom20 = sext i32 %i.186 to i64
%arrayidx21 = getelementptr inbounds [200000 x i32], ptr %work, i64 0, i64 %idxprom20
%39 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%idxprom22 = sext i32 %j.184 to i64
%arrayidx23 = getelementptr inbounds [200000 x i32], ptr %work, i64 0, i64 %idxprom22
%40 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp sge i32 %39, %40
%.sink = tail call i32 @llvm.smin.i32(i32 %39, i32 %40)
%dec32 = sext i1 %cmp24 to i32
%j.2 = add nsw i32 %j.184, %dec32
%not.cmp24 = xor i1 %cmp24, true
%inc26 = zext i1 %not.cmp24 to i32
%i.2 = add nsw i32 %i.186, %inc26
%41 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv90
store i32 %.sink, ptr %41, align 4
%indvars.iv.next91 = add nsw i64 %indvars.iv90, 1
%lftr.wideiv93 = trunc i64 %indvars.iv.next91 to i32
%exitcond94.not = icmp eq i32 %30, %lftr.wideiv93
br i1 %exitcond94.not, label %cleanup, label %for.body19, !llvm.loop !16
cleanup: ; preds = %for.body19, %for.cond17.preheader, %entry
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %work) #6
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%A = alloca [200000 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %A) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 1
br i1 %cmp32, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%sub31 = add nsw i32 %0, -1
%.pre = sext i32 %sub31 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 [200000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%2 = sext i32 %sub to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%idxprom3.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
%arrayidx4 = getelementptr inbounds [200000 x i32], ptr %A, i64 0, i64 %idxprom3.pre-phi
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx4)
%3 = load i32, ptr %N, align 4, !tbaa !5
%sub6 = add nsw i32 %3, -1
call void @merge_sort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %sub6)
%smax = call i32 @llvm.smax.i32(i32 %sub6, i32 0)
%wide.trip.count = zext i32 %smax to i64
br label %for.cond7
for.cond7: ; preds = %for.body10, %for.end
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %for.body10 ], [ 0, %for.end ]
%exitcond.not = icmp eq i64 %indvars.iv36, %wide.trip.count
br i1 %exitcond.not, label %if.end23, label %for.body10
for.body10: ; preds = %for.cond7
%arrayidx12 = getelementptr inbounds [200000 x i32], ptr %A, i64 0, i64 %indvars.iv36
%4 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%arrayidx14 = getelementptr inbounds [200000 x i32], ptr %A, i64 0, i64 %indvars.iv.next37
%5 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp eq i32 %4, %5
br i1 %cmp15, label %if.end23, label %for.cond7, !llvm.loop !18
if.end23: ; preds = %for.cond7, %for.body10
%.str.3.sink = phi ptr [ @.str.2, %for.body10 ], [ @.str.3, %for.cond7 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %A) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include<stdio.h>
void Swap(int x[ ], int i, int j)
{
int temp;
temp = x[i];
x[i] = x[j];
x[j] = temp;
}
/* クイックソートを行う */
void QSort(int x[ ], int left, int right)
{
int i, j;
int pivot;
i = left; /* ソートする配列の一番小さい要素の添字 */
j = right; /* ソートする配列の一番大きい要素の添字 */
pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */
while (1) { /* 無限ループ */
while (x[i] < pivot) /* pivot より大きい値が */
i++; /* 出るまで i を増加させる */
while (pivot < x[j]) /* pivot より小さい値が */
j--; /* 出るまで j を減少させる */
if (i >= j) /* i >= j なら */
break; /* 無限ループから抜ける */
Swap(x, i, j); /* x[i] と x[j]を交換 */
i++; /* 次のデータ */
j--;
}
//ShowData(x, 10); /* 途中経過を表示 */
if (left < i - 1) /* 基準値の左に 2 以上要素があれば */
QSort(x, left, i - 1); /* 左の配列を Q ソートする */
if (j + 1 < right) /* 基準値の右に 2 以上要素があれば */
QSort(x, j + 1, right); /* 右の配列を Q ソートする */
}
int main(){
int n,i,j;
int a[200000];
scanf("%d",&n);
for(i = 0 ; i < n ; i++) scanf("%d",&a[i]);
QSort(a,0,n-1);
for(i = 0 ; i < n-1 ; i++){
if(a[i] == a[i+1]){
printf("NO\n");
return 0;
}
}
printf("YES\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247475/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247475/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @Swap(ptr nocapture noundef %x, i32 noundef %i, i32 noundef %j) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom1 = sext i32 %j to i64
%arrayidx2 = getelementptr inbounds i32, ptr %x, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
store i32 %0, ptr %arrayidx2, 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: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @QSort(ptr nocapture noundef %x, i32 noundef %left, i32 noundef %right) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end18, %entry
%left.tr = phi i32 [ %left, %entry ], [ %add19, %if.end18 ]
%add = add nsw i32 %left.tr, %right
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %if.end, %tailrecurse
%j.0 = phi i32 [ %right, %tailrecurse ], [ %dec13, %if.end ]
%i.0 = phi i32 [ %left.tr, %tailrecurse ], [ %inc12, %if.end ]
%1 = sext i32 %i.0 to i64
br label %while.cond1
while.cond1: ; preds = %while.cond1, %while.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond1 ], [ %1, %while.cond ]
%arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp = icmp slt i32 %2, %0
%indvars.iv.next = add i64 %indvars.iv, 1
br i1 %cmp, label %while.cond1, label %while.cond5.preheader, !llvm.loop !9
while.cond5.preheader: ; preds = %while.cond1
%arrayidx3.le = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%3 = trunc i64 %indvars.iv to i32
%4 = sext i32 %j.0 to i64
br label %while.cond5
while.cond5: ; preds = %while.cond5, %while.cond5.preheader
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %while.cond5 ], [ %4, %while.cond5.preheader ]
%arrayidx7 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv51
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp slt i32 %0, %5
%indvars.iv.next52 = add i64 %indvars.iv51, -1
br i1 %cmp8, label %while.cond5, label %while.end10, !llvm.loop !11
while.end10: ; preds = %while.cond5
%6 = trunc i64 %indvars.iv51 to i32
%cmp11.not = icmp slt i32 %3, %6
br i1 %cmp11.not, label %if.end, label %while.end14
if.end: ; preds = %while.end10
%arrayidx7.le = getelementptr inbounds i32, ptr %x, i64 %indvars.iv51
store i32 %5, ptr %arrayidx3.le, align 4, !tbaa !5
store i32 %2, ptr %arrayidx7.le, align 4, !tbaa !5
%inc12 = add nsw i32 %3, 1
%dec13 = add nsw i32 %6, -1
br label %while.cond
while.end14: ; preds = %while.end10
%sub = add nsw i32 %3, -1
%cmp15 = icmp sgt i32 %sub, %left.tr
br i1 %cmp15, label %if.then16, label %if.end18
if.then16: ; preds = %while.end14
tail call void @QSort(ptr noundef nonnull %x, i32 noundef %left.tr, i32 noundef %sub)
br label %if.end18
if.end18: ; preds = %if.then16, %while.end14
%add19 = add nsw i32 %6, 1
%cmp20 = icmp slt i32 %add19, %right
br i1 %cmp20, label %tailrecurse, label %if.end23
if.end23: ; preds = %if.end18
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%a = alloca [200000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %a) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%sub = add nsw i32 %.lcssa, -1
call void @QSort(ptr noundef nonnull %a, i32 noundef 0, i32 noundef %sub)
%smax = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%wide.trip.count = zext i32 %smax to i64
br label %for.cond2
for.cond2: ; preds = %for.body5, %for.end
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body5 ], [ 0, %for.end ]
%exitcond.not = icmp eq i64 %indvars.iv30, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body5
for.body5: ; preds = %for.cond2
%arrayidx7 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv30
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%arrayidx9 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv.next31
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %3, %4
br i1 %cmp10, label %cleanup, label %for.cond2, !llvm.loop !13
cleanup: ; preds = %for.cond2, %for.body5
%str.sink = phi ptr [ @str.3, %for.body5 ], [ @str, %for.cond2 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %a) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
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 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int isPrime(int p) {
int i=0;
if(p < 2) {
return 0;
} else if (p ==2) {
return 1;
}
else if (p % 2 == 0) {
return 0;
}
for(i = 3; i * i <=p;i+=2) {
if(p%i==0) {
return 0;
}
}
return 1;
}
int main(void) {
int n,p,i,cnt=0;
scanf("%d",&n);
for ( i = 0; i < n; i++) {
scanf("%d", &p);
if (isPrime(p)==1) {
cnt++;
}
}
printf("%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247525/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247525/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrime(i32 noundef %p) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %p, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %p, 2
br i1 %cmp1, label %cleanup, label %if.else3
if.else3: ; preds = %if.else
%rem = and i32 %p, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else3
%cmp8.not20 = icmp ult i32 %p, 9
br i1 %cmp8.not20, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.021, 2
%mul = mul nsw i32 %add, %add
%cmp8.not = icmp sgt i32 %mul, %p
br i1 %cmp8.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.021 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem9 = srem i32 %p, %i.021
%cmp10 = icmp eq i32 %rem9, 0
br i1 %cmp10, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.else3, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.else3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
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 i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%cnt.013 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%i.012 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%1 = load i32, ptr %p, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %for.cond, label %if.else.i
if.else.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %1, 2
br i1 %cmp1.i, label %isPrime.exit, label %if.else3.i
if.else3.i: ; preds = %if.else.i
%rem.i = and i32 %1, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.else3.i
%cmp8.not20.i = icmp ult i32 %1, 9
br i1 %cmp8.not20.i, label %isPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp8.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp8.not.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.021.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem9.i = srem i32 %1, %i.021.i
%cmp10.i = icmp eq i32 %rem9.i, 0
br i1 %cmp10.i, label %for.cond, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %if.else.i, %for.cond.preheader.i
%inc = add nsw i32 %cnt.013, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.else3.i, %for.body, %isPrime.exit
%2 = phi i32 [ %inc, %isPrime.exit ], [ %cnt.013, %for.body ], [ %cnt.013, %if.else3.i ], [ %cnt.013, %for.body.i ]
%inc4 = add nuw nsw i32 %i.012, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc4, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
#include<math.h>
#include <stdbool.h>
bool xprime(int x){
int j=3;
if(x==2){
return true;
}
if(x<2||x%2==0){
return false;
}
while(j<=sqrt(x)){
if(x%j==0){
return false;
}
j+=2;
}
return true;
}
int main(void){
// Your code here!
int n,x[10000],cnt=0;
bool b;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&x[i]);
b=xprime(x[i]);
if(b){
cnt++;
}
}
printf("%d\n",cnt);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247569/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247569/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 memory(write) uwtable
define dso_local zeroext i1 @xprime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %j.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !5
while.body: ; preds = %while.cond.preheader, %while.cond
%j.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %j.021
%cmp9.not = icmp ne i32 %rem8, 0
br i1 %cmp9.not, label %while.cond, label %cleanup
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i1 [ true, %entry ], [ false, %if.end ], [ true, %while.cond.preheader ], [ %cmp9.not, %while.cond ], [ %cmp9.not, %while.body ]
ret i1 %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 nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%x = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %xprime.exit, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %2, %xprime.exit ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %xprime.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %xprime.exit ], [ 0, %entry ]
%cnt.015 = phi i32 [ %2, %xprime.exit ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !7
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %.loopexit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %xprime.exit, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %.loopexit, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %j.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %.loopexit, label %while.body.i, !llvm.loop !5
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%j.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %j.021.i
%cmp9.not.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.not.i, label %xprime.exit, label %while.cond.i
.loopexit: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc12 = add nsw i32 %cnt.015, 1
br label %xprime.exit
xprime.exit: ; preds = %while.body.i, %if.end.i, %.loopexit
%2 = phi i32 [ %inc12, %.loopexit ], [ %cnt.015, %if.end.i ], [ %cnt.015, %while.body.i ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
//#include <iostream>
#include <string.h>
//#include <vector>
#include <stdio.h>
#include <stdlib.h>
//using namespace std;
//vector <char> v;
int main()
{
char s[2001];
// string::iterator it;
char c[2001];
int n,i=0;
scanf("%d",&n);
scanf("%s",s);
int t=n-2;
// cin >> s;
while (t>=0)
{
printf("%c",s[t]) ;
t-=2;
i++;
}
if (n%2==0)
t=1;
else
t=0;
while (t<n)
{
printf("%c",s[t]) ;
//cout << s[t];
i++;
t+=2;
}
//cin >> s1[t];
//for (int i=0;i<v.size();i++)
//for (int i=0;i<s1.length();i++)
//cout << s1[i];
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24767/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24767/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%s = alloca [2001 x i8], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2001, ptr nonnull %s) #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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 1
br i1 %cmp23, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%t.0.in24 = phi i32 [ %t.0, %while.body ], [ %0, %entry ]
%t.0 = add nsw i32 %t.0.in24, -2
%idxprom = zext i32 %t.0 to i64
%arrayidx = getelementptr inbounds [2001 x i8], ptr %s, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv = sext i8 %1 to i32
%putchar22 = call i32 @putchar(i32 %conv)
%cmp = icmp ugt i32 %t.0.in24, 3
br i1 %cmp, label %while.body, label %while.end.loopexit, !llvm.loop !10
while.end.loopexit: ; preds = %while.body
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%2 = phi i32 [ %.pre, %while.end.loopexit ], [ %0, %entry ]
%3 = and i32 %2, 1
%. = xor i32 %3, 1
%cmp725 = icmp slt i32 %., %2
br i1 %cmp725, label %while.body9.preheader, label %while.end15
while.body9.preheader: ; preds = %while.end
%4 = and i32 %2, 1
%.not = icmp eq i32 %4, 0
%5 = zext i1 %.not to i64
br label %while.body9
while.body9: ; preds = %while.body9.preheader, %while.body9
%indvars.iv = phi i64 [ %5, %while.body9.preheader ], [ %indvars.iv.next, %while.body9 ]
%arrayidx11 = getelementptr inbounds [2001 x i8], ptr %s, i64 0, i64 %indvars.iv
%6 = load i8, ptr %arrayidx11, align 1, !tbaa !9
%conv12 = sext i8 %6 to i32
%putchar = call i32 @putchar(i32 %conv12)
%indvars.iv.next = add nuw i64 %indvars.iv, 2
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = trunc i64 %indvars.iv.next to i32
%cmp7 = icmp sgt i32 %7, %8
br i1 %cmp7, label %while.body9, label %while.end15, !llvm.loop !12
while.end15: ; preds = %while.body9, %while.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 2001, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 a,b,c;
int na,nb,nc;
int n;
scanf("%d %d %d",&a,&b,&c);
na=a;
nb=b/2;
nc=c/4;
n=na;
if(nb<n)
n=nb;
if(nc<n)
n=nc;
if(n<=0)
printf("0\n");
else
printf("%d\n",7*n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24772/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24772/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.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
%c = 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 = 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 %b, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%2 = load i32, ptr %c, align 4, !tbaa !5
%div1 = sdiv i32 %2, 4
%spec.select = call i32 @llvm.smin.i32(i32 %div, i32 %0)
%n.1 = call i32 @llvm.smin.i32(i32 %div1, i32 %spec.select)
%cmp5 = icmp slt i32 %n.1, 1
br i1 %cmp5, label %if.then6, label %if.else
if.then6: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end9
if.else: ; preds = %entry
%mul = mul nuw nsw i32 %n.1, 7
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul)
br label %if.end9
if.end9: ; preds = %if.else, %if.then6
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
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree 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"}
|
#include <stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int num,N,Count=0,i,j;
scanf("%d",&num);
for(i=0; i<num; i++){
scanf("%d",&N);
if(N==1) Count+=1;
else{
for(j=2; j<=sqrt(N); j++){
if(N%j==0 && N!=2){
Count+=1;
break;
}
}
}
}
printf("%d\n",num-Count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247763/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247763/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #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 %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end18
for.body: ; preds = %entry, %for.inc16
%i.031 = phi i32 [ %inc17, %for.inc16 ], [ 0, %entry ]
%Count.030 = phi i32 [ %Count.1, %for.inc16 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp2 = icmp eq i32 %1, 1
br i1 %cmp2, label %if.then, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body
%conv425 = sitofp i32 %1 to double
%call526 = call double @sqrt(double noundef %conv425) #4
%cmp627 = fcmp ult double %call526, 2.000000e+00
br i1 %cmp627, label %for.inc16, label %for.body8
if.then: ; preds = %for.body
%add = add nsw i32 %Count.030, 1
br label %for.inc16
for.cond3: ; preds = %for.body8
%inc = add nuw nsw i32 %j.028, 1
%conv = sitofp i32 %inc to double
%conv4 = sitofp i32 %2 to double
%call5 = call double @sqrt(double noundef %conv4) #4
%cmp6 = fcmp ult double %call5, %conv
br i1 %cmp6, label %for.inc16, label %for.body8, !llvm.loop !9
for.body8: ; preds = %for.cond3.preheader, %for.cond3
%j.028 = phi i32 [ %inc, %for.cond3 ], [ 2, %for.cond3.preheader ]
%2 = load i32, ptr %N, align 4
%rem = srem i32 %2, %j.028
%cmp9 = icmp eq i32 %rem, 0
%cmp11 = icmp ne i32 %2, 2
%or.cond = and i1 %cmp11, %cmp9
br i1 %or.cond, label %if.then13, label %for.cond3
if.then13: ; preds = %for.body8
%add14 = add nsw i32 %Count.030, 1
br label %for.inc16
for.inc16: ; preds = %for.cond3, %for.cond3.preheader, %if.then, %if.then13
%Count.1 = phi i32 [ %add, %if.then ], [ %add14, %if.then13 ], [ %Count.030, %for.cond3.preheader ], [ %Count.030, %for.cond3 ]
%inc17 = add nuw nsw i32 %i.031, 1
%3 = load i32, ptr %num, align 4, !tbaa !5
%cmp = icmp slt i32 %inc17, %3
br i1 %cmp, label %for.body, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.inc16, %entry
%Count.0.lcssa = phi i32 [ 0, %entry ], [ %Count.1, %for.inc16 ]
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.inc16 ]
%sub = sub nsw i32 %.lcssa, %Count.0.lcssa
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
//Prime
#include<stdio.h>
int Isprime(int x){
int i;
if( x < 2) return 0;
else if(x == 2 || x == 3) return 1;
else if(x % 2 == 0) return 0;
else if(x % 3 == 0) return 0;
for(i = 5; i * i <= x; i += 2){
if(x % i == 0) return 0;
}
return 1;
}
int main(void){
int i;
int n, x;
int count = 0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &x);
if(Isprime(x)) count++;
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247806/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247806/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @Isprime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%0 = and i32 %x, -2
%or.cond = icmp eq i32 %0, 2
br i1 %or.cond, label %cleanup, label %if.else4
if.else4: ; preds = %if.else
%rem = and i32 %x, 1
%cmp5 = icmp eq i32 %rem, 0
%rem8 = urem i32 %x, 3
%cmp9 = icmp eq i32 %rem8, 0
%or.cond28 = or i1 %cmp5, %cmp9
br i1 %or.cond28, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else4
%cmp14.not29 = icmp ult i32 %x, 25
br i1 %cmp14.not29, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.030, 2
%mul = mul nsw i32 %add, %add
%cmp14.not = icmp sgt i32 %mul, %x
br i1 %cmp14.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.030 = phi i32 [ %add, %for.cond ], [ 5, %for.cond.preheader ]
%rem15 = srem i32 %x, %i.030
%cmp16 = icmp eq i32 %rem15, 0
br i1 %cmp16, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.else4, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.else4 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
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
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%count.012 = phi i32 [ %3, %for.cond ], [ 0, %entry ]
%i.011 = phi i32 [ %inc3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %for.cond, label %if.else.i
if.else.i: ; preds = %for.body
%2 = and i32 %1, -2
%or.cond.i = icmp eq i32 %2, 2
br i1 %or.cond.i, label %Isprime.exit, label %if.else4.i
if.else4.i: ; preds = %if.else.i
%rem.i = and i32 %1, 1
%cmp5.i = icmp eq i32 %rem.i, 0
%rem8.i = urem i32 %1, 3
%cmp9.i = icmp eq i32 %rem8.i, 0
%or.cond28.i = or i1 %cmp5.i, %cmp9.i
br i1 %or.cond28.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.else4.i
%cmp14.not29.i = icmp ult i32 %1, 25
br i1 %cmp14.not29.i, label %Isprime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.030.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp14.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp14.not.i, label %Isprime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.030.i = phi i32 [ %add.i, %for.cond.i ], [ 5, %for.cond.preheader.i ]
%rem15.i = srem i32 %1, %i.030.i
%cmp16.i = icmp eq i32 %rem15.i, 0
br i1 %cmp16.i, label %for.cond, label %for.cond.i
Isprime.exit: ; preds = %for.cond.i, %if.else.i, %for.cond.preheader.i
%inc = add nsw i32 %count.012, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.else4.i, %for.body, %Isprime.exit
%3 = phi i32 [ %inc, %Isprime.exit ], [ %count.012, %for.body ], [ %count.012, %if.else4.i ], [ %count.012, %for.body.i ]
%inc3 = add nuw nsw i32 %i.011, 1
%4 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc3, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %3, %for.cond ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include<stdio.h>
int main(void){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
int d = a;
if(b/2 < d)
d = b/2;
if(c/4 < d)
d = c/4;
printf("%d\n",7*d);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24785/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24785/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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 %b, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%spec.select = call i32 @llvm.smin.i32(i32 %div, i32 %0)
%2 = load i32, ptr %c, align 4, !tbaa !5
%div2 = sdiv i32 %2, 4
%d.1 = call i32 @llvm.smin.i32(i32 %div2, i32 %spec.select)
%mul = mul nsw i32 %d.1, 7
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
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.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main()
{
int n, m=0, i, j, a[10000];
scanf("%d", &n);
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
for(i=0; i<n; i++)
{
if(a[i]%2 == 0)
{
if(a[i] == 2) m++;
continue;
}
j = 3;
while(j <= sqrt(a[i]))
{
if(a[i]%j == 0)
{
m--;
break;
}
j += 2;
}
m++;
}
printf("%d\n", m);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247893/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247893/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%a = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.end30
for.cond2.preheader: ; preds = %for.body
%cmp351 = icmp sgt i32 %1, 0
br i1 %cmp351, label %for.body4, label %for.end30
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.inc28
%3 = phi i32 [ %7, %for.inc28 ], [ %1, %for.cond2.preheader ]
%indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.inc28 ], [ 0, %for.cond2.preheader ]
%m.052 = phi i32 [ %m.2, %for.inc28 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv55
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%5 = and i32 %4, 1
%cmp7 = icmp eq i32 %5, 0
br i1 %cmp7, label %if.then, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body4
%conv1647 = sitofp i32 %4 to double
%call1748 = call double @sqrt(double noundef %conv1647) #4
%cmp1849 = fcmp ult double %call1748, 3.000000e+00
br i1 %cmp1849, label %while.end, label %while.body
if.then: ; preds = %for.body4
%cmp10 = icmp eq i32 %4, 2
%inc12 = zext i1 %cmp10 to i32
%spec.select = add nsw i32 %m.052, %inc12
br label %for.inc28
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %j.050, 2
%conv = sitofp i32 %add to double
%conv16 = sitofp i32 %6 to double
%call17 = call double @sqrt(double noundef %conv16) #4
%cmp18 = fcmp ult double %call17, %conv
br i1 %cmp18, label %while.end, label %while.body, !llvm.loop !11
while.body: ; preds = %while.cond.preheader, %while.cond
%j.050 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%rem22 = srem i32 %6, %j.050
%cmp23 = icmp eq i32 %rem22, 0
br i1 %cmp23, label %if.then25, label %while.cond
if.then25: ; preds = %while.body
%dec = add nsw i32 %m.052, -1
br label %while.end
while.end: ; preds = %while.cond, %while.cond.preheader, %if.then25
%m.1 = phi i32 [ %dec, %if.then25 ], [ %m.052, %while.cond.preheader ], [ %m.052, %while.cond ]
%inc27 = add nsw i32 %m.1, 1
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc28
for.inc28: ; preds = %if.then, %while.end
%7 = phi i32 [ %.pre, %while.end ], [ %3, %if.then ]
%m.2 = phi i32 [ %inc27, %while.end ], [ %spec.select, %if.then ]
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next56, %8
br i1 %cmp3, label %for.body4, label %for.end30, !llvm.loop !12
for.end30: ; preds = %for.inc28, %entry, %for.cond2.preheader
%m.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %m.2, %for.inc28 ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %m.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
#define N 10000
int prime(int);
int main()
{
int A[N], i, p, number, count=0;
scanf("%d", &number);
for( i=0 ; i<number ; i++ ){
scanf("%d", &A[i]);
p = prime(A[i]);
if( p==1 ) count++;
}
printf("%d\n", count);
return 0;
}
int prime(int a)
{
int i;
if( a==2 ) return 1;
if( a<2 || a%2==0 ) return 0;
i = 3;
while( i<=sqrt(a) ){
if( a%i==0 ) return 0;
i = i+2;
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_247936/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_247936/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10000 x i32], align 16
%number = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%0 = load i32, ptr %number, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%count.017 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %prime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %prime.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %prime.exit.thread, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %while.cond.i
prime.exit.thread: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc14 = add nsw i32 %count.017, 1
br label %for.cond
for.cond: ; preds = %while.body.i, %if.end.i, %prime.exit.thread
%2 = phi i32 [ %inc14, %prime.exit.thread ], [ %count.017, %if.end.i ], [ %count.017, %while.body.i ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %number, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %number) #5
call void @llvm.lifetime.end.p0(i64 40000, 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 memory(write) uwtable
define dso_local i32 @prime(i32 noundef %a) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %a, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %a, 2
%rem = and i32 %a, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %a to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %a, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int a,b,c,i;
scanf("%d%d%d",&a,&b,&c);
for(i=0;i<1000;i++){
if(a>=i&&b>=2*i&&c>=4*i){
}
else{
break;
}
}
printf("%d",7*(i-1));
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24798/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24798/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%cmp1.not13 = icmp slt i32 %0, 0
br i1 %cmp1.not13, label %for.end, label %land.lhs.true.lr.ph
land.lhs.true.lr.ph: ; preds = %entry
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4
%umin = call i32 @llvm.umin.i32(i32 %0, i32 999)
%3 = add nuw nsw i32 %umin, 1
br label %land.lhs.true
land.lhs.true: ; preds = %land.lhs.true.lr.ph, %for.inc
%i.014 = phi i32 [ 0, %land.lhs.true.lr.ph ], [ %inc, %for.inc ]
%mul = shl nuw nsw i32 %i.014, 1
%cmp2.not = icmp slt i32 %1, %mul
%mul4 = shl nuw nsw i32 %i.014, 2
%cmp5.not = icmp slt i32 %2, %mul4
%or.cond17 = select i1 %cmp2.not, i1 true, i1 %cmp5.not
br i1 %or.cond17, label %for.end.loopexit, label %for.inc
for.inc: ; preds = %land.lhs.true
%inc = add nuw nsw i32 %i.014, 1
%exitcond = icmp eq i32 %i.014, %umin
br i1 %exitcond, label %for.end.loopexit, label %land.lhs.true, !llvm.loop !9
for.end.loopexit: ; preds = %land.lhs.true, %for.inc
%i.0.lcssa.ph = phi i32 [ %3, %for.inc ], [ %i.014, %land.lhs.true ]
%4 = mul i32 %i.0.lcssa.ph, 7
%5 = add i32 %4, -7
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i32 [ -7, %entry ], [ %5, %for.end.loopexit ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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.umin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int PrimeJudge(int);
#define N 10000
int main(){
int i,n,flg,prime=0,num[N];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&num[i]);
flg=PrimeJudge(num[i]);
if(flg==0) prime++;
}
printf("%d\n",prime);
return 0;
}
int PrimeJudge(int data){
int i=3;
if(data==2) return 0;
if(data<2 || data%2==0) return -1;
while(i<=sqrt(data)){
if(data%i==0) return -1;
i=i+2;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248029/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248029/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%num = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %PrimeJudge.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %PrimeJudge.exit ], [ 0, %entry ]
%prime.018 = phi i32 [ %2, %PrimeJudge.exit ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %.loopexit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %PrimeJudge.exit, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %.loopexit, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %.loopexit, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %PrimeJudge.exit, label %while.cond.i
.loopexit: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc14 = add nsw i32 %prime.018, 1
br label %PrimeJudge.exit
PrimeJudge.exit: ; preds = %while.body.i, %if.end.i, %.loopexit
%2 = phi i32 [ %inc14, %.loopexit ], [ %prime.018, %if.end.i ], [ %prime.018, %while.body.i ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %PrimeJudge.exit, %entry
%prime.0.lcssa = phi i32 [ 0, %entry ], [ %2, %PrimeJudge.exit ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %prime.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %num) #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 memory(write) uwtable
define dso_local i32 @PrimeJudge(i32 noundef %data) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %data, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %data, 2
%rem = and i32 %data, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %data to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %data, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ -1, %if.end ], [ 0, %while.cond.preheader ], [ -1, %while.body ], [ 0, %while.cond ]
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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
#define NUMBER 10000
int main()
{
int n, m;
int ans = 0;
int i = 0;
int array[NUMBER];
scanf("%d", &n);
do {
scanf("%d", &array[i]);
++i;
} while (i < n);
for (i = 0; i < n; ++i){
m = 2;
while (m < sqrt(array[i])){
if (array[i] % m == 0)
break;
else
++m;
}
if(array[i] != 1 && m > sqrt(array[i]))
++ans;
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248072/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248072/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%array = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %array) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
br label %do.body
do.body: ; preds = %do.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %do.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %array, 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
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = sext i32 %0 to i64
%cmp = icmp slt i64 %indvars.iv.next, %1
br i1 %cmp, label %do.body, label %for.cond.preheader, !llvm.loop !9
for.cond.preheader: ; preds = %do.body
%cmp251 = icmp sgt i32 %0, 0
br i1 %cmp251, label %while.cond.preheader, label %for.end
while.cond.preheader: ; preds = %for.cond.preheader, %for.inc
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.inc ], [ 0, %for.cond.preheader ]
%ans.052 = phi i32 [ %ans.1, %for.inc ], [ 0, %for.cond.preheader ]
%arrayidx4 = getelementptr inbounds [10000 x i32], ptr %array, i64 0, i64 %indvars.iv59
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%conv545 = sitofp i32 %2 to double
%call646 = call double @sqrt(double noundef %conv545) #4
%cmp747 = fcmp ogt double %call646, 2.000000e+00
br i1 %cmp747, label %while.body.preheader, label %while.endthread-pre-split
while.body.preheader: ; preds = %while.cond.preheader
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%4 = and i32 %3, 1
%cmp1171 = icmp eq i32 %4, 0
br i1 %cmp1171, label %while.end, label %while.cond
while.cond: ; preds = %while.body.preheader, %while.body
%5 = phi i32 [ %6, %while.body ], [ %3, %while.body.preheader ]
%m.04872 = phi i32 [ %inc13, %while.body ], [ 2, %while.body.preheader ]
%inc13 = add nuw nsw i32 %m.04872, 1
%conv = sitofp i32 %inc13 to double
%conv5 = sitofp i32 %5 to double
%call6 = call double @sqrt(double noundef %conv5) #4
%cmp7 = fcmp ogt double %call6, %conv
br i1 %cmp7, label %while.body, label %while.endthread-pre-split, !llvm.loop !11
while.body: ; preds = %while.cond
%6 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%rem = srem i32 %6, %inc13
%cmp11 = icmp eq i32 %rem, 0
br i1 %cmp11, label %while.end, label %while.cond, !llvm.loop !11
while.endthread-pre-split: ; preds = %while.cond, %while.cond.preheader
%conv.lcssa = phi double [ 2.000000e+00, %while.cond.preheader ], [ %conv, %while.cond ]
%.pr = load i32, ptr %arrayidx4, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.body, %while.body.preheader, %while.endthread-pre-split
%conv44 = phi double [ %conv.lcssa, %while.endthread-pre-split ], [ 2.000000e+00, %while.body.preheader ], [ %conv, %while.body ]
%7 = phi i32 [ %.pr, %while.endthread-pre-split ], [ %3, %while.body.preheader ], [ %6, %while.body ]
%cmp16.not = icmp eq i32 %7, 1
br i1 %cmp16.not, label %for.inc, label %land.lhs.true
land.lhs.true: ; preds = %while.end
%conv21 = sitofp i32 %7 to double
%call22 = call double @sqrt(double noundef %conv21) #4
%cmp23 = fcmp olt double %call22, %conv44
br i1 %cmp23, label %if.then25, label %for.inc
if.then25: ; preds = %land.lhs.true
%inc26 = add nsw i32 %ans.052, 1
br label %for.inc
for.inc: ; preds = %while.end, %land.lhs.true, %if.then25
%ans.1 = phi i32 [ %inc26, %if.then25 ], [ %ans.052, %land.lhs.true ], [ %ans.052, %while.end ]
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp2 = icmp slt i64 %indvars.iv.next60, %9
br i1 %cmp2, label %while.cond.preheader, label %for.end, !llvm.loop !12
for.end: ; preds = %for.inc, %for.cond.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %ans.1, %for.inc ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %array) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
int n;
int i,j,count=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
for(j=2;j<sqrt(a[i])+1;j++){
if(a[i]==2){
break;
}
if(a[i]%j==0){
count++;
break;
}
}
}
printf("%d\n",n-count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248115/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248115/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %3, 0
br i1 %cmp39, label %for.body, label %for.end23
for.body: ; preds = %entry, %for.inc21
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc21 ], [ 0, %entry ]
%count.040 = phi i32 [ %count.1, %for.inc21 ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv534 = sitofp i32 %4 to double
%call635 = call double @sqrt(double noundef %conv534) #5
%add36 = fadd double %call635, 1.000000e+00
%cmp737 = fcmp ogt double %add36, 2.000000e+00
br i1 %cmp737, label %for.body9, label %for.inc21
for.cond2: ; preds = %if.end
%inc20 = add nuw nsw i32 %j.038, 1
%conv = sitofp i32 %inc20 to double
%conv5 = sitofp i32 %5 to double
%call6 = call double @sqrt(double noundef %conv5) #5
%add = fadd double %call6, 1.000000e+00
%cmp7 = fcmp ogt double %add, %conv
br i1 %cmp7, label %for.body9, label %for.inc21, !llvm.loop !9
for.body9: ; preds = %for.body, %for.cond2
%j.038 = phi i32 [ %inc20, %for.cond2 ], [ 2, %for.body ]
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp12 = icmp eq i32 %5, 2
br i1 %cmp12, label %for.inc21, label %if.end
if.end: ; preds = %for.body9
%rem = srem i32 %5, %j.038
%cmp16 = icmp eq i32 %rem, 0
br i1 %cmp16, label %if.then18, label %for.cond2
if.then18: ; preds = %if.end
%inc = add nsw i32 %count.040, 1
br label %for.inc21
for.inc21: ; preds = %for.body9, %for.cond2, %for.body, %if.then18
%count.1 = phi i32 [ %inc, %if.then18 ], [ %count.040, %for.body ], [ %count.040, %for.cond2 ], [ %count.040, %for.body9 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end23, !llvm.loop !11
for.end23: ; preds = %for.inc21, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1, %for.inc21 ]
%.lcssa = phi i32 [ %3, %entry ], [ %6, %for.inc21 ]
%sub = sub nsw i32 %.lcssa, %count.0.lcssa
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include<math.h>
int main(void){
int n,i,j,sosu=0,not_sosu=0;
int N[10000];
//最初の行読み込み
scanf("%d",&n);
//続くn個の読み込み
for(i=1; i<=n; i++){
scanf("%d",&N[i]);
}
//素数判定
for(i=1; i<=n; i++){
for(j=2; j<=(int)(sqrt(N[i])); j++){
not_sosu = 0;
if(N[i]%j==0){
not_sosu=1;
break;
}
}
if(not_sosu==0) sosu++;
}
//printf("%d番目の%dは%d\n",i,N[i],not_sosu);
printf("%d\n", sosu);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248166/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248166/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%N = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40000, 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
%cmp.not44 = icmp slt i32 %0, 1
br i1 %cmp.not44, label %for.end27, label %for.body
for.cond2.preheader: ; preds = %for.body
%1 = icmp slt i32 %2, 1
br i1 %1, label %for.end27, label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %N, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %for.end19.thread
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.end19.thread ], [ 1, %for.cond2.preheader ]
%not_sosu.054 = phi i32 [ %not_sosu.242, %for.end19.thread ], [ 0, %for.cond2.preheader ]
%sosu.053 = phi i32 [ %6, %for.end19.thread ], [ 0, %for.cond2.preheader ]
%arrayidx7 = getelementptr inbounds [10000 x i32], ptr %N, i64 0, i64 %indvars.iv56
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%conv46 = sitofp i32 %4 to double
%call847 = call double @sqrt(double noundef %conv46) #4
%conv948 = fptosi double %call847 to i32
%cmp10.not49 = icmp slt i32 %conv948, 2
br i1 %cmp10.not49, label %for.end19, label %for.body12
for.cond5: ; preds = %for.body12
%inc18 = add nuw nsw i32 %j.050, 1
%conv = sitofp i32 %5 to double
%call8 = call double @sqrt(double noundef %conv) #4
%conv9 = fptosi double %call8 to i32
%cmp10.not.not = icmp slt i32 %j.050, %conv9
br i1 %cmp10.not.not, label %for.body12, label %for.end19, !llvm.loop !11
for.body12: ; preds = %for.cond5.preheader, %for.cond5
%j.050 = phi i32 [ %inc18, %for.cond5 ], [ 2, %for.cond5.preheader ]
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%rem = srem i32 %5, %j.050
%cmp15 = icmp eq i32 %rem, 0
br i1 %cmp15, label %for.end19.thread, label %for.cond5
for.end19: ; preds = %for.cond5, %for.cond5.preheader
%not_sosu.1.lcssa = phi i32 [ %not_sosu.054, %for.cond5.preheader ], [ 0, %for.cond5 ]
%cmp20 = icmp eq i32 %not_sosu.1.lcssa, 0
%inc23 = zext i1 %cmp20 to i32
%spec.select = add nsw i32 %sosu.053, %inc23
br label %for.end19.thread
for.end19.thread: ; preds = %for.body12, %for.end19
%not_sosu.242 = phi i32 [ %not_sosu.1.lcssa, %for.end19 ], [ 1, %for.body12 ]
%6 = phi i32 [ %spec.select, %for.end19 ], [ %sosu.053, %for.body12 ]
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv56, %8
br i1 %cmp3.not.not, label %for.cond5.preheader, label %for.end27, !llvm.loop !12
for.end27: ; preds = %for.end19.thread, %entry, %for.cond2.preheader
%sosu.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %6, %for.end19.thread ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sosu.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
/*
*
* so-suu
*/
#include<stdio.h>
#include<math.h>
int A[10000];
int main(void){
int num=0, length, i, j, sq, flag;
scanf("%d", &length);
for(i=0; i<length; i++){
scanf("%d",&A[i]);
}
for(i=0; i<length; i++){
flag = 0;
sq = (int)sqrt(A[i]);
for(j=2; j<=sq; j++){
if((A[i]%j) == 0){
flag = 1;
break;
}
}
if(!flag)num++;
}
printf("%d\n",num);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248209/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248209/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@A = dso_local global [10000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%length = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %length) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %length)
%0 = load i32, ptr %length, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %0, 0
br i1 %cmp36, label %for.body, label %for.end25
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end25
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %length, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.end19
%indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.end19 ], [ 0, %for.cond2.preheader ]
%num.044 = phi i32 [ %spec.select, %for.end19 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr @A, i64 0, i64 %indvars.iv47
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%conv = sitofp i32 %4 to double
%call7 = call double @sqrt(double noundef %conv) #4
%conv8 = fptosi double %call7 to i32
%cmp10.not38 = icmp slt i32 %conv8, 2
br i1 %cmp10.not38, label %for.end19, label %for.body12.lr.ph
for.body12.lr.ph: ; preds = %for.body4
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%6 = and i32 %5, 1
%cmp1552 = icmp eq i32 %6, 0
br i1 %cmp1552, label %for.end19, label %for.cond9
for.cond9: ; preds = %for.body12.lr.ph, %for.body12
%j.03953 = phi i32 [ %inc18, %for.body12 ], [ 2, %for.body12.lr.ph ]
%exitcond = icmp eq i32 %j.03953, %conv8
br i1 %exitcond, label %for.end19.loopexit, label %for.body12, !llvm.loop !11
for.body12: ; preds = %for.cond9
%inc18 = add nuw i32 %j.03953, 1
%rem = srem i32 %5, %inc18
%cmp15 = icmp eq i32 %rem, 0
br i1 %cmp15, label %for.end19.loopexit, label %for.cond9, !llvm.loop !11
for.end19.loopexit: ; preds = %for.cond9, %for.body12
%cmp10.not.le = icmp sge i32 %j.03953, %conv8
br label %for.end19
for.end19: ; preds = %for.end19.loopexit, %for.body12.lr.ph, %for.body4
%cmp10.not.lcssa = phi i1 [ true, %for.body4 ], [ false, %for.body12.lr.ph ], [ %cmp10.not.le, %for.end19.loopexit ]
%inc21 = zext i1 %cmp10.not.lcssa to i32
%spec.select = add nuw nsw i32 %num.044, %inc21
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%7 = load i32, ptr %length, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next48, %8
br i1 %cmp3, label %for.body4, label %for.end25, !llvm.loop !12
for.end25: ; preds = %for.end19, %entry, %for.cond2.preheader
%num.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %spec.select, %for.end19 ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %num.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %length) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int num = 0;
int *data;
int i;
int k;
int count = 0;
int finalans = 0;
while(1){
scanf("%d",&num);
if(1 <= num && num <=10000){
break;
}
}
data = (int *)malloc(sizeof(int)*num);
for(i = 0;i < num;i++){
scanf("%d",&data[i]);
if(data[i] > 2 && data[i] % 2 == 0){
continue;
}
for(k = 1;k <= sqrt(data[i]);k++){
if(data[i] % k == 0){
count++;
}
}
if(count == 1){
finalans++;
}
count = 0;
}
printf("%d",finalans);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248252/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248252/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6
store i32 0, ptr %num, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 10000
br i1 %or.cond, label %for.body.preheader, label %while.cond
for.body.preheader: ; preds = %while.cond
%conv = zext i32 %0 to i64
%mul = shl nuw nsw i64 %conv, 2
%call2 = call noalias ptr @malloc(i64 noundef %mul) #7
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc39
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc39 ]
%finalans.068 = phi i32 [ 0, %for.body.preheader ], [ %finalans.2, %for.inc39 ]
%arrayidx = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %2, 2
%rem = and i32 %2, 1
%cmp13 = icmp eq i32 %rem, 0
%or.cond59 = and i1 %cmp8, %cmp13
br i1 %or.cond59, label %for.inc39, label %for.cond17.preheader
for.cond17.preheader: ; preds = %for.body
%conv2161 = sitofp i32 %2 to double
%call2262 = call double @sqrt(double noundef %conv2161) #6
%cmp2363 = fcmp ult double %call2262, 1.000000e+00
br i1 %cmp2363, label %for.end, label %for.body25
for.body25: ; preds = %for.cond17.preheader, %for.body25
%count.165 = phi i32 [ %spec.select, %for.body25 ], [ 0, %for.cond17.preheader ]
%k.064 = phi i32 [ %inc33, %for.body25 ], [ 1, %for.cond17.preheader ]
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%rem28 = srem i32 %3, %k.064
%cmp29 = icmp eq i32 %rem28, 0
%inc = zext i1 %cmp29 to i32
%spec.select = add nuw nsw i32 %count.165, %inc
%inc33 = add nuw nsw i32 %k.064, 1
%conv18 = sitofp i32 %inc33 to double
%conv21 = sitofp i32 %3 to double
%call22 = call double @sqrt(double noundef %conv21) #6
%cmp23 = fcmp ult double %call22, %conv18
br i1 %cmp23, label %for.end, label %for.body25, !llvm.loop !9
for.end: ; preds = %for.body25, %for.cond17.preheader
%count.1.lcssa = phi i32 [ 0, %for.cond17.preheader ], [ %spec.select, %for.body25 ]
%cmp34 = icmp eq i32 %count.1.lcssa, 1
%inc37 = zext i1 %cmp34 to i32
%spec.select60 = add nsw i32 %finalans.068, %inc37
br label %for.inc39
for.inc39: ; preds = %for.body, %for.end
%finalans.2 = phi i32 [ %spec.select60, %for.end ], [ %finalans.068, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %num, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp3, label %for.body, label %for.end41, !llvm.loop !11
for.end41: ; preds = %for.inc39
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %finalans.2)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
#define N 10000
int main(){
int i,j,n,count;
int kazu;
scanf("%d",&n);
count = n;
for(i=0;i<n;i++){
scanf("%d",&kazu);
if(kazu == 2){
continue;
}
else if(kazu%2==0){
count--;
continue;
}
for(j=3;j<=sqrt(kazu);j+=2){
if(kazu%j==0){
count--;
break;
}
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248302/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%kazu = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kazu) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.end19
for.body: ; preds = %entry, %for.inc18
%count.032 = phi i32 [ %count.1, %for.inc18 ], [ %0, %entry ]
%i.031 = phi i32 [ %inc, %for.inc18 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kazu)
%1 = load i32, ptr %kazu, align 4, !tbaa !5
%cmp2 = icmp eq i32 %1, 2
br i1 %cmp2, label %for.inc18, label %if.else
if.else: ; preds = %for.body
%2 = and i32 %1, 1
%cmp3 = icmp eq i32 %2, 0
br i1 %cmp3, label %if.then4, label %for.cond6.preheader
for.cond6.preheader: ; preds = %if.else
%conv726 = sitofp i32 %1 to double
%call827 = call double @sqrt(double noundef %conv726) #4
%cmp928 = fcmp ult double %call827, 3.000000e+00
br i1 %cmp928, label %for.inc18, label %for.body11
if.then4: ; preds = %if.else
%dec = add nsw i32 %count.032, -1
br label %for.inc18
for.cond6: ; preds = %for.body11
%add = add nuw nsw i32 %j.029, 2
%conv = sitofp i32 %add to double
%conv7 = sitofp i32 %3 to double
%call8 = call double @sqrt(double noundef %conv7) #4
%cmp9 = fcmp ult double %call8, %conv
br i1 %cmp9, label %for.inc18, label %for.body11, !llvm.loop !9
for.body11: ; preds = %for.cond6.preheader, %for.cond6
%j.029 = phi i32 [ %add, %for.cond6 ], [ 3, %for.cond6.preheader ]
%3 = load i32, ptr %kazu, align 4, !tbaa !5
%rem12 = srem i32 %3, %j.029
%cmp13 = icmp eq i32 %rem12, 0
br i1 %cmp13, label %if.then15, label %for.cond6
if.then15: ; preds = %for.body11
%dec16 = add nsw i32 %count.032, -1
br label %for.inc18
for.inc18: ; preds = %for.cond6, %for.cond6.preheader, %if.then15, %for.body, %if.then4
%count.1 = phi i32 [ %count.032, %for.body ], [ %dec, %if.then4 ], [ %dec16, %if.then15 ], [ %count.032, %for.cond6.preheader ], [ %count.032, %for.cond6 ]
%inc = add nuw nsw i32 %i.031, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.inc18, %entry
%count.0.lcssa = phi i32 [ %0, %entry ], [ %count.1, %for.inc18 ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kazu) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 isPrime(int x){
int i;
if(x<2) return 0;
else if(x==2) return 1;
if (x%2==0) return 0;
for(i=3; i*i<=x; i+=2){
if(x%i==0) return 0;
}
return 1;
}
int main(){
int n,x,i;
int ct=0;
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%d",&x);
if(isPrime(x)) ct++;
}
printf("%d\n",ct);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248353/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248353/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %x, 2
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %if.else
%rem = and i32 %x, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not19 = icmp ult i32 %x, 9
br i1 %cmp7.not19, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.020, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %x
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.020 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %x, %i.020
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
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
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%ct.012 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%i.011 = phi i32 [ %inc3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %for.cond, label %if.else.i
if.else.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %1, 2
br i1 %cmp1.i, label %isPrime.exit, label %if.end3.i
if.end3.i: ; preds = %if.else.i
%rem.i = and i32 %1, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not19.i = icmp ult i32 %1, 9
br i1 %cmp7.not19.i, label %isPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.020.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.020.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.020.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %if.else.i, %for.cond.preheader.i
%inc = add nsw i32 %ct.012, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end3.i, %for.body, %isPrime.exit
%2 = phi i32 [ %inc, %isPrime.exit ], [ %ct.012, %for.body ], [ %ct.012, %if.end3.i ], [ %ct.012, %for.body.i ]
%inc3 = add nuw nsw i32 %i.011, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%ct.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ct.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int isPrimeNum( int x )
{
int i;
for( i = 2; i <= sqrt((double)x); i++ )
if( x % i == 0 ) return 0;
return 1;
}
int main(){
int num;
int i,j;
int *array;
int count = 0;
do{
scanf("%d",&num);
}while(num < 1 || num > 10000);
array = (int *)malloc(sizeof(int)*num);
for(i = 0;i < num;i++){
do{
scanf("%d",&array[i]);
}while(array[i]<2 || array[i]>100000000);
}
for(i = 0;i < num;i++) {
if( isPrimeNum( array[i] ) ) {
count++;
}
}
printf("%d\n",count);
free(array);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248397/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248397/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 memory(write) uwtable
define dso_local i32 @isPrimeNum(i32 noundef %x) local_unnamed_addr #0 {
entry:
%conv1 = sitofp i32 %x to double
%call8 = tail call double @sqrt(double noundef %conv1) #7
%cmp9 = fcmp ult double %call8, 2.000000e+00
br i1 %cmp9, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.010, 1
%conv = sitofp i32 %inc to double
%call = tail call double @sqrt(double noundef %conv1) #7
%cmp = fcmp ult double %call, %conv
br i1 %cmp, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %entry, %for.cond
%i.010 = phi i32 [ %inc, %for.cond ], [ 2, %entry ]
%rem = srem i32 %x, %i.010
%cmp3 = icmp eq i32 %rem, 0
br i1 %cmp3, label %cleanup, label %for.cond
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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #7
br label %do.body
do.body: ; preds = %do.body, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4
%1 = add i32 %0, -10001
%2 = icmp ult i32 %1, -10000
br i1 %2, label %do.body, label %do.body5.preheader.preheader, !llvm.loop !7
do.body5.preheader.preheader: ; preds = %do.body
%conv = zext i32 %0 to i64
%mul = shl nuw nsw i64 %conv, 2
%call2 = call noalias ptr @malloc(i64 noundef %mul) #8
br label %do.body5.preheader
do.body5.preheader: ; preds = %do.body5.preheader.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %do.body5.preheader.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv
br label %do.body5
for.cond19.preheader: ; preds = %for.inc
%3 = icmp sgt i32 %6, 0
br i1 %3, label %for.body22, label %for.end29
do.body5: ; preds = %do.body5.preheader, %do.body5
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !8
%5 = add i32 %4, -100000001
%or.cond = icmp ult i32 %5, -99999999
br i1 %or.cond, label %do.body5, label %for.inc, !llvm.loop !12
for.inc: ; preds = %do.body5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %num, align 4, !tbaa !8
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp3, label %do.body5.preheader, label %for.cond19.preheader, !llvm.loop !13
for.body22: ; preds = %for.cond19.preheader, %for.cond19
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.cond19 ], [ 0, %for.cond19.preheader ]
%count.051 = phi i32 [ %9, %for.cond19 ], [ 0, %for.cond19.preheader ]
%arrayidx24 = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx24, align 4, !tbaa !8
%conv1.i = sitofp i32 %8 to double
%call8.i = call double @sqrt(double noundef %conv1.i) #7
%cmp9.i = fcmp ult double %call8.i, 2.000000e+00
br i1 %cmp9.i, label %isPrimeNum.exit.thread, label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %i.010.i, 1
%conv.i = sitofp i32 %inc.i to double
%call.i = call double @sqrt(double noundef %conv1.i) #7
%cmp.i = fcmp ult double %call.i, %conv.i
br i1 %cmp.i, label %isPrimeNum.exit.thread, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.body22, %for.cond.i
%i.010.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.body22 ]
%rem.i = srem i32 %8, %i.010.i
%cmp3.i = icmp eq i32 %rem.i, 0
br i1 %cmp3.i, label %for.cond19, label %for.cond.i
isPrimeNum.exit.thread: ; preds = %for.cond.i, %for.body22
%inc2646 = add nsw i32 %count.051, 1
br label %for.cond19
for.cond19: ; preds = %for.body.i, %isPrimeNum.exit.thread
%9 = phi i32 [ %inc2646, %isPrimeNum.exit.thread ], [ %count.051, %for.body.i ]
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%10 = load i32, ptr %num, align 4, !tbaa !8
%11 = sext i32 %10 to i64
%cmp20 = icmp slt i64 %indvars.iv.next55, %11
br i1 %cmp20, label %for.body22, label %for.end29, !llvm.loop !14
for.end29: ; preds = %for.cond19, %for.cond19.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond19.preheader ], [ %9, %for.cond19 ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @free(ptr noundef %call2) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6
attributes #0 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
|
#include <stdio.h>
#include<float.h>
#include<math.h>
int main(void) {
// your code goes here
int a,b;
scanf("%d",&a);
scanf("%d",&b);
int n,i;
scanf("%d",&n);
int x[n],y[n],v[n];
for(i=0;i<n;i++){
scanf("%d",&x[i]);
scanf("%d",&y[i]);
scanf("%d",&v[i]);
}
double time=FLT_MAX;
for(i=0;i<n;i++){
double k=(sqrt((x[i]-a)*(x[i]-a)+(y[i]-b)*(y[i]-b)))/v[i];
if(k<time)time=k;
}
printf("%lf",time);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24844/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24844/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla3 = alloca i32, i64 %4, align 16
%vla4 = alloca i32, i64 %4, align 16
%cmp50 = icmp sgt i32 %3, 0
br i1 %cmp50, label %for.body, label %for.end35
for.cond12.preheader: ; preds = %for.body
%5 = icmp sgt i32 %6, 0
br i1 %5, label %for.body14, label %for.end35
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx7 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%arrayidx10 = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond12.preheader, !llvm.loop !9
for.body14: ; preds = %for.cond12.preheader, %for.body14
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body14 ], [ 0, %for.cond12.preheader ]
%time.054 = phi double [ %time.1, %for.body14 ], [ 0x47EFFFFFE0000000, %for.cond12.preheader ]
%arrayidx16 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv56
%8 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%9 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %8, %9
%mul = mul nsw i32 %sub, %sub
%arrayidx21 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv56
%10 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%11 = load i32, ptr %b, align 4, !tbaa !5
%sub22 = sub nsw i32 %10, %11
%mul26 = mul nsw i32 %sub22, %sub22
%add = add nuw nsw i32 %mul26, %mul
%conv = sitofp i32 %add to double
%call27 = call double @sqrt(double noundef %conv) #5
%arrayidx29 = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv56
%12 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%conv30 = sitofp i32 %12 to double
%div = fdiv double %call27, %conv30
%cmp31 = fcmp olt double %div, %time.054
%time.1 = select i1 %cmp31, double %div, double %time.054
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp13 = icmp slt i64 %indvars.iv.next57, %14
br i1 %cmp13, label %for.body14, label %for.end35, !llvm.loop !11
for.end35: ; preds = %for.body14, %entry, %for.cond12.preheader
%time.0.lcssa = phi double [ 0x47EFFFFFE0000000, %for.cond12.preheader ], [ 0x47EFFFFFE0000000, %entry ], [ %time.1, %for.body14 ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %time.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
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: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
static const int N = 10000;
static const int MIN = 2;
static const int MAX = 10*10*10*10*10*10*10*10;
int main(){
int n, i,j,count=0,flag,a=0;
int A[N+1];
scanf("%d", &n);
if(MIN > n || n > MAX){
printf("不正な数です。");
exit(1);
}
for ( i = 1; i <= n; i++ ){
scanf("%d", &A[i]);
if(1 > A[i] && A[i] > N){
exit(1);
}
}
for(i = 1; i <= n; i++){
if(A[i] == 2){
a = 1;
}
if(A[i]%2 == 1){
flag = 0;
for(j = 3; j <= sqrt(A[i]); j+=2){
if(A[i] % j==0){
flag = 1;
break;
}
}
if(flag == 0){
count++;
}
}
}
if(a == 1){
count++;
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248483/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248483/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [22 x i8] c"\E4\B8\8D\E6\AD\A3\E3\81\AA\E6\95\B0\E3\81\A7\E3\81\99\E3\80\82\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%0 = tail call ptr @llvm.stacksave.p0()
%vla71 = alloca [10001 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4
%2 = add i32 %1, -100000001
%or.cond = icmp ult i32 %2, -99999999
br i1 %or.cond, label %if.then, label %for.body
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
call void @exit(i32 noundef 1) #7
unreachable
for.cond13.preheader: ; preds = %for.body
%3 = icmp slt i32 %4, 1
br i1 %3, label %for.end50, label %for.body15
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla71, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv, %5
br i1 %cmp3.not.not, label %for.body, label %for.cond13.preheader, !llvm.loop !9
for.body15: ; preds = %for.cond13.preheader, %for.inc48
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.inc48 ], [ 1, %for.cond13.preheader ]
%a.082 = phi i32 [ %spec.select, %for.inc48 ], [ 0, %for.cond13.preheader ]
%count.081 = phi i32 [ %count.1, %for.inc48 ], [ 0, %for.cond13.preheader ]
%arrayidx17 = getelementptr inbounds i32, ptr %vla71, i64 %indvars.iv85
%6 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18 = icmp eq i32 %6, 2
%spec.select = select i1 %cmp18, i32 1, i32 %a.082
%7 = and i32 %6, -2147483647
%cmp23 = icmp eq i32 %7, 1
br i1 %cmp23, label %for.cond25.preheader, label %for.inc48
for.cond25.preheader: ; preds = %for.body15
%conv2875 = sitofp i32 %6 to double
%call2976 = call double @sqrt(double noundef %conv2875) #6
%cmp3077 = fcmp ult double %call2976, 3.000000e+00
br i1 %cmp3077, label %if.then44, label %for.body32
for.cond25: ; preds = %for.body32
%add = add nuw nsw i32 %j.078, 2
%conv = sitofp i32 %add to double
%conv28 = sitofp i32 %8 to double
%call29 = call double @sqrt(double noundef %conv28) #6
%cmp30 = fcmp ult double %call29, %conv
br i1 %cmp30, label %if.then44, label %for.body32, !llvm.loop !11
for.body32: ; preds = %for.cond25.preheader, %for.cond25
%j.078 = phi i32 [ %add, %for.cond25 ], [ 3, %for.cond25.preheader ]
%8 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%rem35 = srem i32 %8, %j.078
%cmp36 = icmp eq i32 %rem35, 0
br i1 %cmp36, label %for.inc48, label %for.cond25
if.then44: ; preds = %for.cond25, %for.cond25.preheader
%inc45 = add nsw i32 %count.081, 1
br label %for.inc48
for.inc48: ; preds = %for.body32, %for.body15, %if.then44
%count.1 = phi i32 [ %inc45, %if.then44 ], [ %count.081, %for.body15 ], [ %count.081, %for.body32 ]
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp14.not.not = icmp slt i64 %indvars.iv85, %10
br i1 %cmp14.not.not, label %for.body15, label %for.end50.loopexit, !llvm.loop !12
for.end50.loopexit: ; preds = %for.inc48
%11 = icmp eq i32 %spec.select, 1
%12 = zext i1 %11 to i32
%13 = add nsw i32 %count.1, %12
br label %for.end50
for.end50: ; preds = %for.end50.loopexit, %for.cond13.preheader
%spec.select72 = phi i32 [ 0, %for.cond13.preheader ], [ %13, %for.end50.loopexit ]
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select72)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
// AOJ ALDS1_1_C Prime Numbers
// 2018.4.27 bal4u
#include <stdio.h>
#include <math.h>
//#define getchar_unlocked() getchar()
int in()
{
int n = 0, c = getchar_unlocked();
do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
return n;
}
int main()
{
int N, i, a, r, ans;
N = in();
ans = 0;
while (N--) {
a = in();
if (a == 2) ans++;
else if (a&1) {
r = (int)sqrt(a);
for (i = 3; ; i+=2) {
if (i > r) { ans++; break; }
if (a%i == 0) break;
}
}
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248548/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248548/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
%.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre14.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit13
%4 = phi ptr [ %8, %getchar_unlocked.exit13 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit13 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i9, %getchar_unlocked.exit13 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4, align 8, !tbaa !9
%_IO_read_end.i5 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5, align 8, !tbaa !14
%cmp.not.i6 = icmp ult ptr %5, %6
br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !15
cond.true.i7: ; preds = %do.body
%call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13
cond.false.i10: ; preds = %do.body
%incdec.ptr.i11 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11, ptr %_IO_read_ptr.i4, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i12 = zext i8 %7 to i32
br label %getchar_unlocked.exit13
getchar_unlocked.exit13: ; preds = %cond.true.i7, %cond.false.i10
%8 = phi ptr [ %.pre, %cond.true.i7 ], [ %4, %cond.false.i10 ]
%cond.i9 = phi i32 [ %call.i8, %cond.true.i7 ], [ %conv3.i12, %cond.false.i10 ]
%cmp = icmp sgt i32 %cond.i9, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !17
do.end: ; preds = %getchar_unlocked.exit13
ret i32 %add
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15
cond.true.i.i: ; preds = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
%.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i.preheader
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph63 = phi ptr [ %0, %cond.false.i.i ], [ %.pre14.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit13.i
%4 = phi ptr [ %.pre61, %getchar_unlocked.exit13.i ], [ %.ph63, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit13.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i9.i, %getchar_unlocked.exit13.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul nsw i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !9
%_IO_read_end.i5.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5.i, align 8, !tbaa !14
%cmp.not.i6.i = icmp ult ptr %5, %6
br i1 %cmp.not.i6.i, label %cond.false.i10.i, label %cond.true.i7.i, !prof !15
cond.true.i7.i: ; preds = %do.body.i
%call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i
cond.false.i10.i: ; preds = %do.body.i
%incdec.ptr.i11.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11.i, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i12.i = zext i8 %7 to i32
br label %getchar_unlocked.exit13.i
getchar_unlocked.exit13.i: ; preds = %cond.false.i10.i, %cond.true.i7.i
%.pre61 = phi ptr [ %.pre.i, %cond.true.i7.i ], [ %4, %cond.false.i10.i ]
%cond.i9.i = phi i32 [ %call.i8.i, %cond.true.i7.i ], [ %conv3.i12.i, %cond.false.i10.i ]
%cmp.i = icmp sgt i32 %cond.i9.i, 47
br i1 %cmp.i, label %do.body.i, label %while.cond.preheader, !llvm.loop !17
while.cond.preheader: ; preds = %getchar_unlocked.exit13.i
%tobool.not58 = icmp eq i32 %add.i, 0
br i1 %tobool.not58, label %while.end, label %while.body
while.body: ; preds = %while.cond.preheader, %if.end15
%8 = phi ptr [ %19, %if.end15 ], [ %.pre61, %while.cond.preheader ]
%dec60.in = phi i32 [ %dec60, %if.end15 ], [ %add.i, %while.cond.preheader ]
%ans.059 = phi i32 [ %ans.1, %if.end15 ], [ 0, %while.cond.preheader ]
%dec60 = add nsw i32 %dec60.in, -1
%_IO_read_ptr.i.i24 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i.i24, align 8, !tbaa !9
%_IO_read_end.i.i25 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i.i25, align 8, !tbaa !14
%cmp.not.i.i26 = icmp ult ptr %9, %10
br i1 %cmp.not.i.i26, label %cond.false.i.i51, label %cond.true.i.i27, !prof !15
cond.true.i.i27: ; preds = %while.body
%call.i.i28 = tail call i32 @__uflow(ptr noundef nonnull %8) #4
%.pre14.pre.i29 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i33.preheader
cond.false.i.i51: ; preds = %while.body
%incdec.ptr.i.i52 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i.i52, ptr %_IO_read_ptr.i.i24, align 8, !tbaa !9
%11 = load i8, ptr %9, align 1, !tbaa !16
%conv3.i.i53 = zext i8 %11 to i32
br label %do.body.i33.preheader
do.body.i33.preheader: ; preds = %cond.false.i.i51, %cond.true.i.i27
%.ph62 = phi ptr [ %8, %cond.false.i.i51 ], [ %.pre14.pre.i29, %cond.true.i.i27 ]
%c.0.i35.ph = phi i32 [ %conv3.i.i53, %cond.false.i.i51 ], [ %call.i.i28, %cond.true.i.i27 ]
br label %do.body.i33
do.body.i33: ; preds = %do.body.i33.preheader, %getchar_unlocked.exit13.i45
%12 = phi ptr [ %17, %getchar_unlocked.exit13.i45 ], [ %.ph62, %do.body.i33.preheader ]
%13 = phi ptr [ %18, %getchar_unlocked.exit13.i45 ], [ %.ph62, %do.body.i33.preheader ]
%n.0.i34 = phi i32 [ %add.i38, %getchar_unlocked.exit13.i45 ], [ 0, %do.body.i33.preheader ]
%c.0.i35 = phi i32 [ %cond.i9.i46, %getchar_unlocked.exit13.i45 ], [ %c.0.i35.ph, %do.body.i33.preheader ]
%mul.i36 = mul nsw i32 %n.0.i34, 10
%and.i37 = and i32 %c.0.i35, 15
%add.i38 = add nsw i32 %and.i37, %mul.i36
%_IO_read_ptr.i4.i39 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i4.i39, align 8, !tbaa !9
%_IO_read_end.i5.i40 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i5.i40, align 8, !tbaa !14
%cmp.not.i6.i41 = icmp ult ptr %14, %15
br i1 %cmp.not.i6.i41, label %cond.false.i10.i48, label %cond.true.i7.i42, !prof !15
cond.true.i7.i42: ; preds = %do.body.i33
%call.i8.i43 = tail call i32 @__uflow(ptr noundef nonnull %13) #4
%.pre.i44 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i45
cond.false.i10.i48: ; preds = %do.body.i33
%incdec.ptr.i11.i49 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i11.i49, ptr %_IO_read_ptr.i4.i39, align 8, !tbaa !9
%16 = load i8, ptr %14, align 1, !tbaa !16
%conv3.i12.i50 = zext i8 %16 to i32
br label %getchar_unlocked.exit13.i45
getchar_unlocked.exit13.i45: ; preds = %cond.false.i10.i48, %cond.true.i7.i42
%17 = phi ptr [ %.pre.i44, %cond.true.i7.i42 ], [ %12, %cond.false.i10.i48 ]
%18 = phi ptr [ %.pre.i44, %cond.true.i7.i42 ], [ %13, %cond.false.i10.i48 ]
%cond.i9.i46 = phi i32 [ %call.i8.i43, %cond.true.i7.i42 ], [ %conv3.i12.i50, %cond.false.i10.i48 ]
%cmp.i47 = icmp sgt i32 %cond.i9.i46, 47
br i1 %cmp.i47, label %do.body.i33, label %in.exit54, !llvm.loop !17
in.exit54: ; preds = %getchar_unlocked.exit13.i45
%cmp = icmp eq i32 %add.i38, 2
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %in.exit54
%inc = add nsw i32 %ans.059, 1
br label %if.end15
if.else: ; preds = %in.exit54
%and = and i32 %c.0.i35, 1
%tobool2.not = icmp eq i32 %and, 0
br i1 %tobool2.not, label %if.end15, label %if.then3
if.then3: ; preds = %if.else
%conv = sitofp i32 %add.i38 to double
%call4 = tail call double @sqrt(double noundef %conv) #4
%conv5 = fptosi double %call4 to i32
%cmp655 = icmp slt i32 %conv5, 3
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br i1 %cmp655, label %if.then8, label %if.end
for.cond: ; preds = %if.end
%add = add nuw nsw i32 %i.056, 2
%cmp6 = icmp sgt i32 %add, %conv5
br i1 %cmp6, label %if.then8, label %if.end
if.then8: ; preds = %for.cond, %if.then3
%inc9 = add nsw i32 %ans.059, 1
br label %if.end15
if.end: ; preds = %if.then3, %for.cond
%i.056 = phi i32 [ %add, %for.cond ], [ 3, %if.then3 ]
%rem = srem i32 %add.i38, %i.056
%cmp10 = icmp eq i32 %rem, 0
br i1 %cmp10, label %if.end15, label %for.cond
if.end15: ; preds = %if.end, %if.else, %if.then8, %if.then
%19 = phi ptr [ %17, %if.then ], [ %.pre, %if.then8 ], [ %17, %if.else ], [ %.pre, %if.end ]
%ans.1 = phi i32 [ %inc, %if.then ], [ %inc9, %if.then8 ], [ %ans.059, %if.else ], [ %ans.059, %if.end ]
%tobool.not = icmp eq i32 %dec60, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !19
while.end: ; preds = %if.end15, %while.cond.preheader
%ans.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %ans.1, %if.end15 ]
%call16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ans.0.lcssa)
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
declare i32 @__uflow(ptr noundef) local_unnamed_addr #3
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!"branch_weights", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
|
#include<stdio.h>
#include<math.h>
int sosu(int);
int main(){
int A[10000],h,i,cnt=0,result;
scanf("%d",&h);
for(i = 0 ; i < h ; i++){
scanf("%d",&A[i]);
result = sosu(A[i]);
if(result == 1) cnt++;
}
printf("%d\n",cnt);
return 0;
}
int sosu(int x){
int i,result = 1;
double A = sqrt(x);
for(i = 2 ; i <= A ; i++){
if(x % i == 0){
result = 0;
break;
}
}
return result;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248591/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248591/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10000 x i32], align 16
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%cnt.016 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv.i = sitofp i32 %1 to double
%call.i = call double @sqrt(double noundef %conv.i) #5
%cmp8.i = fcmp ult double %call.i, 2.000000e+00
br i1 %cmp8.i, label %sosu.exit.thread, label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %i.09.i, 1
%conv1.i = sitofp i32 %inc.i to double
%cmp.i = fcmp ult double %call.i, %conv1.i
br i1 %cmp.i, label %sosu.exit.thread, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %for.body, %for.cond.i
%i.09.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.body ]
%rem.i = srem i32 %1, %i.09.i
%cmp3.i = icmp eq i32 %rem.i, 0
br i1 %cmp3.i, label %for.cond, label %for.cond.i
sosu.exit.thread: ; preds = %for.cond.i, %for.body
%inc14 = add nsw i32 %cnt.016, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %sosu.exit.thread
%2 = phi i32 [ %inc14, %sosu.exit.thread ], [ %cnt.016, %for.body.i ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %h, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 40000, 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 memory(write) uwtable
define dso_local i32 @sosu(i32 noundef %x) local_unnamed_addr #3 {
entry:
%conv = sitofp i32 %x to double
%call = tail call double @sqrt(double noundef %conv) #5
%cmp8 = fcmp ult double %call, 2.000000e+00
br i1 %cmp8, label %for.end, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.09, 1
%conv1 = sitofp i32 %inc to double
%cmp = fcmp ult double %call, %conv1
br i1 %cmp, label %for.end, label %for.body, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%i.09 = phi i32 [ %inc, %for.cond ], [ 2, %entry ]
%rem = srem i32 %x, %i.09
%cmp3 = icmp eq i32 %rem, 0
br i1 %cmp3, label %for.end, label %for.cond
for.end: ; preds = %for.cond, %for.body, %entry
%result.0 = phi i32 [ 1, %entry ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %result.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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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 judge(int);
int judge(int num)
{
int i;
if(num == 1)
return 0;
if(num == 2)
return 1;
if(num%2 == 0)
return 0;
for(i=3;i*i<=num;i+=2){
if(num%i == 0)
return 0;
}
return 1;
}
int main()
{
int n,num,i,count=0;
scanf("%d",&n);
for(i=0;i<n;i++) {
scanf("%d",&num);
if(judge(num) == 1)
count++;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248634/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248634/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @judge(i32 noundef %num) local_unnamed_addr #0 {
entry:
switch i32 %num, label %if.end3 [
i32 1, label %cleanup
i32 2, label %if.then2
]
if.then2: ; preds = %entry
br label %cleanup
if.end3: ; preds = %entry
%0 = and i32 %num, 1
%cmp4 = icmp eq i32 %0, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not19 = icmp slt i32 %num, 9
br i1 %cmp7.not19, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.020, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %num
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.020 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %num, %i.020
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %entry, %if.then2
%retval.0 = phi i32 [ 1, %if.then2 ], [ 0, %entry ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
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
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%count.013 = phi i32 [ %3, %for.cond ], [ 0, %entry ]
%i.012 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%1 = load i32, ptr %num, align 4, !tbaa !7
switch i32 %1, label %if.end3.i [
i32 1, label %for.cond
i32 2, label %judge.exit
]
if.end3.i: ; preds = %for.body
%2 = and i32 %1, 1
%cmp4.i = icmp eq i32 %2, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not19.i = icmp slt i32 %1, 9
br i1 %cmp7.not19.i, label %judge.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.020.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %judge.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.020.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.020.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %for.cond.i
judge.exit: ; preds = %for.cond.i, %for.body, %for.cond.preheader.i
%inc = add nsw i32 %count.013, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end3.i, %for.body, %judge.exit
%3 = phi i32 [ %inc, %judge.exit ], [ %count.013, %for.body ], [ %count.013, %if.end3.i ], [ %count.013, %for.body.i ]
%inc4 = add nuw nsw i32 %i.012, 1
%4 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc4, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %3, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include<stdio.h>
int isPrime(int x){
int i;
if(x<2)return 0;
else if(x==2)return 1;
if(x%2==0)return 0;
for(i=3; i*i<=x; i+=2){
if(x%i==0)
return 0;
}
return 1;
}
int main(){
int n,x,i;
int cnt =0;
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%d",&x);
if(isPrime(x))
cnt++;
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248678/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248678/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %x, 2
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %if.else
%rem = and i32 %x, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not19 = icmp ult i32 %x, 9
br i1 %cmp7.not19, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.020, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %x
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.020 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %x, %i.020
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
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
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%cnt.012 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%i.011 = phi i32 [ %inc3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %for.cond, label %if.else.i
if.else.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %1, 2
br i1 %cmp1.i, label %isPrime.exit, label %if.end3.i
if.end3.i: ; preds = %if.else.i
%rem.i = and i32 %1, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not19.i = icmp ult i32 %1, 9
br i1 %cmp7.not19.i, label %isPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.020.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.020.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.020.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %if.else.i, %for.cond.preheader.i
%inc = add nsw i32 %cnt.012, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end3.i, %for.body, %isPrime.exit
%2 = phi i32 [ %inc, %isPrime.exit ], [ %cnt.012, %for.body ], [ %cnt.012, %if.end3.i ], [ %cnt.012, %for.body.i ]
%inc3 = add nuw nsw i32 %i.011, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
#include <math.h>
int IsPrime(int);
int main() {
int total, n, i, j, flag = 0,count = 0;
scanf("%d", &total);
for (i = 0; i < total; i++) {
scanf("%d", &n);
if (IsPrime(n) == 1) count++;
}
printf("%d\n", count);
return 0;
}
int IsPrime(int n) {
int root,i;
if (n == 2 || n == 3) return 1;
if (n % 2 == 0) return 0;
root = (int)sqrt(n);
for (i = 3; i <= root; i += 2) {
if (n % i == 0) return 0;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248720/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248720/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%total = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %total) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %total)
%0 = load i32, ptr %total, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%count.013 = phi i32 [ %4, %for.cond ], [ 0, %entry ]
%i.012 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = and i32 %1, -2
%or.cond.i = icmp eq i32 %2, 2
br i1 %or.cond.i, label %IsPrime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%3 = and i32 %1, 1
%cmp2.i = icmp eq i32 %3, 0
br i1 %cmp2.i, label %for.cond, label %if.end4.i
if.end4.i: ; preds = %if.end.i
%conv.i = sitofp i32 %1 to double
%call.i = call double @sqrt(double noundef %conv.i) #5
%conv5.i = fptosi double %call.i to i32
%cmp6.not20.i = icmp slt i32 %conv5.i, 3
br i1 %cmp6.not20.i, label %IsPrime.exit.thread, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%cmp6.not.i = icmp sgt i32 %add.i, %conv5.i
br i1 %cmp6.not.i, label %IsPrime.exit.thread, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %if.end4.i, %for.cond.i
%i.021.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %if.end4.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %for.cond.i
IsPrime.exit.thread: ; preds = %for.cond.i, %for.body, %if.end4.i
%inc10 = add nsw i32 %count.013, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end.i, %IsPrime.exit.thread
%4 = phi i32 [ %inc10, %IsPrime.exit.thread ], [ %count.013, %if.end.i ], [ %count.013, %for.body.i ]
%inc4 = add nuw nsw i32 %i.012, 1
%5 = load i32, ptr %total, align 4, !tbaa !5
%cmp = icmp slt i32 %inc4, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %4, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %total) #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 memory(write) uwtable
define dso_local i32 @IsPrime(i32 noundef %n) local_unnamed_addr #3 {
entry:
%0 = and i32 %n, -2
%or.cond = icmp eq i32 %0, 2
br i1 %or.cond, label %cleanup, label %if.end
if.end: ; preds = %entry
%1 = and i32 %n, 1
%cmp2 = icmp eq i32 %1, 0
br i1 %cmp2, label %cleanup, label %if.end4
if.end4: ; preds = %if.end
%conv = sitofp i32 %n to double
%call = tail call double @sqrt(double noundef %conv) #5
%conv5 = fptosi double %call to i32
%cmp6.not20 = icmp slt i32 %conv5, 3
br i1 %cmp6.not20, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.021, 2
%cmp6.not = icmp sgt i32 %add, %conv5
br i1 %cmp6.not, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %if.end4, %for.cond
%i.021 = phi i32 [ %add, %for.cond ], [ 3, %if.end4 ]
%rem8 = srem i32 %n, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %if.end4, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %if.end4 ], [ 0, %for.body ], [ 1, %for.cond ]
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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
int main(){
int i,j,k,n,count = 0,flag = 0;
scanf("%d",&i);
for(j = 0;j < i;j++){
scanf("%d",&n);
if((n%2) == 0){
if(n == 2) count++;
continue;
}
flag = 0;
for(k = 1;(2*k+1) <= sqrt(n);k++){
if((n%(2*k+1)) == 0){
flag = 1 ;
break;
}
} count++;
if(flag == 1) count--;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248764/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248764/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%i = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %0, 0
br i1 %cmp41, label %for.body, label %for.end27
for.body: ; preds = %entry, %for.inc25
%count.043 = phi i32 [ %count.1, %for.inc25 ], [ 0, %entry ]
%j.042 = phi i32 [ %inc26, %for.inc25 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp2 = icmp eq i32 %2, 0
br i1 %cmp2, label %if.then, label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body
%conv736 = sitofp i32 %1 to double
%call837 = call double @sqrt(double noundef %conv736) #4
%cmp938 = fcmp ult double %call837, 3.000000e+00
br i1 %cmp938, label %for.end, label %for.body11
if.then: ; preds = %for.body
%cmp3 = icmp eq i32 %1, 2
%inc = zext i1 %cmp3 to i32
%spec.select = add nsw i32 %count.043, %inc
br label %for.inc25
for.cond6: ; preds = %for.body11
%inc19 = add nuw nsw i32 %k.039, 1
%mul = shl nuw nsw i32 %inc19, 1
%add = or i32 %mul, 1
%conv = sitofp i32 %add to double
%conv7 = sitofp i32 %3 to double
%call8 = call double @sqrt(double noundef %conv7) #4
%cmp9 = fcmp ult double %call8, %conv
br i1 %cmp9, label %for.end, label %for.body11, !llvm.loop !9
for.body11: ; preds = %for.cond6.preheader, %for.cond6
%add40 = phi i32 [ %add, %for.cond6 ], [ 3, %for.cond6.preheader ]
%k.039 = phi i32 [ %inc19, %for.cond6 ], [ 1, %for.cond6.preheader ]
%3 = load i32, ptr %n, align 4, !tbaa !5
%rem14 = srem i32 %3, %add40
%cmp15 = icmp eq i32 %rem14, 0
br i1 %cmp15, label %for.inc25, label %for.cond6
for.end: ; preds = %for.cond6, %for.cond6.preheader
%inc20 = add nsw i32 %count.043, 1
br label %for.inc25
for.inc25: ; preds = %for.body11, %for.end, %if.then
%count.1 = phi i32 [ %inc20, %for.end ], [ %spec.select, %if.then ], [ %count.043, %for.body11 ]
%inc26 = add nuw nsw i32 %j.042, 1
%4 = load i32, ptr %i, align 4, !tbaa !5
%cmp = icmp slt i32 %inc26, %4
br i1 %cmp, label %for.body, label %for.end27, !llvm.loop !11
for.end27: ; preds = %for.inc25, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1, %for.inc25 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 isPrime(int x)
{
int i;
if(x<2)return 0;
if(x==2)return 1;
if(x%2==0)return 0;
for(i=3;i*i<=x;i+=2)
{
if(x%i==0)return 0;
}
return 1;
}
int main(void)
{
int count,n,x,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&x);
count+=isPrime(x);
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248807/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248807/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp eq i32 %x, 2
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %if.end
%rem = and i32 %x, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not19 = icmp ult i32 %x, 9
br i1 %cmp7.not19, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.020, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %x
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.020 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %x, %i.020
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.end ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
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
%x = 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 %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp6 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp6)
br label %for.body
for.body: ; preds = %entry, %isPrime.exit
%i.08 = phi i32 [ %inc, %isPrime.exit ], [ 0, %entry ]
%count.07 = phi i32 [ %add, %isPrime.exit ], [ undef, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %isPrime.exit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %1, 2
br i1 %cmp1.i, label %isPrime.exit, label %if.end3.i
if.end3.i: ; preds = %if.end.i
%rem.i = and i32 %1, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %isPrime.exit, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not19.i = icmp ult i32 %1, 9
br i1 %cmp7.not19.i, label %isPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.020.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.020.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.020.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %isPrime.exit, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %for.body.i, %for.body, %if.end.i, %if.end3.i, %for.cond.preheader.i
%retval.0.i = phi i32 [ 0, %for.body ], [ 1, %if.end.i ], [ 0, %if.end3.i ], [ 1, %for.cond.preheader.i ], [ 1, %for.cond.i ], [ 0, %for.body.i ]
%add = add nsw i32 %retval.0.i, %count.07
%inc = add nuw nsw i32 %i.08, 1
%2 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %isPrime.exit
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int a, i, j, m, n, c;
char buf[16];
char *p;
fgets(buf, 16, stdin);
n = atoi(buf);
c=0;
for (i=0; i<n; i++) {
fgets(buf, 16, stdin);
p = buf;
for (a=0; *p>='0'; p++)
a = a * 10 + *p - '0';
m = (int)sqrt(a)+1;
for (j=2; j<m; j++) {
if (a%j==0) break;
}
if (j==m) c++;
}
buf[15]='\0';
buf[14]='\n';
for (i=13; c>0; i--, c/=10) buf[i] = '0' + (c%10);
fputs(buf+i+1, stdout);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248858/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248858/source.c"
target datalayout = "e-m:e-p270: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
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%buf = alloca [16 x i8], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %buf) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 16, ptr noundef %0)
%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
%cmp67 = icmp sgt i32 %conv.i, 0
br i1 %cmp67, label %for.body, label %for.end30.thread
for.end30.thread: ; preds = %entry
%arrayidx78 = getelementptr inbounds [16 x i8], ptr %buf, i64 0, i64 15
store i8 0, ptr %arrayidx78, align 1, !tbaa !9
%arrayidx3179 = getelementptr inbounds [16 x i8], ptr %buf, i64 0, i64 14
store i8 10, ptr %arrayidx3179, align 2, !tbaa !9
br label %for.end41
for.body: ; preds = %entry, %for.end22
%c.069 = phi i32 [ %spec.select, %for.end22 ], [ 0, %entry ]
%i.068 = phi i32 [ %inc29, %for.end22 ], [ 0, %entry ]
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call4 = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 16, ptr noundef %1)
%2 = load i8, ptr %buf, align 16, !tbaa !9
%cmp760 = icmp sgt i8 %2, 47
br i1 %cmp760, label %for.body9, label %for.end
for.body9: ; preds = %for.body, %for.body9
%3 = phi i8 [ %4, %for.body9 ], [ %2, %for.body ]
%p.062 = phi ptr [ %incdec.ptr, %for.body9 ], [ %buf, %for.body ]
%a.061 = phi i32 [ %sub, %for.body9 ], [ 0, %for.body ]
%conv = zext i8 %3 to i32
%mul = mul nsw i32 %a.061, 10
%add = add i32 %mul, -48
%sub = add i32 %add, %conv
%incdec.ptr = getelementptr inbounds i8, ptr %p.062, i64 1
%4 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%cmp7 = icmp sgt i8 %4, 47
br i1 %cmp7, label %for.body9, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body9, %for.body
%a.0.lcssa = phi i32 [ 0, %for.body ], [ %sub, %for.body9 ]
%conv11 = sitofp i32 %a.0.lcssa to double
%call12 = call double @sqrt(double noundef %conv11) #5
%conv13 = fptosi double %call12 to i32
%add14 = add i32 %conv13, 1
%cmp16.not63 = icmp slt i32 %conv13, 2
br i1 %cmp16.not63, label %for.end22, label %for.body18
for.body18: ; preds = %for.end, %for.inc21
%j.064 = phi i32 [ %inc, %for.inc21 ], [ 2, %for.end ]
%rem = srem i32 %a.0.lcssa, %j.064
%cmp19 = icmp eq i32 %rem, 0
br i1 %cmp19, label %for.end22, label %for.inc21
for.inc21: ; preds = %for.body18
%inc = add nuw i32 %j.064, 1
%exitcond.not = icmp eq i32 %j.064, %conv13
br i1 %exitcond.not, label %for.end22, label %for.body18, !llvm.loop !12
for.end22: ; preds = %for.inc21, %for.body18, %for.end
%j.0.lcssa = phi i32 [ 2, %for.end ], [ %j.064, %for.body18 ], [ %add14, %for.inc21 ]
%cmp23 = icmp eq i32 %j.0.lcssa, %add14
%inc26 = zext i1 %cmp23 to i32
%spec.select = add nuw nsw i32 %c.069, %inc26
%inc29 = add nuw nsw i32 %i.068, 1
%exitcond75.not = icmp eq i32 %inc29, %conv.i
br i1 %exitcond75.not, label %for.end30, label %for.body, !llvm.loop !13
for.end30: ; preds = %for.end22
%arrayidx = getelementptr inbounds [16 x i8], ptr %buf, i64 0, i64 15
store i8 0, ptr %arrayidx, align 1, !tbaa !9
%arrayidx31 = getelementptr inbounds [16 x i8], ptr %buf, i64 0, i64 14
store i8 10, ptr %arrayidx31, align 2, !tbaa !9
%cmp3371.not = icmp eq i32 %spec.select, 0
br i1 %cmp3371.not, label %for.end41, label %for.body35
for.body35: ; preds = %for.end30, %for.body35
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body35 ], [ 13, %for.end30 ]
%c.273 = phi i32 [ %div, %for.body35 ], [ %spec.select, %for.end30 ]
%rem36 = urem i32 %c.273, 10
%5 = trunc i32 %rem36 to i8
%conv38 = or i8 %5, 48
%arrayidx39 = getelementptr inbounds [16 x i8], ptr %buf, i64 0, i64 %indvars.iv
store i8 %conv38, ptr %arrayidx39, align 1, !tbaa !9
%indvars.iv.next = add i64 %indvars.iv, -1
%div = udiv i32 %c.273, 10
%cmp33.not = icmp ult i32 %c.273, 10
br i1 %cmp33.not, label %for.end41.loopexit, label %for.body35, !llvm.loop !14
for.end41.loopexit: ; preds = %for.body35
%sext = shl i64 %indvars.iv.next, 32
%6 = ashr exact i64 %sext, 32
br label %for.end41
for.end41: ; preds = %for.end30.thread, %for.end41.loopexit, %for.end30
%i.1.lcssa = phi i64 [ 13, %for.end30 ], [ %6, %for.end41.loopexit ], [ 13, %for.end30.thread ]
%add.ptr = getelementptr inbounds i8, ptr %buf, i64 %i.1.lcssa
%add.ptr43 = getelementptr inbounds i8, ptr %add.ptr, i64 1
%7 = load ptr, ptr @stdout, align 8, !tbaa !5
%call44 = call i32 @fputs(ptr noundef nonnull %add.ptr43, ptr noundef %7)
call void @llvm.lifetime.end.p0(i64 16, 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 nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @fputs(ptr nocapture noundef readonly, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 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 = { 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}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
|
#include <stdio.h>
#include <math.h>
int main(){
int i,j,t,num,m,cnt=0;
scanf("%d",&num);
for(i=0;i<num;i++){
t=0;
scanf("%d",&m);
for(j=2;j<=sqrt(m);j++){
if(m%j==0)t=1;
}
if(t==0)cnt++;
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248915/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248915/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #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 %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end17
for.body: ; preds = %entry, %for.end
%cnt.031 = phi i32 [ %spec.select23, %for.end ], [ 0, %entry ]
%i.030 = phi i32 [ %inc16, %for.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !5
%conv324 = sitofp i32 %1 to double
%call425 = call double @sqrt(double noundef %conv324) #4
%cmp526 = fcmp ult double %call425, 2.000000e+00
br i1 %cmp526, label %for.end, label %for.body7
for.body7: ; preds = %for.body, %for.body7
%t.028 = phi i32 [ %spec.select, %for.body7 ], [ 0, %for.body ]
%j.027 = phi i32 [ %inc, %for.body7 ], [ 2, %for.body ]
%2 = load i32, ptr %m, align 4, !tbaa !5
%rem = srem i32 %2, %j.027
%cmp8 = icmp eq i32 %rem, 0
%spec.select = select i1 %cmp8, i32 1, i32 %t.028
%inc = add nuw nsw i32 %j.027, 1
%conv = sitofp i32 %inc to double
%conv3 = sitofp i32 %2 to double
%call4 = call double @sqrt(double noundef %conv3) #4
%cmp5 = fcmp ult double %call4, %conv
br i1 %cmp5, label %for.end, label %for.body7, !llvm.loop !9
for.end: ; preds = %for.body7, %for.body
%t.0.lcssa = phi i32 [ 0, %for.body ], [ %spec.select, %for.body7 ]
%cmp10 = icmp eq i32 %t.0.lcssa, 0
%inc13 = zext i1 %cmp10 to i32
%spec.select23 = add nuw nsw i32 %cnt.031, %inc13
%inc16 = add nuw nsw i32 %i.030, 1
%3 = load i32, ptr %num, align 4, !tbaa !5
%cmp = icmp slt i32 %inc16, %3
br i1 %cmp, label %for.body, label %for.end17, !llvm.loop !11
for.end17: ; preds = %for.end, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select23, %for.end ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
int sosu(int);
int main()
{
int number,answer,count,i,z=0;
scanf("%d",&count);
for(i=0;i<count;i++)
{
scanf("%d",&number);
answer=sosu(number);
if(answer)z++;
}
printf("%d\n",z);
return 0;
}
int sosu(int number)
{
int i;
if(number<=3&&number>1)
{
return 1;
}
else if(number%2==0||number%3==0)
{
return 0;
}
else
{
for(i=5;i*i<=number;i+=6)
{
if(number%i==0||number%(i+2)==0)
{
return 0;
}
}
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248966/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%number = alloca i32, align 4
%count = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %count) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %count)
%0 = load i32, ptr %count, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%z.012 = phi i32 [ %4, %for.cond ], [ 0, %entry ]
%i.011 = phi i32 [ %inc3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%1 = load i32, ptr %number, align 4, !tbaa !5
%2 = and i32 %1, -2
%or.cond.i = icmp eq i32 %2, 2
br i1 %or.cond.i, label %sosu.exit, label %if.else.i
if.else.i: ; preds = %for.body
%3 = and i32 %1, 1
%cmp2.i = icmp eq i32 %3, 0
%rem3.i = srem i32 %1, 3
%cmp4.i = icmp eq i32 %rem3.i, 0
%or.cond27.i = or i1 %cmp2.i, %cmp4.i
br i1 %or.cond27.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.else.i
%cmp7.not28.i = icmp slt i32 %1, 25
br i1 %cmp7.not28.i, label %sosu.exit, label %for.body.i
for.cond.i: ; preds = %lor.lhs.false10.i
%add14.i = add nuw nsw i32 %i.029.i, 6
%mul.i = mul nsw i32 %add14.i, %add14.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %sosu.exit, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.029.i = phi i32 [ %add14.i, %for.cond.i ], [ 5, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.029.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %lor.lhs.false10.i
lor.lhs.false10.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.029.i, 2
%rem11.i = srem i32 %1, %add.i
%cmp12.i = icmp eq i32 %rem11.i, 0
br i1 %cmp12.i, label %for.cond, label %for.cond.i
sosu.exit: ; preds = %for.cond.i, %for.body, %for.cond.preheader.i
%inc = add nsw i32 %z.012, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %lor.lhs.false10.i, %if.else.i, %sosu.exit
%4 = phi i32 [ %inc, %sosu.exit ], [ %z.012, %if.else.i ], [ %z.012, %lor.lhs.false10.i ], [ %z.012, %for.body.i ]
%inc3 = add nuw nsw i32 %i.011, 1
%5 = load i32, ptr %count, align 4, !tbaa !5
%cmp = icmp slt i32 %inc3, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%z.0.lcssa = phi i32 [ 0, %entry ], [ %4, %for.cond ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %z.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %count) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %number) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @sosu(i32 noundef %number) local_unnamed_addr #3 {
entry:
%0 = and i32 %number, -2
%or.cond = icmp eq i32 %0, 2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %entry
%1 = and i32 %number, 1
%cmp2 = icmp eq i32 %1, 0
%rem3 = srem i32 %number, 3
%cmp4 = icmp eq i32 %rem3, 0
%or.cond27 = or i1 %cmp2, %cmp4
br i1 %or.cond27, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else
%cmp7.not28 = icmp slt i32 %number, 25
br i1 %cmp7.not28, label %cleanup, label %for.body
for.cond: ; preds = %lor.lhs.false10
%add14 = add nuw nsw i32 %i.029, 6
%mul = mul nsw i32 %add14, %add14
%cmp7.not = icmp sgt i32 %mul, %number
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.cond
%i.029 = phi i32 [ %add14, %for.cond ], [ 5, %for.cond.preheader ]
%rem8 = srem i32 %number, %i.029
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %lor.lhs.false10
lor.lhs.false10: ; preds = %for.body
%add = add nuw nsw i32 %i.029, 2
%rem11 = srem i32 %number, %add
%cmp12 = icmp eq i32 %rem11, 0
br i1 %cmp12, label %cleanup, label %for.cond
cleanup: ; preds = %lor.lhs.false10, %for.body, %for.cond, %for.cond.preheader, %if.else, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.else ], [ 1, %for.cond.preheader ], [ 0, %lor.lhs.false10 ], [ 0, %for.body ], [ 1, %for.cond ]
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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
#define TRUE 1
#define FALSE 0
int isprime(int);
int main(){
int i;
int result = 0;
int A[10000];
int num=0;
scanf("%d",&num);
for(i=0;i<num;i++){
scanf("%d",&A[i]);
if(isprime(A[i]) == TRUE)result++;
}
printf("%d\n",result);
return 0;
}
int isprime(int x){
int i;
if(x == 2)return TRUE;
if(x < 2 || x % 2 == 0)return FALSE;
i=3;
while( i <= sqrt(x) ){
if(x % i == 0)return FALSE;
i = i + 2;
}
return TRUE;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249008/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249008/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10000 x i32], align 16
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
store i32 0, ptr %num, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%result.017 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %isprime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isprime.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isprime.exit.thread, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %while.cond.i
isprime.exit.thread: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc14 = add nsw i32 %result.017, 1
br label %for.cond
for.cond: ; preds = %while.body.i, %if.end.i, %isprime.exit.thread
%2 = phi i32 [ %inc14, %isprime.exit.thread ], [ %result.017, %if.end.i ], [ %result.017, %while.body.i ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %num, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%result.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
call void @llvm.lifetime.end.p0(i64 40000, 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 memory(write) uwtable
define dso_local i32 @isprime(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include <math.h>
int main(){
int n, i, j, sum = 0, flag;
scanf("%d", &n);
int A[n];
for(i = 0 ; i < n ; i++){
scanf("%d", &A[i]);
}
for(i = 0 ; i < n ; i++){
flag = 0;
for(j = 2 ; j <= sqrt((int)A[i]) ; j++){
if(A[i] % j == 0) flag = 1;
}
if(flag == 0) sum++;
}
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249051/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249051/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %3, 0
br i1 %cmp39, label %for.body, label %for.end27
for.cond2.preheader: ; preds = %for.body
%4 = icmp sgt i32 %5, 0
br i1 %4, label %for.cond5.preheader, label %for.end27
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %for.end19
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.end19 ], [ 0, %for.cond2.preheader ]
%sum.047 = phi i32 [ %spec.select38, %for.end19 ], [ 0, %for.cond2.preheader ]
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv51
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%conv841 = sitofp i32 %7 to double
%call942 = call double @sqrt(double noundef %conv841) #5
%cmp1043 = fcmp ult double %call942, 2.000000e+00
br i1 %cmp1043, label %for.end19, label %for.body12
for.body12: ; preds = %for.cond5.preheader, %for.body12
%flag.045 = phi i32 [ %spec.select, %for.body12 ], [ 0, %for.cond5.preheader ]
%j.044 = phi i32 [ %inc18, %for.body12 ], [ 2, %for.cond5.preheader ]
%8 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%rem = srem i32 %8, %j.044
%cmp15 = icmp eq i32 %rem, 0
%spec.select = select i1 %cmp15, i32 1, i32 %flag.045
%inc18 = add nuw nsw i32 %j.044, 1
%conv = sitofp i32 %inc18 to double
%conv8 = sitofp i32 %8 to double
%call9 = call double @sqrt(double noundef %conv8) #5
%cmp10 = fcmp ult double %call9, %conv
br i1 %cmp10, label %for.end19, label %for.body12, !llvm.loop !11
for.end19: ; preds = %for.body12, %for.cond5.preheader
%flag.0.lcssa = phi i32 [ 0, %for.cond5.preheader ], [ %spec.select, %for.body12 ]
%cmp20 = icmp eq i32 %flag.0.lcssa, 0
%inc23 = zext i1 %cmp20 to i32
%spec.select38 = add nuw nsw i32 %sum.047, %inc23
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp3 = icmp slt i64 %indvars.iv.next52, %10
br i1 %cmp3, label %for.cond5.preheader, label %for.end27, !llvm.loop !12
for.end27: ; preds = %for.end19, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %spec.select38, %for.end19 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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>
#define N 10000
int isPrime(int);
int main(){
int x,i,j,u,c=0,count=0;
int s[N];
scanf("%d",&x);
for(i=0;i<x;i++){
scanf("%d",&s[i]);
}
for(i=0;i<x;i++){
u = isPrime( s[i] );
if(u == 1) count++;
}
printf("%d\n",count);
return 0;
}
int isPrime(int x){
int i;
if(x==2) return 1;
if( x<2 || x%2==0) return 0;
i = 3;
while(i<= sqrt(x) ){
if( x % i ==0 ) return 0;
i = i + 2;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249095/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249095/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%s = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %x, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.cond2
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.cond2 ], [ 0, %for.cond2.preheader ]
%count.027 = phi i32 [ %5, %for.cond2 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %s, i64 0, i64 %indvars.iv29
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp.i = icmp eq i32 %4, 2
br i1 %cmp.i, label %isPrime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body4
%cmp1.i = icmp slt i32 %4, 2
%rem.i = and i32 %4, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond2, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %4 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isPrime.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isPrime.exit.thread, label %while.body.i, !llvm.loop !11
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %4, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond2, label %while.cond.i
isPrime.exit.thread: ; preds = %while.cond.i, %for.body4, %while.cond.preheader.i
%inc922 = add nsw i32 %count.027, 1
br label %for.cond2
for.cond2: ; preds = %while.body.i, %if.end.i, %isPrime.exit.thread
%5 = phi i32 [ %inc922, %isPrime.exit.thread ], [ %count.027, %if.end.i ], [ %count.027, %while.body.i ]
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%6 = load i32, ptr %x, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next30, %7
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.cond2, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %5, %for.cond2 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 memory(write) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !11
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
#define TYPE int
#define INF 9223372036854775807
int main() {
int N, K;
long long ans = INF, tmp = -1;
scanf("%d%d", &N, &K);
int *X = (int*)malloc(sizeof(int)*N);
for (int i = 0; i < N; i++)
{
scanf("%d", &X[i]);
}
for (int i = 0; i <= N - K; i++)//先頭から長さK全探索
{
tmp = (long long)X[i + K - 1] - X[i];
if (abs(X[i + K - 1]) <= abs(X[i]))
{
tmp += (long long)abs(X[i + K - 1]);
}
else
{
tmp += (long long)abs(X[i]);
}
if (tmp < ans)
{
ans = tmp;
}
}
printf("%lld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249145/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249145/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %for.body, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %39, %for.body ]
%1 = load i32, ptr %K, align 4, !tbaa !5
%cmp6.not66 = icmp slt i32 %.lcssa, %1
br i1 %cmp6.not66, label %for.cond.cleanup8, label %for.body9.preheader
for.body9.preheader: ; preds = %for.cond5.preheader
%2 = add i32 %.lcssa, 1
%3 = sub i32 %2, %1
%wide.trip.count = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 6
br i1 %min.iters.check, label %for.body9.preheader82, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body9.preheader
%4 = add nsw i64 %wide.trip.count, -1
%5 = add i32 %1, -1
%6 = trunc i64 %4 to i32
%7 = add i32 %5, %6
%8 = icmp slt i32 %7, %5
%9 = icmp ugt i64 %4, 4294967295
%10 = or i1 %8, %9
br i1 %10, label %for.body9.preheader82, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%offset.idx = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 9223372036854775807, i64 9223372036854775807>, %vector.ph ], [ %35, %vector.body ]
%vec.phi78 = phi <2 x i64> [ <i64 9223372036854775807, i64 9223372036854775807>, %vector.ph ], [ %36, %vector.body ]
%11 = trunc i64 %offset.idx to i32
%12 = add i32 %11, -1
%13 = add i32 %12, %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, ptr %call1, i64 %14
%wide.load = load <2 x i32>, ptr %15, align 4, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 2
%wide.load79 = load <2 x i32>, ptr %16, align 4, !tbaa !5
%17 = sext <2 x i32> %wide.load to <2 x i64>
%18 = sext <2 x i32> %wide.load79 to <2 x i64>
%19 = getelementptr inbounds i32, ptr %call1, i64 %offset.idx
%wide.load80 = load <2 x i32>, ptr %19, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 2
%wide.load81 = load <2 x i32>, ptr %20, align 4, !tbaa !5
%21 = sext <2 x i32> %wide.load80 to <2 x i64>
%22 = sext <2 x i32> %wide.load81 to <2 x i64>
%23 = sub nsw <2 x i64> %17, %21
%24 = sub nsw <2 x i64> %18, %22
%25 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %wide.load, i1 true)
%26 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %wide.load79, i1 true)
%27 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %wide.load80, i1 true)
%28 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %wide.load81, i1 true)
%29 = call <2 x i32> @llvm.umin.v2i32(<2 x i32> %25, <2 x i32> %27)
%30 = call <2 x i32> @llvm.umin.v2i32(<2 x i32> %26, <2 x i32> %28)
%31 = zext <2 x i32> %29 to <2 x i64>
%32 = zext <2 x i32> %30 to <2 x i64>
%33 = add nsw <2 x i64> %23, %31
%34 = add nsw <2 x i64> %24, %32
%35 = call <2 x i64> @llvm.smin.v2i64(<2 x i64> %33, <2 x i64> %vec.phi)
%36 = call <2 x i64> @llvm.smin.v2i64(<2 x i64> %34, <2 x i64> %vec.phi78)
%index.next = add nuw i64 %offset.idx, 4
%37 = icmp eq i64 %index.next, %n.vec
br i1 %37, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = call <2 x i64> @llvm.smin.v2i64(<2 x i64> %35, <2 x i64> %36)
%38 = call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup8, label %for.body9.preheader82
for.body9.preheader82: ; preds = %vector.scevcheck, %for.body9.preheader, %middle.block
%indvars.iv72.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %for.body9.preheader ], [ %n.vec, %middle.block ]
%ans.067.ph = phi i64 [ 9223372036854775807, %vector.scevcheck ], [ 9223372036854775807, %for.body9.preheader ], [ %38, %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 i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%39 = load i32, ptr %N, align 4, !tbaa !5
%40 = sext i32 %39 to i64
%cmp = icmp slt i64 %indvars.iv.next, %40
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !13
for.cond.cleanup8: ; preds = %for.body9, %middle.block, %for.cond5.preheader
%ans.0.lcssa = phi i64 [ 9223372036854775807, %for.cond5.preheader ], [ %38, %middle.block ], [ %ans.1, %for.body9 ]
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
for.body9: ; preds = %for.body9.preheader82, %for.body9
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.body9 ], [ %indvars.iv72.ph, %for.body9.preheader82 ]
%ans.067 = phi i64 [ %ans.1, %for.body9 ], [ %ans.067.ph, %for.body9.preheader82 ]
%41 = trunc i64 %indvars.iv72 to i32
%42 = add i32 %41, -1
%sub10 = add i32 %42, %1
%idxprom11 = sext i32 %sub10 to i64
%arrayidx12 = getelementptr inbounds i32, ptr %call1, i64 %idxprom11
%43 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%conv13 = sext i32 %43 to i64
%arrayidx15 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv72
%44 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%conv16 = sext i32 %44 to i64
%sub17 = sub nsw i64 %conv13, %conv16
%45 = call i32 @llvm.abs.i32(i32 %43, i1 true)
%46 = call i32 @llvm.abs.i32(i32 %44, i1 true)
%. = call i32 @llvm.umin.i32(i32 %45, i32 %46)
%conv30.pn = zext i32 %. to i64
%tmp.0 = add nsw i64 %sub17, %conv30.pn
%ans.1 = call i64 @llvm.smin.i64(i64 %tmp.0, i64 %ans.067)
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%exitcond.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup8, label %for.body9, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.umin.v2i32(<2 x i32>, <2 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = 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}
|
#include <stdio.h>
#define DOT(v1, v2) (v1.x * v2.x + v1.y * v2.y)
#define NORM(v) (v.x * v.x + v.y * v.y)
typedef struct { double x, y; } point_t;
typedef point_t vector_t;
typedef struct { point_t p0, p1; } segment_t;
typedef segment_t line_t;
static vector_t plus(vector_t v1, vector_t v2) {
vector_t ret = { v1.x + v2.x, v1.y + v2.y };
return ret;
}
static vector_t minus(vector_t v1, vector_t v2) {
vector_t ret = { v1.x - v2.x, v1.y - v2.y };
return ret;
}
static vector_t multiple(vector_t v, double s) {
vector_t ret = { v.x * s, v.y * s };
return ret;
}
static point_t project(line_t l, point_t p) {
vector_t base = minus(l.p1, l.p0);
double r = DOT(minus(p, l.p0), base) / NORM(base);
return plus(l.p0, multiple(base, r));
}
static point_t reflect(line_t l, point_t p) {
return plus(p, multiple(minus(project(l, p), p), 2.0));
}
int main(int argc, char **argv) {
line_t l;
point_t p;
int q, i;
scanf("%lf %lf %lf %lf", &l.p0.x, &l.p0.y, &l.p1.x, &l.p1.y);
scanf("%d", &q);
for (i = 0; i < q; ++i) {
scanf("%lf %lf", &p.x, &p.y);
p = reflect(l, p);
printf("%.10lf %.10lf\n", p.x, p.y);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249189/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249189/source.c"
target datalayout = "e-m:e-p270: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.segment_t = type { %struct.point_t, %struct.point_t }
%struct.point_t = type { double, double }
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"%lf %lf\00", align 1
@.str.3 = private unnamed_addr constant [15 x i8] c"%.10lf %.10lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%l = alloca %struct.segment_t, align 16
%p = alloca %struct.point_t, align 16
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
%y = getelementptr inbounds %struct.point_t, ptr %l, i64 0, i32 1
%p1 = getelementptr inbounds %struct.segment_t, ptr %l, i64 0, i32 1
%y4 = getelementptr inbounds %struct.segment_t, ptr %l, i64 0, i32 1, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %y, ptr noundef nonnull %p1, ptr noundef nonnull %y4)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %q)
%0 = load i32, ptr %q, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%y7 = getelementptr inbounds %struct.point_t, ptr %p, i64 0, i32 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.015 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %p, ptr noundef nonnull %y7)
%1 = load <2 x double>, ptr %p, align 16
%2 = load <2 x double>, ptr %p1, align 16
%3 = load <2 x double>, ptr %l, align 16
%4 = fsub <2 x double> %2, %3
%5 = fsub <2 x double> %1, %3
%6 = fsub <2 x double> %1, %3
%7 = shufflevector <2 x double> %4, <2 x double> %6, <2 x i32> <i32 3, i32 1>
%8 = shufflevector <2 x double> %4, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%9 = fmul <2 x double> %7, %8
%10 = shufflevector <2 x double> %4, <2 x double> poison, <2 x i32> zeroinitializer
%11 = shufflevector <2 x double> %5, <2 x double> %10, <2 x i32> <i32 0, i32 3>
%12 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %10, <2 x double> %9)
%13 = extractelement <2 x double> %12, i64 0
%14 = extractelement <2 x double> %12, i64 1
%div.i.i = fdiv double %13, %14
%15 = insertelement <2 x double> poison, double %div.i.i, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = fmul <2 x double> %4, %16
%18 = fadd <2 x double> %3, %17
%19 = fsub <2 x double> %18, %1
%20 = fmul <2 x double> %19, <double 2.000000e+00, double 2.000000e+00>
%21 = fadd <2 x double> %1, %20
store <2 x double> %21, ptr %p, align 16
%22 = extractelement <2 x double> %21, i64 0
%23 = extractelement <2 x double> %21, i64 1
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %22, double noundef %23)
%inc = add nuw nsw i32 %i.015, 1
%24 = load i32, ptr %q, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %24
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 32, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #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"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.