Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main(void){
int n;
int a,b;
scanf("%d", &n);
if(n == 1){
printf("Hello World");
}else if ( n == 2){
scanf("%d", &a);
scanf("%d", &b);
printf("%d",a+b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162046/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162046/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [12 x i8] c"Hello World\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
switch i32 %0, label %if.end7 [
i32 1, label %if.then
i32 2, label %if.then3
]
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end7
if.then3: ; preds = %entry
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
br label %if.end7
if.end7: ; preds = %entry, %if.then3, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int n, a, b;
scanf("%d", &n);
if(n==1){
printf("Hello World\n");
}else{
scanf("%d", &a);
scanf("%d", &b);
printf("%d\n", a+b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162103/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162103/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [12 x i8] c"Hello World\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
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 %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"}
|
#include<stdio.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(j,m) for(int (j)=0;(j)<(m);(j)++)
#define max(x,y) x>y?x:y
int main() {
int h,w,m;
scanf("%d %d %d", &h,&w,&m);
int hc[600000] = {0};
int wc[600000] = {0};
int hset[600000] = {0};
int wset[600000] = {0};
int bh,bw;
rep(i,m){
scanf("%d %d", &bh,&bw);
bh--;
bw--;
hc[bh] += 1;
wc[bw] += 1;
hset[i] = bh;
wset[i] = bw;
}
int maxh = -1;
int maxw = -1;
int maxb = -1;
rep(i,h){
maxh = max(maxh,hc[i]);
}
rep(i,w){
maxw = max(maxw,wc[i]);
}
rep(i,m){
maxb = max(maxb,hc[hset[i]] + wc[wset[i]]);
}
long long int hmc = 0, wmc = 0, bmc = 0;
rep(i,h){
if(maxh == hc[i]) hmc++;
}
rep(i,w){
if(maxw == wc[i]) wmc++;
}
rep(i,m){
if(maxb == hc[hset[i]] + wc[wset[i]]) bmc++;
}
int ans = maxh + maxw;
if(maxb == maxh + maxw){
if(bmc == hmc * wmc){
ans--;
}
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162154/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162154/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%m = alloca i32, align 4
%hc = alloca [600000 x i32], align 16
%wc = alloca [600000 x i32], align 16
%hset = alloca [600000 x i32], align 16
%wset = alloca [600000 x i32], align 16
%bh = alloca i32, align 4
%bw = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 2400000, ptr nonnull %hc) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400000) %hc, i8 0, i64 2400000, i1 false)
call void @llvm.lifetime.start.p0(i64 2400000, ptr nonnull %wc) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400000) %wc, i8 0, i64 2400000, i1 false)
call void @llvm.lifetime.start.p0(i64 2400000, ptr nonnull %hset) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400000) %hset, i8 0, i64 2400000, i1 false)
call void @llvm.lifetime.start.p0(i64 2400000, ptr nonnull %wset) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400000) %wset, i8 0, i64 2400000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %bh) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %bw) #5
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp169 = icmp sgt i32 %0, 0
br i1 %cmp169, label %for.body, label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body, %entry
%.lcssa168 = phi i32 [ %0, %entry ], [ %12, %for.body ]
%1 = load i32, ptr %h, align 4, !tbaa !5
%cmp12171 = icmp sgt i32 %1, 0
br i1 %cmp12171, label %for.body14.preheader, label %for.cond24.preheader
for.body14.preheader: ; preds = %for.cond11.preheader
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 8
br i1 %min.iters.check, label %for.body14.preheader288, label %vector.ph
vector.ph: ; preds = %for.body14.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph ], [ %4, %vector.body ]
%vec.phi226 = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph ], [ %5, %vector.body ]
%2 = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load227 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%5 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi226, <4 x i32> %wide.load227)
%index.next = add nuw i64 %index, 8
%6 = icmp eq i64 %index.next, %n.vec
br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %4, <4 x i32> %5)
%7 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond24.preheader, label %for.body14.preheader288
for.body14.preheader288: ; preds = %for.body14.preheader, %middle.block
%indvars.iv198.ph = phi i64 [ 0, %for.body14.preheader ], [ %n.vec, %middle.block ]
%maxh.0172.ph = phi i32 [ -1, %for.body14.preheader ], [ %7, %middle.block ]
br label %for.body14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %bh, ptr noundef nonnull %bw)
%8 = load i32, ptr %bh, align 4, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %bh, align 4, !tbaa !5
%9 = load i32, ptr %bw, align 4, !tbaa !5
%dec2 = add nsw i32 %9, -1
store i32 %dec2, ptr %bw, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %idxprom
%10 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %10, 1
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
%idxprom3 = sext i32 %dec2 to i64
%arrayidx4 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %idxprom3
%11 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%add5 = add nsw i32 %11, 1
store i32 %add5, ptr %arrayidx4, align 4, !tbaa !5
%arrayidx7 = getelementptr inbounds [600000 x i32], ptr %hset, i64 0, i64 %indvars.iv
store i32 %dec, ptr %arrayidx7, align 4, !tbaa !5
%arrayidx9 = getelementptr inbounds [600000 x i32], ptr %wset, i64 0, i64 %indvars.iv
store i32 %dec2, ptr %arrayidx9, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %m, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp, label %for.body, label %for.cond11.preheader, !llvm.loop !13
for.cond24.preheader: ; preds = %for.body14, %middle.block, %for.cond11.preheader
%maxh.0.lcssa = phi i32 [ -1, %for.cond11.preheader ], [ %7, %middle.block ], [ %maxh.0., %for.body14 ]
%14 = load i32, ptr %w, align 4, !tbaa !5
%cmp25176 = icmp sgt i32 %14, 0
br i1 %cmp25176, label %for.body27.preheader, label %for.cond41.preheader
for.body27.preheader: ; preds = %for.cond24.preheader
%wide.trip.count204 = zext i32 %14 to i64
%min.iters.check230 = icmp ult i32 %14, 8
br i1 %min.iters.check230, label %for.body27.preheader285, label %vector.ph231
vector.ph231: ; preds = %for.body27.preheader
%n.vec233 = and i64 %wide.trip.count204, 4294967288
br label %vector.body236
vector.body236: ; preds = %vector.body236, %vector.ph231
%index237 = phi i64 [ 0, %vector.ph231 ], [ %index.next242, %vector.body236 ]
%vec.phi238 = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph231 ], [ %17, %vector.body236 ]
%vec.phi239 = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, %vector.ph231 ], [ %18, %vector.body236 ]
%15 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %index237
%wide.load240 = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load241 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi238, <4 x i32> %wide.load240)
%18 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi239, <4 x i32> %wide.load241)
%index.next242 = add nuw i64 %index237, 8
%19 = icmp eq i64 %index.next242, %n.vec233
br i1 %19, label %middle.block228, label %vector.body236, !llvm.loop !14
middle.block228: ; preds = %vector.body236
%rdx.minmax243 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %17, <4 x i32> %18)
%20 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax243)
%cmp.n235 = icmp eq i64 %n.vec233, %wide.trip.count204
br i1 %cmp.n235, label %for.cond41.preheader, label %for.body27.preheader285
for.body27.preheader285: ; preds = %for.body27.preheader, %middle.block228
%indvars.iv201.ph = phi i64 [ 0, %for.body27.preheader ], [ %n.vec233, %middle.block228 ]
%maxw.0177.ph = phi i32 [ -1, %for.body27.preheader ], [ %20, %middle.block228 ]
br label %for.body27
for.body14: ; preds = %for.body14.preheader288, %for.body14
%indvars.iv198 = phi i64 [ %indvars.iv.next199, %for.body14 ], [ %indvars.iv198.ph, %for.body14.preheader288 ]
%maxh.0172 = phi i32 [ %maxh.0., %for.body14 ], [ %maxh.0172.ph, %for.body14.preheader288 ]
%arrayidx16 = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %indvars.iv198
%21 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%maxh.0. = call i32 @llvm.smax.i32(i32 %maxh.0172, i32 %21)
%indvars.iv.next199 = add nuw nsw i64 %indvars.iv198, 1
%exitcond.not = icmp eq i64 %indvars.iv.next199, %wide.trip.count
br i1 %exitcond.not, label %for.cond24.preheader, label %for.body14, !llvm.loop !15
for.cond41.preheader: ; preds = %for.body27, %middle.block228, %for.cond24.preheader
%maxw.0.lcssa = phi i32 [ -1, %for.cond24.preheader ], [ %20, %middle.block228 ], [ %maxw.0., %for.body27 ]
%cmp42181 = icmp sgt i32 %.lcssa168, 0
br i1 %cmp42181, label %for.body44.preheader, label %for.cond72.preheader
for.body44.preheader: ; preds = %for.cond41.preheader
%wide.trip.count209 = zext i32 %.lcssa168 to i64
%xtraiter = and i64 %wide.trip.count209, 1
%22 = icmp eq i32 %.lcssa168, 1
br i1 %22, label %for.cond72.preheader.loopexit.unr-lcssa, label %for.body44.preheader.new
for.body44.preheader.new: ; preds = %for.body44.preheader
%unroll_iter = and i64 %wide.trip.count209, 4294967294
br label %for.body44
for.body27: ; preds = %for.body27.preheader285, %for.body27
%indvars.iv201 = phi i64 [ %indvars.iv.next202, %for.body27 ], [ %indvars.iv201.ph, %for.body27.preheader285 ]
%maxw.0177 = phi i32 [ %maxw.0., %for.body27 ], [ %maxw.0177.ph, %for.body27.preheader285 ]
%arrayidx29 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %indvars.iv201
%23 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%maxw.0. = call i32 @llvm.smax.i32(i32 %maxw.0177, i32 %23)
%indvars.iv.next202 = add nuw nsw i64 %indvars.iv201, 1
%exitcond205.not = icmp eq i64 %indvars.iv.next202, %wide.trip.count204
br i1 %exitcond205.not, label %for.cond41.preheader, label %for.body27, !llvm.loop !16
for.cond72.preheader.loopexit.unr-lcssa: ; preds = %for.body44, %for.body44.preheader
%maxb.0.add53.lcssa.ph = phi i32 [ undef, %for.body44.preheader ], [ %maxb.0.add53.1, %for.body44 ]
%indvars.iv206.unr = phi i64 [ 0, %for.body44.preheader ], [ %indvars.iv.next207.1, %for.body44 ]
%maxb.0182.unr = phi i32 [ -1, %for.body44.preheader ], [ %maxb.0.add53.1, %for.body44 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond72.preheader, label %for.body44.epil
for.body44.epil: ; preds = %for.cond72.preheader.loopexit.unr-lcssa
%arrayidx46.epil = getelementptr inbounds [600000 x i32], ptr %hset, i64 0, i64 %indvars.iv206.unr
%24 = load i32, ptr %arrayidx46.epil, align 4, !tbaa !5
%idxprom47.epil = sext i32 %24 to i64
%arrayidx48.epil = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %idxprom47.epil
%25 = load i32, ptr %arrayidx48.epil, align 4, !tbaa !5
%arrayidx50.epil = getelementptr inbounds [600000 x i32], ptr %wset, i64 0, i64 %indvars.iv206.unr
%26 = load i32, ptr %arrayidx50.epil, align 4, !tbaa !5
%idxprom51.epil = sext i32 %26 to i64
%arrayidx52.epil = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %idxprom51.epil
%27 = load i32, ptr %arrayidx52.epil, align 4, !tbaa !5
%add53.epil = add nsw i32 %27, %25
%maxb.0.add53.epil = call i32 @llvm.smax.i32(i32 %maxb.0182.unr, i32 %add53.epil)
br label %for.cond72.preheader
for.cond72.preheader: ; preds = %for.body44.epil, %for.cond72.preheader.loopexit.unr-lcssa, %for.cond41.preheader
%maxb.0.lcssa = phi i32 [ -1, %for.cond41.preheader ], [ %maxb.0.add53.lcssa.ph, %for.cond72.preheader.loopexit.unr-lcssa ], [ %maxb.0.add53.epil, %for.body44.epil ]
br i1 %cmp12171, label %for.body75.preheader, label %for.cond84.preheader
for.body75.preheader: ; preds = %for.cond72.preheader
%wide.trip.count214 = zext i32 %1 to i64
%min.iters.check247 = icmp ult i32 %1, 4
br i1 %min.iters.check247, label %for.body75.preheader282, label %vector.ph248
vector.ph248: ; preds = %for.body75.preheader
%n.vec250 = and i64 %wide.trip.count214, 4294967292
%broadcast.splatinsert = insertelement <2 x i32> poison, i32 %maxh.0.lcssa, i64 0
%broadcast.splat = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
br label %vector.body253
vector.body253: ; preds = %vector.body253, %vector.ph248
%index254 = phi i64 [ 0, %vector.ph248 ], [ %index.next259, %vector.body253 ]
%vec.phi255 = phi <2 x i64> [ zeroinitializer, %vector.ph248 ], [ %34, %vector.body253 ]
%vec.phi256 = phi <2 x i64> [ zeroinitializer, %vector.ph248 ], [ %35, %vector.body253 ]
%28 = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %index254
%wide.load257 = load <2 x i32>, ptr %28, align 16, !tbaa !5
%29 = getelementptr inbounds i32, ptr %28, i64 2
%wide.load258 = load <2 x i32>, ptr %29, align 8, !tbaa !5
%30 = icmp eq <2 x i32> %broadcast.splat, %wide.load257
%31 = icmp eq <2 x i32> %broadcast.splat, %wide.load258
%32 = zext <2 x i1> %30 to <2 x i64>
%33 = zext <2 x i1> %31 to <2 x i64>
%34 = add <2 x i64> %vec.phi255, %32
%35 = add <2 x i64> %vec.phi256, %33
%index.next259 = add nuw i64 %index254, 4
%36 = icmp eq i64 %index.next259, %n.vec250
br i1 %36, label %middle.block245, label %vector.body253, !llvm.loop !17
middle.block245: ; preds = %vector.body253
%bin.rdx = add <2 x i64> %35, %34
%37 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n252 = icmp eq i64 %n.vec250, %wide.trip.count214
br i1 %cmp.n252, label %for.cond84.preheader, label %for.body75.preheader282
for.body75.preheader282: ; preds = %for.body75.preheader, %middle.block245
%indvars.iv211.ph = phi i64 [ 0, %for.body75.preheader ], [ %n.vec250, %middle.block245 ]
%hmc.0186.ph = phi i64 [ 0, %for.body75.preheader ], [ %37, %middle.block245 ]
br label %for.body75
for.body44: ; preds = %for.body44, %for.body44.preheader.new
%indvars.iv206 = phi i64 [ 0, %for.body44.preheader.new ], [ %indvars.iv.next207.1, %for.body44 ]
%maxb.0182 = phi i32 [ -1, %for.body44.preheader.new ], [ %maxb.0.add53.1, %for.body44 ]
%niter = phi i64 [ 0, %for.body44.preheader.new ], [ %niter.next.1, %for.body44 ]
%arrayidx46 = getelementptr inbounds [600000 x i32], ptr %hset, i64 0, i64 %indvars.iv206
%38 = load i32, ptr %arrayidx46, align 8, !tbaa !5
%idxprom47 = sext i32 %38 to i64
%arrayidx48 = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %idxprom47
%39 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%arrayidx50 = getelementptr inbounds [600000 x i32], ptr %wset, i64 0, i64 %indvars.iv206
%40 = load i32, ptr %arrayidx50, align 8, !tbaa !5
%idxprom51 = sext i32 %40 to i64
%arrayidx52 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %idxprom51
%41 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%add53 = add nsw i32 %41, %39
%maxb.0.add53 = call i32 @llvm.smax.i32(i32 %maxb.0182, i32 %add53)
%indvars.iv.next207 = or i64 %indvars.iv206, 1
%arrayidx46.1 = getelementptr inbounds [600000 x i32], ptr %hset, i64 0, i64 %indvars.iv.next207
%42 = load i32, ptr %arrayidx46.1, align 4, !tbaa !5
%idxprom47.1 = sext i32 %42 to i64
%arrayidx48.1 = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %idxprom47.1
%43 = load i32, ptr %arrayidx48.1, align 4, !tbaa !5
%arrayidx50.1 = getelementptr inbounds [600000 x i32], ptr %wset, i64 0, i64 %indvars.iv.next207
%44 = load i32, ptr %arrayidx50.1, align 4, !tbaa !5
%idxprom51.1 = sext i32 %44 to i64
%arrayidx52.1 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %idxprom51.1
%45 = load i32, ptr %arrayidx52.1, align 4, !tbaa !5
%add53.1 = add nsw i32 %45, %43
%maxb.0.add53.1 = call i32 @llvm.smax.i32(i32 %maxb.0.add53, i32 %add53.1)
%indvars.iv.next207.1 = add nuw nsw i64 %indvars.iv206, 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.cond72.preheader.loopexit.unr-lcssa, label %for.body44, !llvm.loop !18
for.cond84.preheader: ; preds = %for.body75, %middle.block245, %for.cond72.preheader
%hmc.0.lcssa = phi i64 [ 0, %for.cond72.preheader ], [ %37, %middle.block245 ], [ %spec.select, %for.body75 ]
br i1 %cmp25176, label %for.body87.preheader, label %for.cond98.preheader
for.body87.preheader: ; preds = %for.cond84.preheader
%wide.trip.count219 = zext i32 %14 to i64
%min.iters.check263 = icmp ult i32 %14, 4
br i1 %min.iters.check263, label %for.body87.preheader280, label %vector.ph264
vector.ph264: ; preds = %for.body87.preheader
%n.vec266 = and i64 %wide.trip.count219, 4294967292
%broadcast.splatinsert275 = insertelement <2 x i32> poison, i32 %maxw.0.lcssa, i64 0
%broadcast.splat276 = shufflevector <2 x i32> %broadcast.splatinsert275, <2 x i32> poison, <2 x i32> zeroinitializer
br label %vector.body269
vector.body269: ; preds = %vector.body269, %vector.ph264
%index270 = phi i64 [ 0, %vector.ph264 ], [ %index.next277, %vector.body269 ]
%vec.phi271 = phi <2 x i64> [ zeroinitializer, %vector.ph264 ], [ %52, %vector.body269 ]
%vec.phi272 = phi <2 x i64> [ zeroinitializer, %vector.ph264 ], [ %53, %vector.body269 ]
%46 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %index270
%wide.load273 = load <2 x i32>, ptr %46, align 16, !tbaa !5
%47 = getelementptr inbounds i32, ptr %46, i64 2
%wide.load274 = load <2 x i32>, ptr %47, align 8, !tbaa !5
%48 = icmp eq <2 x i32> %broadcast.splat276, %wide.load273
%49 = icmp eq <2 x i32> %broadcast.splat276, %wide.load274
%50 = zext <2 x i1> %48 to <2 x i64>
%51 = zext <2 x i1> %49 to <2 x i64>
%52 = add <2 x i64> %vec.phi271, %50
%53 = add <2 x i64> %vec.phi272, %51
%index.next277 = add nuw i64 %index270, 4
%54 = icmp eq i64 %index.next277, %n.vec266
br i1 %54, label %middle.block261, label %vector.body269, !llvm.loop !19
middle.block261: ; preds = %vector.body269
%bin.rdx278 = add <2 x i64> %53, %52
%55 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx278)
%cmp.n268 = icmp eq i64 %n.vec266, %wide.trip.count219
br i1 %cmp.n268, label %for.cond98.preheader, label %for.body87.preheader280
for.body87.preheader280: ; preds = %for.body87.preheader, %middle.block261
%indvars.iv216.ph = phi i64 [ 0, %for.body87.preheader ], [ %n.vec266, %middle.block261 ]
%wmc.0190.ph = phi i64 [ 0, %for.body87.preheader ], [ %55, %middle.block261 ]
br label %for.body87
for.body75: ; preds = %for.body75.preheader282, %for.body75
%indvars.iv211 = phi i64 [ %indvars.iv.next212, %for.body75 ], [ %indvars.iv211.ph, %for.body75.preheader282 ]
%hmc.0186 = phi i64 [ %spec.select, %for.body75 ], [ %hmc.0186.ph, %for.body75.preheader282 ]
%arrayidx77 = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %indvars.iv211
%56 = load i32, ptr %arrayidx77, align 4, !tbaa !5
%cmp78 = icmp eq i32 %maxh.0.lcssa, %56
%inc79 = zext i1 %cmp78 to i64
%spec.select = add nuw nsw i64 %hmc.0186, %inc79
%indvars.iv.next212 = add nuw nsw i64 %indvars.iv211, 1
%exitcond215.not = icmp eq i64 %indvars.iv.next212, %wide.trip.count214
br i1 %exitcond215.not, label %for.cond84.preheader, label %for.body75, !llvm.loop !20
for.cond98.preheader: ; preds = %for.body87, %middle.block261, %for.cond84.preheader
%wmc.0.lcssa = phi i64 [ 0, %for.cond84.preheader ], [ %55, %middle.block261 ], [ %spec.select165, %for.body87 ]
br i1 %cmp42181, label %for.body101.preheader, label %for.cond.cleanup100
for.body101.preheader: ; preds = %for.cond98.preheader
%wide.trip.count224 = zext i32 %.lcssa168 to i64
%xtraiter293 = and i64 %wide.trip.count224, 1
%57 = icmp eq i32 %.lcssa168, 1
br i1 %57, label %for.cond.cleanup100.loopexit.unr-lcssa, label %for.body101.preheader.new
for.body101.preheader.new: ; preds = %for.body101.preheader
%unroll_iter296 = and i64 %wide.trip.count224, 4294967294
br label %for.body101
for.body87: ; preds = %for.body87.preheader280, %for.body87
%indvars.iv216 = phi i64 [ %indvars.iv.next217, %for.body87 ], [ %indvars.iv216.ph, %for.body87.preheader280 ]
%wmc.0190 = phi i64 [ %spec.select165, %for.body87 ], [ %wmc.0190.ph, %for.body87.preheader280 ]
%arrayidx89 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %indvars.iv216
%58 = load i32, ptr %arrayidx89, align 4, !tbaa !5
%cmp90 = icmp eq i32 %maxw.0.lcssa, %58
%inc92 = zext i1 %cmp90 to i64
%spec.select165 = add nuw nsw i64 %wmc.0190, %inc92
%indvars.iv.next217 = add nuw nsw i64 %indvars.iv216, 1
%exitcond220.not = icmp eq i64 %indvars.iv.next217, %wide.trip.count219
br i1 %exitcond220.not, label %for.cond98.preheader, label %for.body87, !llvm.loop !21
for.cond.cleanup100.loopexit.unr-lcssa: ; preds = %for.body101, %for.body101.preheader
%spec.select166.lcssa.ph = phi i64 [ undef, %for.body101.preheader ], [ %spec.select166.1, %for.body101 ]
%indvars.iv221.unr = phi i64 [ 0, %for.body101.preheader ], [ %indvars.iv.next222.1, %for.body101 ]
%bmc.0194.unr = phi i64 [ 0, %for.body101.preheader ], [ %spec.select166.1, %for.body101 ]
%lcmp.mod294.not = icmp eq i64 %xtraiter293, 0
br i1 %lcmp.mod294.not, label %for.cond.cleanup100, label %for.body101.epil
for.body101.epil: ; preds = %for.cond.cleanup100.loopexit.unr-lcssa
%arrayidx103.epil = getelementptr inbounds [600000 x i32], ptr %hset, i64 0, i64 %indvars.iv221.unr
%59 = load i32, ptr %arrayidx103.epil, align 4, !tbaa !5
%idxprom104.epil = sext i32 %59 to i64
%arrayidx105.epil = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %idxprom104.epil
%60 = load i32, ptr %arrayidx105.epil, align 4, !tbaa !5
%arrayidx107.epil = getelementptr inbounds [600000 x i32], ptr %wset, i64 0, i64 %indvars.iv221.unr
%61 = load i32, ptr %arrayidx107.epil, align 4, !tbaa !5
%idxprom108.epil = sext i32 %61 to i64
%arrayidx109.epil = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %idxprom108.epil
%62 = load i32, ptr %arrayidx109.epil, align 4, !tbaa !5
%add110.epil = add nsw i32 %62, %60
%cmp111.epil = icmp eq i32 %maxb.0.lcssa, %add110.epil
%inc113.epil = zext i1 %cmp111.epil to i64
%spec.select166.epil = add nuw nsw i64 %bmc.0194.unr, %inc113.epil
br label %for.cond.cleanup100
for.cond.cleanup100: ; preds = %for.body101.epil, %for.cond.cleanup100.loopexit.unr-lcssa, %for.cond98.preheader
%bmc.0.lcssa = phi i64 [ 0, %for.cond98.preheader ], [ %spec.select166.lcssa.ph, %for.cond.cleanup100.loopexit.unr-lcssa ], [ %spec.select166.epil, %for.body101.epil ]
%add118 = add nsw i32 %maxw.0.lcssa, %maxh.0.lcssa
%cmp120 = icmp eq i32 %maxb.0.lcssa, %add118
%mul = mul nsw i64 %wmc.0.lcssa, %hmc.0.lcssa
%cmp122 = icmp eq i64 %bmc.0.lcssa, %mul
%or.cond = select i1 %cmp120, i1 %cmp122, i1 false
%dec124 = sext i1 %or.cond to i32
%ans.0 = add nsw i32 %add118, %dec124
%call127 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %bw) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %bh) #5
call void @llvm.lifetime.end.p0(i64 2400000, ptr nonnull %wset) #5
call void @llvm.lifetime.end.p0(i64 2400000, ptr nonnull %hset) #5
call void @llvm.lifetime.end.p0(i64 2400000, ptr nonnull %wc) #5
call void @llvm.lifetime.end.p0(i64 2400000, ptr nonnull %hc) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
for.body101: ; preds = %for.body101, %for.body101.preheader.new
%indvars.iv221 = phi i64 [ 0, %for.body101.preheader.new ], [ %indvars.iv.next222.1, %for.body101 ]
%bmc.0194 = phi i64 [ 0, %for.body101.preheader.new ], [ %spec.select166.1, %for.body101 ]
%niter297 = phi i64 [ 0, %for.body101.preheader.new ], [ %niter297.next.1, %for.body101 ]
%arrayidx103 = getelementptr inbounds [600000 x i32], ptr %hset, i64 0, i64 %indvars.iv221
%63 = load i32, ptr %arrayidx103, align 8, !tbaa !5
%idxprom104 = sext i32 %63 to i64
%arrayidx105 = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %idxprom104
%64 = load i32, ptr %arrayidx105, align 4, !tbaa !5
%arrayidx107 = getelementptr inbounds [600000 x i32], ptr %wset, i64 0, i64 %indvars.iv221
%65 = load i32, ptr %arrayidx107, align 8, !tbaa !5
%idxprom108 = sext i32 %65 to i64
%arrayidx109 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %idxprom108
%66 = load i32, ptr %arrayidx109, align 4, !tbaa !5
%add110 = add nsw i32 %66, %64
%cmp111 = icmp eq i32 %maxb.0.lcssa, %add110
%inc113 = zext i1 %cmp111 to i64
%spec.select166 = add nuw nsw i64 %bmc.0194, %inc113
%indvars.iv.next222 = or i64 %indvars.iv221, 1
%arrayidx103.1 = getelementptr inbounds [600000 x i32], ptr %hset, i64 0, i64 %indvars.iv.next222
%67 = load i32, ptr %arrayidx103.1, align 4, !tbaa !5
%idxprom104.1 = sext i32 %67 to i64
%arrayidx105.1 = getelementptr inbounds [600000 x i32], ptr %hc, i64 0, i64 %idxprom104.1
%68 = load i32, ptr %arrayidx105.1, align 4, !tbaa !5
%arrayidx107.1 = getelementptr inbounds [600000 x i32], ptr %wset, i64 0, i64 %indvars.iv.next222
%69 = load i32, ptr %arrayidx107.1, align 4, !tbaa !5
%idxprom108.1 = sext i32 %69 to i64
%arrayidx109.1 = getelementptr inbounds [600000 x i32], ptr %wc, i64 0, i64 %idxprom108.1
%70 = load i32, ptr %arrayidx109.1, align 4, !tbaa !5
%add110.1 = add nsw i32 %70, %68
%cmp111.1 = icmp eq i32 %maxb.0.lcssa, %add110.1
%inc113.1 = zext i1 %cmp111.1 to i64
%spec.select166.1 = add nuw nsw i64 %spec.select166, %inc113.1
%indvars.iv.next222.1 = add nuw nsw i64 %indvars.iv221, 2
%niter297.next.1 = add i64 %niter297, 2
%niter297.ncmp.1 = icmp eq i64 %niter297.next.1, %unroll_iter296
br i1 %niter297.ncmp.1, label %for.cond.cleanup100.loopexit.unr-lcssa, label %for.body101, !llvm.loop !22
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10, !11, !12}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !11, !12}
!20 = distinct !{!20, !10, !12, !11}
!21 = distinct !{!21, !10, !12, !11}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
int main()
{
int i, N, a[200001], sum = 0;
scanf("%d", &N);
for (i = 1; i <= N; i++) {
scanf("%d", &(a[i]));
sum ^= a[i];
}
for (i = 1; i < N; i++) printf("%d ", sum ^ a[i]);
printf("%d\n", sum ^ a[N]);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162211/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162211/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%d\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca [200001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not27 = icmp slt i32 %0, 1
br i1 %cmp.not27, label %for.cond4.preheader.for.end13_crit_edge, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp530 = icmp sgt i32 %3, 1
br i1 %cmp530, label %for.body6, label %for.cond4.preheader.for.end13_crit_edge
for.cond4.preheader.for.end13_crit_edge: ; preds = %entry, %for.cond4.preheader
%sum.0.lcssa41 = phi i32 [ %xor, %for.cond4.preheader ], [ 0, %entry ]
%1 = phi i32 [ %3, %for.cond4.preheader ], [ %0, %entry ]
%.pre = sext i32 %1 to i64
br label %for.end13
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%sum.029 = phi i32 [ %xor, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%xor = xor i32 %2, %sum.029
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.body6: ; preds = %for.cond4.preheader, %for.body6
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %for.body6 ], [ 1, %for.cond4.preheader ]
%arrayidx8 = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %indvars.iv35
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%xor9 = xor i32 %5, %xor
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %xor9)
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp5 = icmp slt i64 %indvars.iv.next36, %7
br i1 %cmp5, label %for.body6, label %for.end13, !llvm.loop !11
for.end13: ; preds = %for.body6, %for.cond4.preheader.for.end13_crit_edge
%sum.0.lcssa40 = phi i32 [ %sum.0.lcssa41, %for.cond4.preheader.for.end13_crit_edge ], [ %xor, %for.body6 ]
%idxprom14.pre-phi = phi i64 [ %.pre, %for.cond4.preheader.for.end13_crit_edge ], [ %7, %for.body6 ]
%arrayidx15 = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %idxprom14.pre-phi
%8 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%xor16 = xor i32 %8, %sum.0.lcssa40
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %xor16)
%9 = load ptr, ptr @stdout, align 8, !tbaa !12
%call18 = call i32 @fflush(ptr noundef %9)
call void @llvm.lifetime.end.p0(i64 800004, 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: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
|
#include <stdio.h>
#include <math.h>
int main(void) {
long n;
scanf("%ld", &n);
long bit[n][30];
for (long i = 0; i < n; i++) {
for (long j = 0; j < 30; j++) {
bit[i][j] = 0;
}
}
long a;
for (long i = 0; i < n; i++) {
scanf("%ld", &a);
bit[i][0] = a;
for (long j = 1; j < 30; j++) {
bit[i][j] += bit[i][j-1]/2;
bit[i][j-1] %= 2;
}
}
long count[30];
for (long i = 0; i < 30; i++) {
count[i] = 0;
}
for (long i = 0; i < n; i++) {
for (long j = 0; j < 30; j++) {
if (bit[i][j] == 1) {
count[j]++;
}
}
}
long ans_bit[30];
long ans;
for (long i = 0; i < n; i++) {
for (long j = 0; j < 30; j++) {
if (count[j]%2 == 0) {
ans_bit[j] = bit[i][j];
} else {
if (bit[i][j] == 0) {
ans_bit[j] = 1;
} else {
ans_bit[j] = 0;
}
}
}
ans = 0;
for (long j = 0; j < 30; j++) {
ans += pow(2,j)*ans_bit[j];
}
printf("%ld", ans);
if (i != n-1) {
printf(" ");
} else {
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162262/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162262/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca i64, align 8
%count = alloca [30 x i64], align 16
%ans_bit = alloca [30 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca [30 x i64], i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp156 = icmp sgt i64 %2, 0
br i1 %cmp156, label %for.body13.preheader, label %for.cond.cleanup12.thread
for.cond.cleanup12.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %count) #7
call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %ans_bit) #7
br label %for.cond.cleanup68
for.body13.preheader: ; preds = %entry
%3 = mul nuw i64 %2, 240
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %3, i1 false), !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #7
br label %for.body13
for.cond.cleanup12: ; preds = %for.cond.cleanup20
call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %count) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(240) %count, i8 0, i64 240, i1 false), !tbaa !5
%cmp46163 = icmp sgt i64 %5, 0
br i1 %cmp46163, label %for.cond50.preheader, label %for.cond.cleanup47.thread
for.cond.cleanup47.thread: ; preds = %for.cond.cleanup12
call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %ans_bit) #7
br label %for.cond.cleanup68
for.body13: ; preds = %for.body13.preheader, %for.cond.cleanup20
%i9.0160 = phi i64 [ %inc33, %for.cond.cleanup20 ], [ 0, %for.body13.preheader ]
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%4 = load i64, ptr %a, align 8, !tbaa !5
%arrayidx15 = getelementptr inbounds [30 x i64], ptr %vla, i64 %i9.0160
store i64 %4, ptr %arrayidx15, align 16, !tbaa !5
br label %for.body21
for.cond.cleanup20: ; preds = %for.body21
%inc33 = add nuw nsw i64 %i9.0160, 1
%5 = load i64, ptr %n, align 8, !tbaa !5
%cmp11 = icmp slt i64 %inc33, %5
br i1 %cmp11, label %for.body13, label %for.cond.cleanup12, !llvm.loop !9
for.body21: ; preds = %for.body13, %for.body21
%6 = phi i64 [ %4, %for.body13 ], [ %add, %for.body21 ]
%j17.0158 = phi i64 [ 1, %for.body13 ], [ %inc30, %for.body21 ]
%sub = add nsw i64 %j17.0158, -1
%arrayidx23 = getelementptr inbounds [30 x i64], ptr %vla, i64 %i9.0160, i64 %sub
%div = sdiv i64 %6, 2
%arrayidx25 = getelementptr inbounds [30 x i64], ptr %vla, i64 %i9.0160, i64 %j17.0158
%7 = load i64, ptr %arrayidx25, align 8, !tbaa !5
%add = add nsw i64 %7, %div
store i64 %add, ptr %arrayidx25, align 8, !tbaa !5
%rem = srem i64 %6, 2
store i64 %rem, ptr %arrayidx23, align 8, !tbaa !5
%inc30 = add nuw nsw i64 %j17.0158, 1
%exitcond.not = icmp eq i64 %inc30, 30
br i1 %exitcond.not, label %for.cond.cleanup20, label %for.body21, !llvm.loop !11
for.cond50.preheader: ; preds = %for.cond.cleanup12, %for.cond.cleanup52
%i44.0164 = phi i64 [ %inc63, %for.cond.cleanup52 ], [ 0, %for.cond.cleanup12 ]
br label %for.body53
for.cond.cleanup47: ; preds = %for.cond.cleanup52
call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %ans_bit) #7
br i1 %cmp46163, label %for.cond71.preheader.preheader, label %for.cond.cleanup68
for.cond71.preheader.preheader: ; preds = %for.cond.cleanup47
%arrayidx100.1 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 1
%arrayidx100.2 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 2
%arrayidx100.3 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 3
%arrayidx100.4 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 4
%arrayidx100.5 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 5
%arrayidx100.6 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 6
%arrayidx100.7 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 7
%arrayidx100.8 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 8
%arrayidx100.9 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 9
%arrayidx100.10 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 10
%arrayidx100.11 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 11
%arrayidx100.12 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 12
%arrayidx100.13 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 13
%arrayidx100.14 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 14
%arrayidx100.15 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 15
%arrayidx100.16 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 16
%arrayidx100.17 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 17
%arrayidx100.18 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 18
%arrayidx100.19 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 19
%arrayidx100.20 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 20
%arrayidx100.21 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 21
%arrayidx100.22 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 22
%arrayidx100.23 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 23
%arrayidx100.24 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 24
%arrayidx100.25 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 25
%arrayidx100.26 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 26
%arrayidx100.27 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 27
%arrayidx100.28 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 28
%arrayidx100.29 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 29
br label %for.cond71.preheader
for.cond.cleanup52: ; preds = %for.inc59.1
%inc63 = add nuw nsw i64 %i44.0164, 1
%exitcond172.not = icmp eq i64 %inc63, %5
br i1 %exitcond172.not, label %for.cond.cleanup47, label %for.cond50.preheader, !llvm.loop !12
for.body53: ; preds = %for.inc59.1, %for.cond50.preheader
%j49.0162 = phi i64 [ 0, %for.cond50.preheader ], [ %inc60.1, %for.inc59.1 ]
%arrayidx55 = getelementptr inbounds [30 x i64], ptr %vla, i64 %i44.0164, i64 %j49.0162
%8 = load i64, ptr %arrayidx55, align 16, !tbaa !5
%cmp56 = icmp eq i64 %8, 1
br i1 %cmp56, label %if.then, label %for.inc59
if.then: ; preds = %for.body53
%arrayidx57 = getelementptr inbounds [30 x i64], ptr %count, i64 0, i64 %j49.0162
%9 = load i64, ptr %arrayidx57, align 16, !tbaa !5
%inc58 = add nsw i64 %9, 1
store i64 %inc58, ptr %arrayidx57, align 16, !tbaa !5
br label %for.inc59
for.inc59: ; preds = %for.body53, %if.then
%inc60 = or i64 %j49.0162, 1
%arrayidx55.1 = getelementptr inbounds [30 x i64], ptr %vla, i64 %i44.0164, i64 %inc60
%10 = load i64, ptr %arrayidx55.1, align 8, !tbaa !5
%cmp56.1 = icmp eq i64 %10, 1
br i1 %cmp56.1, label %if.then.1, label %for.inc59.1
if.then.1: ; preds = %for.inc59
%arrayidx57.1 = getelementptr inbounds [30 x i64], ptr %count, i64 0, i64 %inc60
%11 = load i64, ptr %arrayidx57.1, align 8, !tbaa !5
%inc58.1 = add nsw i64 %11, 1
store i64 %inc58.1, ptr %arrayidx57.1, align 8, !tbaa !5
br label %for.inc59.1
for.inc59.1: ; preds = %if.then.1, %for.inc59
%inc60.1 = add nuw nsw i64 %j49.0162, 2
%exitcond171.not.1 = icmp eq i64 %inc60.1, 30
br i1 %exitcond171.not.1, label %for.cond.cleanup52, label %for.body53, !llvm.loop !13
for.cond71.preheader: ; preds = %for.cond71.preheader.preheader, %for.body98.preheader
%i65.0169 = phi i64 [ %inc117, %for.body98.preheader ], [ 0, %for.cond71.preheader.preheader ]
br label %for.body74
for.cond.cleanup68: ; preds = %for.body98.preheader, %for.cond.cleanup12.thread, %for.cond.cleanup47.thread, %for.cond.cleanup47
call void @llvm.lifetime.end.p0(i64 240, ptr nonnull %ans_bit) #7
call void @llvm.lifetime.end.p0(i64 240, ptr nonnull %count) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #7
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #7
ret i32 0
for.body74: ; preds = %for.cond71.preheader, %for.inc91
%j70.0165 = phi i64 [ 0, %for.cond71.preheader ], [ %inc92, %for.inc91 ]
%arrayidx75 = getelementptr inbounds [30 x i64], ptr %count, i64 0, i64 %j70.0165
%12 = load i64, ptr %arrayidx75, align 8, !tbaa !5
%13 = and i64 %12, 1
%cmp77 = icmp eq i64 %13, 0
%arrayidx80 = getelementptr inbounds [30 x i64], ptr %vla, i64 %i65.0169, i64 %j70.0165
%14 = load i64, ptr %arrayidx80, align 8, !tbaa !5
br i1 %cmp77, label %if.then78, label %if.else
if.then78: ; preds = %for.body74
%arrayidx81 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 %j70.0165
store i64 %14, ptr %arrayidx81, align 8, !tbaa !5
br label %for.inc91
if.else: ; preds = %for.body74
%cmp84 = icmp eq i64 %14, 0
%arrayidx86 = getelementptr inbounds [30 x i64], ptr %ans_bit, i64 0, i64 %j70.0165
br i1 %cmp84, label %if.then85, label %if.else87
if.then85: ; preds = %if.else
store i64 1, ptr %arrayidx86, align 8, !tbaa !5
br label %for.inc91
if.else87: ; preds = %if.else
store i64 0, ptr %arrayidx86, align 8, !tbaa !5
br label %for.inc91
for.inc91: ; preds = %if.then78, %if.else87, %if.then85
%inc92 = add nuw nsw i64 %j70.0165, 1
%exitcond173.not = icmp eq i64 %inc92, 30
br i1 %exitcond173.not, label %for.body98.preheader, label %for.body74, !llvm.loop !14
for.body98.preheader: ; preds = %for.inc91
%exp2 = call double @exp2(double 0.000000e+00) #7
%15 = load i64, ptr %ans_bit, align 16, !tbaa !5
%conv101 = sitofp i64 %15 to double
%conv103 = fptosi double %conv101 to i64
%exp2.1 = call double @exp2(double 1.000000e+00) #7
%16 = load i64, ptr %arrayidx100.1, align 8, !tbaa !5
%conv101.1 = sitofp i64 %16 to double
%conv102.1 = sitofp i64 %conv103 to double
%17 = call double @llvm.fmuladd.f64(double %conv101.1, double 2.000000e+00, double %conv102.1)
%conv103.1 = fptosi double %17 to i64
%exp2.2 = call double @exp2(double 2.000000e+00) #7
%18 = load i64, ptr %arrayidx100.2, align 16, !tbaa !5
%conv101.2 = sitofp i64 %18 to double
%conv102.2 = sitofp i64 %conv103.1 to double
%19 = call double @llvm.fmuladd.f64(double %conv101.2, double 4.000000e+00, double %conv102.2)
%conv103.2 = fptosi double %19 to i64
%exp2.3 = call double @exp2(double 3.000000e+00) #7
%20 = load i64, ptr %arrayidx100.3, align 8, !tbaa !5
%conv101.3 = sitofp i64 %20 to double
%conv102.3 = sitofp i64 %conv103.2 to double
%21 = call double @llvm.fmuladd.f64(double %conv101.3, double 8.000000e+00, double %conv102.3)
%conv103.3 = fptosi double %21 to i64
%exp2.4 = call double @exp2(double 4.000000e+00) #7
%22 = load i64, ptr %arrayidx100.4, align 16, !tbaa !5
%conv101.4 = sitofp i64 %22 to double
%conv102.4 = sitofp i64 %conv103.3 to double
%23 = call double @llvm.fmuladd.f64(double %conv101.4, double 1.600000e+01, double %conv102.4)
%conv103.4 = fptosi double %23 to i64
%exp2.5 = call double @exp2(double 5.000000e+00) #7
%24 = load i64, ptr %arrayidx100.5, align 8, !tbaa !5
%conv101.5 = sitofp i64 %24 to double
%conv102.5 = sitofp i64 %conv103.4 to double
%25 = call double @llvm.fmuladd.f64(double %conv101.5, double 3.200000e+01, double %conv102.5)
%conv103.5 = fptosi double %25 to i64
%exp2.6 = call double @exp2(double 6.000000e+00) #7
%26 = load i64, ptr %arrayidx100.6, align 16, !tbaa !5
%conv101.6 = sitofp i64 %26 to double
%conv102.6 = sitofp i64 %conv103.5 to double
%27 = call double @llvm.fmuladd.f64(double %conv101.6, double 6.400000e+01, double %conv102.6)
%conv103.6 = fptosi double %27 to i64
%exp2.7 = call double @exp2(double 7.000000e+00) #7
%28 = load i64, ptr %arrayidx100.7, align 8, !tbaa !5
%conv101.7 = sitofp i64 %28 to double
%conv102.7 = sitofp i64 %conv103.6 to double
%29 = call double @llvm.fmuladd.f64(double %conv101.7, double 1.280000e+02, double %conv102.7)
%conv103.7 = fptosi double %29 to i64
%exp2.8 = call double @exp2(double 8.000000e+00) #7
%30 = load i64, ptr %arrayidx100.8, align 16, !tbaa !5
%conv101.8 = sitofp i64 %30 to double
%conv102.8 = sitofp i64 %conv103.7 to double
%31 = call double @llvm.fmuladd.f64(double %conv101.8, double 2.560000e+02, double %conv102.8)
%conv103.8 = fptosi double %31 to i64
%exp2.9 = call double @exp2(double 9.000000e+00) #7
%32 = load i64, ptr %arrayidx100.9, align 8, !tbaa !5
%conv101.9 = sitofp i64 %32 to double
%conv102.9 = sitofp i64 %conv103.8 to double
%33 = call double @llvm.fmuladd.f64(double %conv101.9, double 5.120000e+02, double %conv102.9)
%conv103.9 = fptosi double %33 to i64
%exp2.10 = call double @exp2(double 1.000000e+01) #7
%34 = load i64, ptr %arrayidx100.10, align 16, !tbaa !5
%conv101.10 = sitofp i64 %34 to double
%conv102.10 = sitofp i64 %conv103.9 to double
%35 = call double @llvm.fmuladd.f64(double %conv101.10, double 1.024000e+03, double %conv102.10)
%conv103.10 = fptosi double %35 to i64
%exp2.11 = call double @exp2(double 1.100000e+01) #7
%36 = load i64, ptr %arrayidx100.11, align 8, !tbaa !5
%conv101.11 = sitofp i64 %36 to double
%conv102.11 = sitofp i64 %conv103.10 to double
%37 = call double @llvm.fmuladd.f64(double %conv101.11, double 2.048000e+03, double %conv102.11)
%conv103.11 = fptosi double %37 to i64
%exp2.12 = call double @exp2(double 1.200000e+01) #7
%38 = load i64, ptr %arrayidx100.12, align 16, !tbaa !5
%conv101.12 = sitofp i64 %38 to double
%conv102.12 = sitofp i64 %conv103.11 to double
%39 = call double @llvm.fmuladd.f64(double %conv101.12, double 4.096000e+03, double %conv102.12)
%conv103.12 = fptosi double %39 to i64
%exp2.13 = call double @exp2(double 1.300000e+01) #7
%40 = load i64, ptr %arrayidx100.13, align 8, !tbaa !5
%conv101.13 = sitofp i64 %40 to double
%conv102.13 = sitofp i64 %conv103.12 to double
%41 = call double @llvm.fmuladd.f64(double %conv101.13, double 8.192000e+03, double %conv102.13)
%conv103.13 = fptosi double %41 to i64
%exp2.14 = call double @exp2(double 1.400000e+01) #7
%42 = load i64, ptr %arrayidx100.14, align 16, !tbaa !5
%conv101.14 = sitofp i64 %42 to double
%conv102.14 = sitofp i64 %conv103.13 to double
%43 = call double @llvm.fmuladd.f64(double %conv101.14, double 1.638400e+04, double %conv102.14)
%conv103.14 = fptosi double %43 to i64
%exp2.15 = call double @exp2(double 1.500000e+01) #7
%44 = load i64, ptr %arrayidx100.15, align 8, !tbaa !5
%conv101.15 = sitofp i64 %44 to double
%conv102.15 = sitofp i64 %conv103.14 to double
%45 = call double @llvm.fmuladd.f64(double %conv101.15, double 3.276800e+04, double %conv102.15)
%conv103.15 = fptosi double %45 to i64
%exp2.16 = call double @exp2(double 1.600000e+01) #7
%46 = load i64, ptr %arrayidx100.16, align 16, !tbaa !5
%conv101.16 = sitofp i64 %46 to double
%conv102.16 = sitofp i64 %conv103.15 to double
%47 = call double @llvm.fmuladd.f64(double %conv101.16, double 6.553600e+04, double %conv102.16)
%conv103.16 = fptosi double %47 to i64
%exp2.17 = call double @exp2(double 1.700000e+01) #7
%48 = load i64, ptr %arrayidx100.17, align 8, !tbaa !5
%conv101.17 = sitofp i64 %48 to double
%conv102.17 = sitofp i64 %conv103.16 to double
%49 = call double @llvm.fmuladd.f64(double %conv101.17, double 1.310720e+05, double %conv102.17)
%conv103.17 = fptosi double %49 to i64
%exp2.18 = call double @exp2(double 1.800000e+01) #7
%50 = load i64, ptr %arrayidx100.18, align 16, !tbaa !5
%conv101.18 = sitofp i64 %50 to double
%conv102.18 = sitofp i64 %conv103.17 to double
%51 = call double @llvm.fmuladd.f64(double %conv101.18, double 2.621440e+05, double %conv102.18)
%conv103.18 = fptosi double %51 to i64
%exp2.19 = call double @exp2(double 1.900000e+01) #7
%52 = load i64, ptr %arrayidx100.19, align 8, !tbaa !5
%conv101.19 = sitofp i64 %52 to double
%conv102.19 = sitofp i64 %conv103.18 to double
%53 = call double @llvm.fmuladd.f64(double %conv101.19, double 5.242880e+05, double %conv102.19)
%conv103.19 = fptosi double %53 to i64
%exp2.20 = call double @exp2(double 2.000000e+01) #7
%54 = load i64, ptr %arrayidx100.20, align 16, !tbaa !5
%conv101.20 = sitofp i64 %54 to double
%conv102.20 = sitofp i64 %conv103.19 to double
%55 = call double @llvm.fmuladd.f64(double %conv101.20, double 0x4130000000000000, double %conv102.20)
%conv103.20 = fptosi double %55 to i64
%exp2.21 = call double @exp2(double 2.100000e+01) #7
%56 = load i64, ptr %arrayidx100.21, align 8, !tbaa !5
%conv101.21 = sitofp i64 %56 to double
%conv102.21 = sitofp i64 %conv103.20 to double
%57 = call double @llvm.fmuladd.f64(double %conv101.21, double 0x4140000000000000, double %conv102.21)
%conv103.21 = fptosi double %57 to i64
%exp2.22 = call double @exp2(double 2.200000e+01) #7
%58 = load i64, ptr %arrayidx100.22, align 16, !tbaa !5
%conv101.22 = sitofp i64 %58 to double
%conv102.22 = sitofp i64 %conv103.21 to double
%59 = call double @llvm.fmuladd.f64(double %conv101.22, double 0x4150000000000000, double %conv102.22)
%conv103.22 = fptosi double %59 to i64
%exp2.23 = call double @exp2(double 2.300000e+01) #7
%60 = load i64, ptr %arrayidx100.23, align 8, !tbaa !5
%conv101.23 = sitofp i64 %60 to double
%conv102.23 = sitofp i64 %conv103.22 to double
%61 = call double @llvm.fmuladd.f64(double %conv101.23, double 0x4160000000000000, double %conv102.23)
%conv103.23 = fptosi double %61 to i64
%exp2.24 = call double @exp2(double 2.400000e+01) #7
%62 = load i64, ptr %arrayidx100.24, align 16, !tbaa !5
%conv101.24 = sitofp i64 %62 to double
%conv102.24 = sitofp i64 %conv103.23 to double
%63 = call double @llvm.fmuladd.f64(double %conv101.24, double 0x4170000000000000, double %conv102.24)
%conv103.24 = fptosi double %63 to i64
%exp2.25 = call double @exp2(double 2.500000e+01) #7
%64 = load i64, ptr %arrayidx100.25, align 8, !tbaa !5
%conv101.25 = sitofp i64 %64 to double
%conv102.25 = sitofp i64 %conv103.24 to double
%65 = call double @llvm.fmuladd.f64(double %conv101.25, double 0x4180000000000000, double %conv102.25)
%conv103.25 = fptosi double %65 to i64
%exp2.26 = call double @exp2(double 2.600000e+01) #7
%66 = load i64, ptr %arrayidx100.26, align 16, !tbaa !5
%conv101.26 = sitofp i64 %66 to double
%conv102.26 = sitofp i64 %conv103.25 to double
%67 = call double @llvm.fmuladd.f64(double %conv101.26, double 0x4190000000000000, double %conv102.26)
%conv103.26 = fptosi double %67 to i64
%exp2.27 = call double @exp2(double 2.700000e+01) #7
%68 = load i64, ptr %arrayidx100.27, align 8, !tbaa !5
%conv101.27 = sitofp i64 %68 to double
%conv102.27 = sitofp i64 %conv103.26 to double
%69 = call double @llvm.fmuladd.f64(double %conv101.27, double 0x41A0000000000000, double %conv102.27)
%conv103.27 = fptosi double %69 to i64
%exp2.28 = call double @exp2(double 2.800000e+01) #7
%70 = load i64, ptr %arrayidx100.28, align 16, !tbaa !5
%conv101.28 = sitofp i64 %70 to double
%conv102.28 = sitofp i64 %conv103.27 to double
%71 = call double @llvm.fmuladd.f64(double %conv101.28, double 0x41B0000000000000, double %conv102.28)
%conv103.28 = fptosi double %71 to i64
%exp2.29 = call double @exp2(double 2.900000e+01) #7
%72 = load i64, ptr %arrayidx100.29, align 8, !tbaa !5
%conv101.29 = sitofp i64 %72 to double
%conv102.29 = sitofp i64 %conv103.28 to double
%73 = call double @llvm.fmuladd.f64(double %conv101.29, double 0x41C0000000000000, double %conv102.29)
%conv103.29 = fptosi double %73 to i64
%call107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %conv103.29)
%74 = load i64, ptr %n, align 8, !tbaa !5
%sub108 = add nsw i64 %74, -1
%cmp109.not = icmp eq i64 %i65.0169, %sub108
%. = select i1 %cmp109.not, i32 10, i32 32
%putchar154 = call i32 @putchar(i32 %.)
%inc117 = add nuw nsw i64 %i65.0169, 1
%75 = load i64, ptr %n, align 8, !tbaa !5
%cmp67 = icmp slt i64 %inc117, %75
br i1 %cmp67, label %for.cond71.preheader, label %for.cond.cleanup68, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
declare double @exp2(double) local_unnamed_addr
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>
#pragma region 定義
typedef long long ll;
typedef unsigned long long ull;
#define _itoa(A,N) sprintf(A, "%d", N);
int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);
int _gcd(int a, int b);
int _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);
//昇順
int s_asort(const void* a, const void* b) {
return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
return(strcmp((char*)b, (char*)a));
}
int i_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
return(*(int*)a - *(int*)b);
}
int i_gcd(int a, int b);
int i_gcd(int a, int b) {
if (!b)return a;
return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
if (!b)return a;
return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
return (a * b) / ll_gcd(a, b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数2つで得る
//#define pai 3.1415926535
//#define _USE_MATH_DEFINES でM_PIが使える
#define deg_rad(X) (X*(M_PI/180))
int _swp(int* a, int* b)
{
int tmp;
tmp = *b; *b = *a; *a = tmp;
return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))
int _cknum(char* a, int n) {
int i;
char t = '0';
for (i = 0; i < n; i++) {
if (a[i] < '0' || a[i]>'9') return 1;
}
return 0;
}
int _atoi(char* s, int len) {
char tmp[20];
memcpy(tmp, s, len);
tmp[len] = 0x00;
return (atoi(tmp));
}
//素因数分解 pf素数が入る pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
// long i, r;
// if (a % 2 == 0) {
// pf[pc] = 2; pc++;
// return(_pfact(a / 2));
// }
// r = sqrt(a);
// for (i = 3; i <= r; i += 2) {
// if (a % i == 0) {
// pf[pc] = i; pc++;
// return(_pfact(a / i));
// }
// }
// if (a != 1) {
// pf[pc] = a; pc++;
// }
// return 0;
//
//}
//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
char rc;
rc = strcmp((char*)b, (char*)a);
if (rc == 0) {
*(char*)a = 0x00;
return(1);
}
return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
int bit;
for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
if (0 != (uc & 1))++bit;
return bit;
}//bitco
//10進数の桁数の総和
int _sumdig(int n);
int _sumdig(int n) {
int sum = 0;
while (n > 0) { sum += n % 10;n /= 10;}
return(sum);
}
#define _rnd(a,b) ((a+b-1)/b) // A/Bの余りを繰り上げる
#define _abs(x) ((x)<0 ? -(x) : (x))
#define _MAX 200000
#pragma endregion
// ABC145 C - Average Length
//int main(void) {
// int n,i, x[9],y[9],cnt=0;
// double sum=0;
//
// scanf("%d", &n);
// for (i = 0; i < n; i++)
// scanf("%d %d", &x[i], &y[i]);
//
// for(i=0;i<n-1;i++)
// for (int j = i + 1; j < n; j++) {
// sum += hypot(x[i] - x[j], y[i] - y[j]);
// cnt++;
// printf("%d %lf\n", cnt, sum);
// }
// printf("%lf\n",sum/cnt);
// return 0;
//}
// C - Sugar Water
//int main(void) {
// int a, b, c, d, e, f;
// int mn, mx;
// scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
//
// int tmp,i;
// for (i = 1;; i++) {
// tmp = i * 100 + i * e;
// if (tmp > f) break;
// if (i % a && i % b)continue;
// if (i % c && i % d)continue;
// break;
// }
//
// printf("%d %d", i * 100, tmp);
// return 0;
//}
//D - Road to Millionaire
//static ll a[81];
//int main(void) {
// int n,i;
// ll c=1000,ans=1000,tmp,cnt=0;
//
// scanf("%d", &n);
//
// for(i=0;i<n;i++)
// scanf("%lld", &a[i]);
//
// tmp = 210;
// for (i = 0; i < n; i++) {
// if (tmp == a[i]) continue;
//
// if (tmp < a[i]) {//売り
// if (a[i] < a[i + 1])continue;
// c += cnt * a[i];
// tmp = a[i];
// ans = _max(c, ans);
// printf("<S>i:%d a[i]:%lld ans:%lld \n",i, a[i], ans);
// }
// else { //買い
// if (a[i] > a[i + 1])continue;
// cnt = c / a[i];
// c = c % a[i];
// tmp = a[i];
// printf("<B>i:%d a[i]:%lld %lld\n", i,a[i],c);
//
// }
// }
// printf("%lld\n",ans);
// return 0;
//}
//
//
////AGC 011 A-Airport Bus
//double d_asort(const void* a, const void* b);
//double d_asort(const void* a, const void* b) {
// return(*(double*)a - *(double*)b);
//}
//double t[100001];
//int main(void) {
// int n,c,k;
//
// scanf("%d%d%d", &n,&c,&k);
// for (int i = 0; i < n; i++)
// scanf("%lf", &t[i]);
//
// qsort(t, n, sizeof(double), d_asort);
//
// int cnt = 0;
// double f;
// for (int i = 0; i < n; i++) {
//
//
//
// ans += (a[i] - tmp) * (a[i] - tmp);
//
// printf("%d\n", ans);
//}
int ll_asort(const void* a, const void* b);
int ll_asort(const void* a, const void* b) {
return(*(ll*)a - *(ll*)b);
}
int main(void) {
ll a[3],ans=0,f=0;
for (int i = 0; i < 3; i++) {
scanf("%lld", &a[i]);
f += (a[i]%2);
}
if (f!=3) goto end;
qsort(a, 3, sizeof(ll), ll_asort);
ans = a[1] * a[0];
end:
printf("%lld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162305/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162305/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i32 %b, 0
br i1 %tobool.not4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i32 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i32 %b, 0
br i1 %tobool.not4.i, label %i_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i32 %rem.i, 0
br i1 %tobool.not.i, label %i_gcd.exit, label %if.end.i
i_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i32 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i32 %b, %a
%div = sdiv i32 %mul, %a.tr.lcssa.i
ret i32 %div
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %if.then, label %if.end
if.then: ; preds = %if.end, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.end ]
%conv = trunc i64 %a.tr.lcssa to i32
ret i32 %conv
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i64 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %if.then, label %if.end
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %ll_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %ll_gcd.exit, label %if.end.i
ll_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i64 %b, %a
%sext = shl i64 %a.tr.lcssa.i, 32
%conv = ashr exact i64 %sext, 32
%div = sdiv i64 %mul, %conv
%conv1 = trunc i64 %div to i32
ret i32 %conv1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_swp(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !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) #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @_cknum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !11
%1 = add i8 %0, -58
%or.cond = icmp ult i8 %1, -10
br i1 %or.cond, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i32 @_atoi(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #7 {
entry:
%tmp = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %tmp) #15
%conv = sext i32 %len to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr align 1 %s, i64 %conv, i1 false)
%arrayidx = getelementptr inbounds [20 x i8], ptr %tmp, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !11
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #15
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %tmp) #15
ret i32 %conv.i
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_sort(ptr nocapture noundef %a, ptr nocapture noundef readonly %b) local_unnamed_addr #9 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
%sext = shl i32 %call, 24
%cmp = icmp eq i32 %sext, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i8 0, ptr %a, align 1, !tbaa !11
br label %cleanup
if.end: ; preds = %entry
%conv1 = ashr exact i32 %sext, 24
br label %cleanup
cleanup: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ %conv1, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i32 noundef %uc) local_unnamed_addr #3 {
entry:
%cmp.not5 = icmp eq i32 %uc, 0
br i1 %cmp.not5, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%bit.07 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%uc.addr.06 = phi i32 [ %shr, %for.body ], [ %uc, %entry ]
%and = and i32 %uc.addr.06, 1
%spec.select = add i32 %bit.07, %and
%shr = lshr i32 %uc.addr.06, 1
%cmp.not = icmp ult i32 %uc.addr.06, 2
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%bit.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
ret i32 %bit.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @_sumdig(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%sum.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%n.addr.05 = phi i32 [ %div, %while.body ], [ %n, %entry ]
%rem = urem i32 %n.addr.05, 10
%add = add nuw nsw i32 %sum.06, %rem
%div = udiv i32 %n.addr.05, 10
%cmp.not = icmp ult i32 %n.addr.05, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ll_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #2 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !14
%1 = load i64, ptr %b, align 8, !tbaa !14
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%a = alloca [3 x i64], align 16
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %a) #15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i64, ptr %a, align 16, !tbaa !14
%rem = srem i64 %0, 2
%arrayidx.1 = getelementptr inbounds [3 x i64], ptr %a, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%1 = load i64, ptr %arrayidx.1, align 8, !tbaa !14
%rem.1 = srem i64 %1, 2
%add.1 = add nsw i64 %rem.1, %rem
%arrayidx.2 = getelementptr inbounds [3 x i64], ptr %a, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%2 = load i64, ptr %arrayidx.2, align 16, !tbaa !14
%rem.2 = srem i64 %2, 2
%add.2 = add nsw i64 %rem.2, %add.1
%cmp3.not = icmp eq i64 %add.2, 3
br i1 %cmp3.not, label %if.end, label %end
if.end: ; preds = %entry
call void @qsort(ptr noundef nonnull %a, i64 noundef 3, i64 noundef 8, ptr noundef nonnull @ll_asort) #15
%3 = load i64, ptr %arrayidx.1, align 8, !tbaa !14
%4 = load i64, ptr %a, align 16, !tbaa !14
%mul = mul nsw i64 %4, %3
br label %end
end: ; preds = %entry, %if.end
%ans.0 = phi i64 [ 0, %entry ], [ %mul, %if.end ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %a) #15
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #12
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #13
attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { 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 #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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { mustprogress nofree 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 #10 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { mustprogress nofree 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 #14 = { nounwind willreturn memory(read) }
attributes #15 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
int i;
FOR(i,0,b) a[i]=c;
return;
}
int main(void)
{
ll a,b,c;
scanf("%lld%lld%lld",&a,&b,&c);
if(a%2==0||b%2==0||c%2==0) puts("0");
else printf("%lld",MIN(a*b,MIN(b*c,c*a)));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162349/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162349/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @fill(ptr nocapture noundef writeonly %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #1 {
entry:
%cmp3 = icmp sgt i32 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %b to i64
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader6, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %c, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%0 = getelementptr inbounds i32, ptr %a, i64 %index
store <4 x i32> %broadcast.splat, ptr %0, align 4, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %broadcast.splat, ptr %1, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader6
for.body.preheader6: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader6, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader6 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
store i32 %c, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
ret void
}
; 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:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i64, ptr %a, align 8, !tbaa !14
%1 = and i64 %0, 1
%cmp = icmp eq i64 %1, 0
br i1 %cmp, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%2 = load i64, ptr %b, align 8, !tbaa !14
%3 = and i64 %2, 1
%cmp2 = icmp eq i64 %3, 0
br i1 %cmp2, label %if.then, label %lor.lhs.false3
lor.lhs.false3: ; preds = %lor.lhs.false
%4 = load i64, ptr %c, align 8, !tbaa !14
%5 = and i64 %4, 1
%cmp5 = icmp eq i64 %5, 0
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %lor.lhs.false3, %lor.lhs.false, %entry
%call6 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.else: ; preds = %lor.lhs.false3
%mul = mul nsw i64 %2, %0
%mul7 = mul nsw i64 %4, %2
%mul8 = mul nsw i64 %4, %0
%mul7.mul8 = call i64 @llvm.smin.i64(i64 %mul7, i64 %mul8)
%spec.select = call i64 @llvm.smin.i64(i64 %mul, i64 %mul7.mul8)
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: 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 i64 @llvm.smin.i64(i64, i64) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
|
#include<stdio.h>
#include<math.h>
int main(){
int t,i;scanf("%d",&t);
for(i=0;i<t;i++){
int s,sum=0,n=1,count=0;scanf("%d",&s);
int f=pow(s,.5);
if(f*f==s){printf("%d\n",f);}
else{printf("%d\n",f+1);}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1624/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1624/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %0, 0
br i1 %cmp12, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%1 = load i32, ptr %s, align 4, !tbaa !5
%conv = sitofp i32 %1 to double
%sqrt = call double @sqrt(double %conv) #4
%abs = call double @llvm.fabs.f64(double %sqrt)
%conv3 = fptosi double %abs to i32
%mul = mul nsw i32 %conv3, %conv3
%2 = load i32, ptr %s, align 4, !tbaa !5
%cmp4 = icmp ne i32 %mul, %2
%add = zext i1 %cmp4 to i32
%add.sink = add nsw i32 %conv3, %add
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
%inc = add nuw nsw i32 %i.013, 1
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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
declare double @sqrt(double) local_unnamed_addr
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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>
int main(void)
{
int h,w;
for(;;){
scanf("%d %d",&h,&w);
if(h==0&&w==0)break;
int i,j;
for(i=1;i<=w;i++)printf("#");
putchar('\n');
for(j=1;j<=h-2;j++){
printf("#");
for(i=1;i<=w-2;i++)printf(".");
printf("#");
putchar('\n');
}
for(i=1;i<=w;i++)printf("#");
puts("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162442/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162442/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.3 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp59 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp160 = icmp eq i32 %1, 0
%or.cond61 = select i1 %cmp59, i1 %cmp160, i1 false
br i1 %or.cond61, label %for.end31, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end29
%2 = phi i32 [ %18, %for.end29 ], [ %1, %entry ]
%cmp3.not48 = icmp slt i32 %2, 1
br i1 %cmp3.not48, label %for.end, label %for.body
for.body: ; preds = %for.cond2.preheader, %for.body
%i.049 = phi i32 [ %inc, %for.body ], [ 1, %for.cond2.preheader ]
%3 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call noundef i32 @putc(i32 noundef 35, ptr noundef %3)
%inc = add nuw nsw i32 %i.049, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %i.049, %4
br i1 %cmp3.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %for.cond2.preheader
%5 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i42 = call noundef i32 @putc(i32 noundef 10, ptr noundef %5)
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp7.not54 = icmp slt i32 %6, 3
br i1 %cmp7.not54, label %for.cond23.preheader, label %for.body8
for.cond23.preheader: ; preds = %for.end17, %for.end
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp24.not56 = icmp slt i32 %7, 1
br i1 %cmp24.not56, label %for.end29, label %for.body25
for.body8: ; preds = %for.end, %for.end17
%j.055 = phi i32 [ %inc21, %for.end17 ], [ 1, %for.end ]
%8 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i43 = call noundef i32 @putc(i32 noundef 35, ptr noundef %8)
%9 = load i32, ptr %w, align 4, !tbaa !5
%cmp12.not51 = icmp slt i32 %9, 3
br i1 %cmp12.not51, label %for.end17, label %for.body13
for.body13: ; preds = %for.body8, %for.body13
%i.152 = phi i32 [ %inc16, %for.body13 ], [ 1, %for.body8 ]
%10 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i44 = call noundef i32 @putc(i32 noundef 46, ptr noundef %10)
%inc16 = add nuw nsw i32 %i.152, 1
%11 = load i32, ptr %w, align 4, !tbaa !5
%sub11 = add nsw i32 %11, -2
%cmp12.not.not = icmp slt i32 %i.152, %sub11
br i1 %cmp12.not.not, label %for.body13, label %for.end17, !llvm.loop !13
for.end17: ; preds = %for.body13, %for.body8
%12 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i45 = call noundef i32 @putc(i32 noundef 35, ptr noundef %12)
%13 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i46 = call noundef i32 @putc(i32 noundef 10, ptr noundef %13)
%inc21 = add nuw nsw i32 %j.055, 1
%14 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %14, -2
%cmp7.not.not = icmp slt i32 %j.055, %sub
br i1 %cmp7.not.not, label %for.body8, label %for.cond23.preheader, !llvm.loop !14
for.body25: ; preds = %for.cond23.preheader, %for.body25
%i.257 = phi i32 [ %inc28, %for.body25 ], [ 1, %for.cond23.preheader ]
%15 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i47 = call noundef i32 @putc(i32 noundef 35, ptr noundef %15)
%inc28 = add nuw nsw i32 %i.257, 1
%16 = load i32, ptr %w, align 4, !tbaa !5
%cmp24.not.not = icmp slt i32 %i.257, %16
br i1 %cmp24.not.not, label %for.body25, label %for.end29, !llvm.loop !15
for.end29: ; preds = %for.body25, %for.cond23.preheader
%call30 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%17 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %17, 0
%18 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %18, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end31, label %for.cond2.preheader
for.end31: ; preds = %for.end29, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
#include<stdio.h>
int main(void){
int H,W;
int i,j;
while(1){
scanf("%d %d",&H,&W);
if(H==0&&W==0){
break;
}
for(i=0;i<H;++i){
for(j=0;j<W;++j){
if(j==0||j==W-1||i==0||i==H-1){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162493/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162493/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp39 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp140 = icmp eq i32 %1, 0
%or.cond41 = select i1 %cmp39, i1 %cmp140, i1 false
br i1 %or.cond41, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %10, %for.end20 ], [ %0, %entry ]
%cmp235 = icmp sgt i32 %2, 0
br i1 %cmp235, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.036 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp432 = icmp sgt i32 %3, 0
br i1 %cmp432, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp9 = icmp eq i32 %i.036, 0
br i1 %cmp9, label %for.body5.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body5.lr.ph
%putchar31.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %W, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.peel, label %for.body5, label %for.end
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.033.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.033.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.inc.peel, %for.body5
%5 = phi i32 [ %8, %for.body5 ], [ %.pre, %for.inc.peel ]
%j.033 = phi i32 [ %inc, %for.body5 ], [ 1, %for.inc.peel ]
%sub = add nsw i32 %5, -1
%cmp7 = icmp eq i32 %j.033, %sub
%6 = load i32, ptr %H, align 4
%sub11 = add nsw i32 %6, -1
%cmp12 = icmp eq i32 %i.036, %sub11
%7 = select i1 %cmp7, i1 true, i1 %cmp12
%.sink = select i1 %7, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %j.033, 1
%8 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %8
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body5, %for.body5.us, %for.inc.peel, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.036, 1
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %9
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !13
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%10 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
int main(){
int h, w;
int i, j;
while(1){
scanf("%d %d", &h, &w);
if( w==0 && w==0 )
break;
for( i=0; i<h; i++ ){
for( j=0; j<w; j++ ){
if( i==0 || i==h-1 || j==0 || j==w-1 )
printf("#");
else
printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162543/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162543/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %w, align 4
%cmp39 = icmp eq i32 %0, 0
br i1 %cmp39, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%1 = load i32, ptr %h, align 4, !tbaa !5
%cmp235 = icmp sgt i32 %1, 0
br i1 %cmp235, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.036 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%2 = load i32, ptr %w, align 4, !tbaa !5
%cmp432 = icmp sgt i32 %2, 0
br i1 %cmp432, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.036, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.033.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.033.us, 1
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %3
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%4 = phi i32 [ %6, %for.body5 ], [ %2, %for.body5.lr.ph ]
%j.033 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%5 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%cmp7 = icmp eq i32 %i.036, %sub
%cmp9 = icmp eq i32 %j.033, 0
%or.cond22 = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %4, -1
%cmp12 = icmp eq i32 %j.033, %sub11
%or.cond = select i1 %or.cond22, i1 true, i1 %cmp12
%. = select i1 %or.cond, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.033, 1
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %6
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.036, 1
%7 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %7
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%8 = load i32, ptr %w, align 4
%cmp = icmp eq i32 %8, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void)
{
int h,w,i,j;
scanf("%d %d",&h,&w);
while(h!=0 && w!=0){
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if (i==0||j==0||i==h-1||j==w-1)
printf("#");
else
printf(".");
}
puts("");
}
puts("");
scanf("%d %d",&h,&w);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162587/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162587/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp37 = icmp ne i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp138 = icmp ne i32 %1, 0
%2 = select i1 %cmp37, i1 %cmp138, i1 false
br i1 %2, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.end18
%3 = phi i32 [ %10, %for.end18 ], [ %0, %entry ]
%cmp234 = icmp sgt i32 %3, 0
br i1 %cmp234, label %for.cond3.preheader, label %for.end18
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.035 = phi i32 [ %inc17, %for.end ], [ 0, %for.cond.preheader ]
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp431 = icmp sgt i32 %4, 0
br i1 %cmp431, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.035, 0
br i1 %cmp6, label %for.body5.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body5.lr.ph
%putchar29.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %w, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.peel, label %lor.lhs.false8, label %for.end
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.032.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar29.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.032.us, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %5
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
lor.lhs.false8: ; preds = %for.inc.peel, %lor.lhs.false8
%6 = phi i32 [ %8, %lor.lhs.false8 ], [ %.pre, %for.inc.peel ]
%j.032 = phi i32 [ %inc, %lor.lhs.false8 ], [ 1, %for.inc.peel ]
%7 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%cmp9 = icmp eq i32 %i.035, %sub
%sub11 = add nsw i32 %6, -1
%cmp12 = icmp eq i32 %j.032, %sub11
%or.cond30 = select i1 %cmp9, i1 true, i1 %cmp12
%. = select i1 %or.cond30, i32 35, i32 46
%putchar29 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.032, 1
%8 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %8
br i1 %cmp4, label %lor.lhs.false8, label %for.end, !llvm.loop !11
for.end: ; preds = %lor.lhs.false8, %for.body5.us, %for.inc.peel, %for.cond3.preheader
%putchar27 = call i32 @putchar(i32 10)
%inc17 = add nuw nsw i32 %i.035, 1
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc17, %9
br i1 %cmp2, label %for.cond3.preheader, label %for.end18, !llvm.loop !13
for.end18: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp ne i32 %10, 0
%11 = load i32, ptr %w, align 4
%cmp1 = icmp ne i32 %11, 0
%12 = select i1 %cmp, i1 %cmp1, i1 false
br i1 %12, label %for.cond.preheader, label %while.end, !llvm.loop !14
while.end: ; preds = %for.end18, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(void)
{
int h, w;
int i, j;
while(1){
scanf("%d %d", &h, &w);
if(h == 0 && w == 0) break;
for(i = 0; i < h; i++){
if(i == 0 || i == h - 1){
for(j = 0; j < w; j++){
printf("#");
}
printf("\n");
}
else{
for(j = 0; j < w; j++){
if(j == 0 || j == w - 1)
printf("#");
else
printf(".");
}
printf("\n");
}
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162644/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162644/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp55 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp156 = icmp eq i32 %1, 0
%or.cond57 = select i1 %cmp55, i1 %cmp156, i1 false
br i1 %or.cond57, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end30
%2 = phi i32 [ %9, %for.end30 ], [ %0, %entry ]
%cmp252 = icmp sgt i32 %2, 0
br i1 %cmp252, label %for.body, label %for.end30
for.body: ; preds = %for.cond.preheader, %for.inc28
%3 = phi i32 [ %8, %for.inc28 ], [ %2, %for.cond.preheader ]
%i.053 = phi i32 [ %inc29, %for.inc28 ], [ 0, %for.cond.preheader ]
%cmp3 = icmp eq i32 %i.053, 0
%sub = add nsw i32 %3, -1
%cmp4 = icmp eq i32 %i.053, %sub
%or.cond46 = select i1 %cmp3, i1 true, i1 %cmp4
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp750 = icmp sgt i32 %4, 0
br i1 %or.cond46, label %for.cond6.preheader, label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body
br i1 %cmp750, label %for.inc23.peel, label %for.inc28
for.inc23.peel: ; preds = %for.cond11.preheader
%putchar43.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %w, align 4, !tbaa !5
%cmp12.peel = icmp sgt i32 %.pre, 1
br i1 %cmp12.peel, label %for.body13, label %for.inc28
for.cond6.preheader: ; preds = %for.body
br i1 %cmp750, label %for.body8, label %for.inc28
for.body8: ; preds = %for.cond6.preheader, %for.body8
%j.051 = phi i32 [ %inc, %for.body8 ], [ 0, %for.cond6.preheader ]
%putchar45 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.051, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc, %5
br i1 %cmp7, label %for.body8, label %for.inc28, !llvm.loop !9
for.body13: ; preds = %for.inc23.peel, %for.body13
%6 = phi i32 [ %7, %for.body13 ], [ %.pre, %for.inc23.peel ]
%j.149 = phi i32 [ %inc24, %for.body13 ], [ 1, %for.inc23.peel ]
%sub16 = add nsw i32 %6, -1
%cmp17 = icmp eq i32 %j.149, %sub16
%. = select i1 %cmp17, i32 35, i32 46
%putchar43 = call i32 @putchar(i32 %.)
%inc24 = add nuw nsw i32 %j.149, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc24, %7
br i1 %cmp12, label %for.body13, label %for.inc28, !llvm.loop !11
for.inc28: ; preds = %for.body13, %for.body8, %for.cond11.preheader, %for.inc23.peel, %for.cond6.preheader
%putchar44 = call i32 @putchar(i32 10)
%inc29 = add nuw nsw i32 %i.053, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc29, %8
br i1 %cmp2, label %for.body, label %for.end30, !llvm.loop !13
for.end30: ; preds = %for.inc28, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end30, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int i=0,j,k,l,x[1024],y[1024];
while(1){
scanf("%d",&y[i]);
scanf("%d",&x[i]);
if(x[i]==0&&y[i]==0){
break;
}
i++;
}
for(j=0;j<i;j++){
for(k=0;k<y[j];k++){
for(l=0;l<x[j];l++){
if(k==0||k==y[j]-1){
printf("#");
}else if(l==0||l==x[j]-1){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162688/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162688/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca [1024 x i32], align 16
%y = alloca [1024 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %y) #4
br label %while.cond
while.cond: ; preds = %if.end, %entry
%indvars.iv81 = phi i32 [ %indvars.iv.next82, %if.end ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1024 x i32], ptr %y, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx2 = getelementptr inbounds [1024 x i32], ptr %x, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.cond
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp8 = icmp eq i32 %1, 0
br i1 %cmp8, label %for.cond.preheader, label %if.end
for.cond.preheader: ; preds = %land.lhs.true
%2 = and i64 %indvars.iv, 4294967295
%cmp973.not = icmp eq i64 %2, 0
br i1 %cmp973.not, label %for.end46, label %for.cond10.preheader.preheader
for.cond10.preheader.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %indvars.iv81 to i64
br label %for.cond10.preheader
if.end: ; preds = %land.lhs.true, %while.cond
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next82 = add nuw i32 %indvars.iv81, 1
br label %while.cond
for.cond10.preheader: ; preds = %for.cond10.preheader.preheader, %for.end42
%indvars.iv78 = phi i64 [ 0, %for.cond10.preheader.preheader ], [ %indvars.iv.next79, %for.end42 ]
%arrayidx12 = getelementptr inbounds [1024 x i32], ptr %y, i64 0, i64 %indvars.iv78
%3 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp1370 = icmp sgt i32 %3, 0
br i1 %cmp1370, label %for.cond15.preheader.lr.ph, label %for.end42
for.cond15.preheader.lr.ph: ; preds = %for.cond10.preheader
%arrayidx17 = getelementptr inbounds [1024 x i32], ptr %x, i64 0, i64 %indvars.iv78
br label %for.cond15.preheader
for.cond15.preheader: ; preds = %for.cond15.preheader.lr.ph, %for.end
%k.071 = phi i32 [ 0, %for.cond15.preheader.lr.ph ], [ %inc41, %for.end ]
%4 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp1867 = icmp sgt i32 %4, 0
br i1 %cmp1867, label %for.body19.lr.ph, label %for.end
for.body19.lr.ph: ; preds = %for.cond15.preheader
%cmp20 = icmp eq i32 %k.071, 0
br i1 %cmp20, label %for.body19.us, label %for.body19.preheader
for.body19.preheader: ; preds = %for.body19.lr.ph
%putchar66.peel = call i32 @putchar(i32 35)
%5 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18.peel = icmp sgt i32 %5, 1
br i1 %cmp18.peel, label %for.body19, label %for.end
for.body19.us: ; preds = %for.body19.lr.ph, %for.body19.us
%l.068.us = phi i32 [ %inc38.us, %for.body19.us ], [ 0, %for.body19.lr.ph ]
%putchar66.us = call i32 @putchar(i32 35)
%inc38.us = add nuw nsw i32 %l.068.us, 1
%6 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18.us = icmp slt i32 %inc38.us, %6
br i1 %cmp18.us, label %for.body19.us, label %for.end, !llvm.loop !9
for.body19: ; preds = %for.body19.preheader, %for.body19
%7 = phi i32 [ %10, %for.body19 ], [ %5, %for.body19.preheader ]
%l.068 = phi i32 [ %inc38, %for.body19 ], [ 1, %for.body19.preheader ]
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%sub = add nsw i32 %8, -1
%cmp23 = icmp eq i32 %k.071, %sub
%sub30 = add nsw i32 %7, -1
%cmp31 = icmp eq i32 %l.068, %sub30
%9 = select i1 %cmp23, i1 true, i1 %cmp31
%.sink = select i1 %9, i32 35, i32 46
%putchar66 = call i32 @putchar(i32 %.sink)
%inc38 = add nuw nsw i32 %l.068, 1
%10 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18 = icmp slt i32 %inc38, %10
br i1 %cmp18, label %for.body19, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body19, %for.body19.us, %for.body19.preheader, %for.cond15.preheader
%putchar63 = call i32 @putchar(i32 10)
%inc41 = add nuw nsw i32 %k.071, 1
%11 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp slt i32 %inc41, %11
br i1 %cmp13, label %for.cond15.preheader, label %for.end42, !llvm.loop !13
for.end42: ; preds = %for.end, %for.cond10.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count
br i1 %exitcond.not, label %for.end46, label %for.cond10.preheader, !llvm.loop !14
for.end46: ; preds = %for.end42, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <math.h>
int primecheck(int m){
int i;
//if(m==1)return 0;
//if(m==2||m==3)return 1;
for(i=2;i<=sqrt(m);i++){
if(m%i==0)return 0;
}
return 1;
}
int main(void){
int i,n;
while(scanf("%d",&n) != EOF){
for(i=n-1;;i--){
if(primecheck(i)){
printf("%d ",i);
break;
}
}
for(i=n+1;;i++){
if(primecheck(i)){
printf("%d\n",i);
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162752/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162752/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @primecheck(i32 noundef %m) local_unnamed_addr #0 {
entry:
%conv1 = sitofp i32 %m to double
%call8 = tail call double @sqrt(double noundef %conv1) #5
%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) #5
%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 %m, %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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not54 = icmp eq i32 %call53, -1
br i1 %cmp.not54, label %while.end, label %while.body
while.body: ; preds = %entry, %if.then6
%0 = load i32, ptr %n, align 4, !tbaa !7
%i.040 = add nsw i32 %0, -1
%conv1.i41 = sitofp i32 %i.040 to double
%call8.i42 = call double @sqrt(double noundef %conv1.i41) #5
%cmp9.i43 = fcmp ult double %call8.i42, 2.000000e+00
br i1 %cmp9.i43, label %if.then, label %for.body.i.preheader
for.cond.loopexit: ; preds = %for.body.i
%i.0 = add nsw i32 %i.044, -1
%conv1.i = sitofp i32 %i.0 to double
%call8.i = call double @sqrt(double noundef %conv1.i) #5
%cmp9.i = fcmp ult double %call8.i, 2.000000e+00
br i1 %cmp9.i, label %if.then, label %for.body.i.preheader
for.body.i.preheader: ; preds = %while.body, %for.cond.loopexit
%conv1.i45 = phi double [ %conv1.i, %for.cond.loopexit ], [ %conv1.i41, %while.body ]
%i.044 = phi i32 [ %i.0, %for.cond.loopexit ], [ %i.040, %while.body ]
br 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.i45) #5
%cmp.i = fcmp ult double %call.i, %conv.i
br i1 %cmp.i, label %if.then, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.body.i.preheader, %for.cond.i
%i.010.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.body.i.preheader ]
%rem.i = srem i32 %i.044, %i.010.i
%cmp3.i = icmp eq i32 %rem.i, 0
br i1 %cmp3.i, label %for.cond.loopexit, label %for.cond.i
if.then: ; preds = %for.cond.loopexit, %for.cond.i, %while.body
%i.037 = phi i32 [ %i.040, %while.body ], [ %i.044, %for.cond.i ], [ %i.0, %for.cond.loopexit ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.037)
%1 = load i32, ptr %n, align 4, !tbaa !7
%i.146 = add nsw i32 %1, 1
%conv1.i1647 = sitofp i32 %i.146 to double
%call8.i1748 = call double @sqrt(double noundef %conv1.i1647) #5
%cmp9.i1849 = fcmp ult double %call8.i1748, 2.000000e+00
br i1 %cmp9.i1849, label %if.then6, label %for.body.i19.preheader
for.cond3.loopexit: ; preds = %for.body.i19
%i.1 = add nsw i32 %i.150, 1
%conv1.i16 = sitofp i32 %i.1 to double
%call8.i17 = call double @sqrt(double noundef %conv1.i16) #5
%cmp9.i18 = fcmp ult double %call8.i17, 2.000000e+00
br i1 %cmp9.i18, label %if.then6, label %for.body.i19.preheader
for.body.i19.preheader: ; preds = %if.then, %for.cond3.loopexit
%conv1.i1651 = phi double [ %conv1.i16, %for.cond3.loopexit ], [ %conv1.i1647, %if.then ]
%i.150 = phi i32 [ %i.1, %for.cond3.loopexit ], [ %i.146, %if.then ]
br label %for.body.i19
for.cond.i23: ; preds = %for.body.i19
%inc.i24 = add nuw nsw i32 %i.010.i20, 1
%conv.i25 = sitofp i32 %inc.i24 to double
%call.i26 = call double @sqrt(double noundef %conv1.i1651) #5
%cmp.i27 = fcmp ult double %call.i26, %conv.i25
br i1 %cmp.i27, label %if.then6, label %for.body.i19, !llvm.loop !5
for.body.i19: ; preds = %for.body.i19.preheader, %for.cond.i23
%i.010.i20 = phi i32 [ %inc.i24, %for.cond.i23 ], [ 2, %for.body.i19.preheader ]
%rem.i21 = srem i32 %i.150, %i.010.i20
%cmp3.i22 = icmp eq i32 %rem.i21, 0
br i1 %cmp3.i22, label %for.cond3.loopexit, label %for.cond.i23
if.then6: ; preds = %for.cond3.loopexit, %for.cond.i23, %if.then
%i.139 = phi i32 [ %i.146, %if.then ], [ %i.150, %for.cond.i23 ], [ %i.1, %for.cond3.loopexit ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.139)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.then6, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 <stdio.h>
#define SIZE 50001
int isPrime(int n);
void show_prev_next_prime(int n);
int main(int argc, const char *argv[])
{
int n;
while(scanf("%d", &n)!=EOF)
show_prev_next_prime(n);
return 0;
}
int isPrime(int n)
{
int i;
if(n<=1) return 0;
else if(n==2) return 1;
else if(n%2==0) return 0;
else{
for(i=3; i*i<=n; i+=2)
if(n%i==0) return 0;
}
return 1;
}
void show_prev_next_prime(int n)
{
int i;
for(i=n-1; isPrime(i)==0; i--);
printf("%d ", i);
for(i=n+1; isPrime(i)==0; i++);
printf("%d\n", i);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162802/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162802/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not8 = icmp eq i32 %call7, -1
br i1 %cmp.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %show_prev_next_prime.exit
%0 = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond.i
for.cond.i: ; preds = %for.cond.i.backedge, %while.body
%i.0.in.i = phi i32 [ %0, %while.body ], [ %i.0.i, %for.cond.i.backedge ]
%i.0.i = add nsw i32 %i.0.in.i, -1
%cmp.i.i = icmp slt i32 %i.0.in.i, 3
br i1 %cmp.i.i, label %for.cond.i.backedge, label %if.else.i.i
if.else.i.i: ; preds = %for.cond.i
%cmp1.i.i = icmp eq i32 %i.0.i, 2
br i1 %cmp1.i.i, label %for.end.i, label %if.else3.i.i
if.else3.i.i: ; preds = %if.else.i.i
%rem.i.i = and i32 %i.0.i, 1
%cmp4.i.i = icmp eq i32 %rem.i.i, 0
br i1 %cmp4.i.i, label %for.cond.i.backedge, label %for.cond.preheader.i.i
for.cond.i.backedge: ; preds = %for.body.i.i, %if.else3.i.i, %for.cond.i
br label %for.cond.i, !llvm.loop !9
for.cond.preheader.i.i: ; preds = %if.else3.i.i
%cmp7.not21.i.i = icmp ult i32 %i.0.in.i, 10
br i1 %cmp7.not21.i.i, label %for.end.i, label %for.body.i.i
for.cond.i.i: ; preds = %for.body.i.i
%add.i.i = add nuw nsw i32 %i.022.i.i, 2
%mul.i.i = mul nsw i32 %add.i.i, %add.i.i
%cmp7.not.i.not.i = icmp slt i32 %mul.i.i, %i.0.in.i
br i1 %cmp7.not.i.not.i, label %for.body.i.i, label %for.end.i, !llvm.loop !11
for.body.i.i: ; preds = %for.cond.preheader.i.i, %for.cond.i.i
%i.022.i.i = phi i32 [ %add.i.i, %for.cond.i.i ], [ 3, %for.cond.preheader.i.i ]
%rem8.i.i = srem i32 %i.0.i, %i.022.i.i
%cmp9.i.i = icmp eq i32 %rem8.i.i, 0
br i1 %cmp9.i.i, label %for.cond.i.backedge, label %for.cond.i.i, !llvm.loop !9
for.end.i: ; preds = %for.cond.preheader.i.i, %if.else.i.i, %for.cond.i.i
%call1.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.i)
br label %for.cond2.i
for.cond2.i: ; preds = %for.cond2.i.backedge, %for.end.i
%i.1.in.i = phi i32 [ %0, %for.end.i ], [ %i.1.i, %for.cond2.i.backedge ]
%i.1.i = add nsw i32 %i.1.in.i, 1
%cmp.i15.i = icmp slt i32 %i.1.in.i, 1
br i1 %cmp.i15.i, label %for.cond2.i.backedge, label %if.else.i16.i
if.else.i16.i: ; preds = %for.cond2.i
%cmp1.i17.i = icmp eq i32 %i.1.i, 2
br i1 %cmp1.i17.i, label %show_prev_next_prime.exit, label %if.else3.i18.i
if.else3.i18.i: ; preds = %if.else.i16.i
%rem.i19.i = and i32 %i.1.i, 1
%cmp4.i20.i = icmp eq i32 %rem.i19.i, 0
br i1 %cmp4.i20.i, label %for.cond2.i.backedge, label %for.cond.preheader.i21.i
for.cond2.i.backedge: ; preds = %for.body.i23.i, %if.else3.i18.i, %for.cond2.i
br label %for.cond2.i, !llvm.loop !12
for.cond.preheader.i21.i: ; preds = %if.else3.i18.i
%cmp7.not21.i22.i = icmp ult i32 %i.1.i, 9
br i1 %cmp7.not21.i22.i, label %show_prev_next_prime.exit, label %for.body.i23.i
for.cond.i27.i: ; preds = %for.body.i23.i
%add.i28.i = add nuw nsw i32 %i.022.i24.i, 2
%mul.i29.i = mul nsw i32 %add.i28.i, %add.i28.i
%cmp7.not.i30.i = icmp sgt i32 %mul.i29.i, %i.1.i
br i1 %cmp7.not.i30.i, label %show_prev_next_prime.exit, label %for.body.i23.i, !llvm.loop !11
for.body.i23.i: ; preds = %for.cond.preheader.i21.i, %for.cond.i27.i
%i.022.i24.i = phi i32 [ %add.i28.i, %for.cond.i27.i ], [ 3, %for.cond.preheader.i21.i ]
%rem8.i25.i = srem i32 %i.1.i, %i.022.i24.i
%cmp9.i26.i = icmp eq i32 %rem8.i25.i, 0
br i1 %cmp9.i26.i, label %for.cond2.i.backedge, label %for.cond.i27.i, !llvm.loop !12
show_prev_next_prime.exit: ; preds = %if.else.i16.i, %for.cond.preheader.i21.i, %for.cond.i27.i
%call8.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.1.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %show_prev_next_prime.exit, %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 uwtable
define dso_local void @show_prev_next_prime(i32 noundef %n) local_unnamed_addr #0 {
entry:
br label %for.cond
for.cond: ; preds = %for.cond.backedge, %entry
%i.0.in = phi i32 [ %n, %entry ], [ %i.0, %for.cond.backedge ]
%i.0 = add nsw i32 %i.0.in, -1
%cmp.i = icmp slt i32 %i.0.in, 3
br i1 %cmp.i, label %for.cond.backedge, label %if.else.i
for.cond.backedge: ; preds = %for.body.i, %for.cond, %if.else3.i
br label %for.cond, !llvm.loop !9
if.else.i: ; preds = %for.cond
%cmp1.i = icmp eq i32 %i.0, 2
br i1 %cmp1.i, label %for.end, label %if.else3.i
if.else3.i: ; preds = %if.else.i
%rem.i = and i32 %i.0, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond.backedge, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.else3.i
%cmp7.not21.i = icmp ult i32 %i.0.in, 10
br i1 %cmp7.not21.i, label %for.end, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.022.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i.not = icmp slt i32 %mul.i, %i.0.in
br i1 %cmp7.not.i.not, label %for.body.i, label %for.end, !llvm.loop !11
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.022.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %i.0, %i.022.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond.backedge, label %for.cond.i, !llvm.loop !9
for.end: ; preds = %if.else.i, %for.cond.preheader.i, %for.cond.i
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0)
br label %for.cond2
for.cond2: ; preds = %for.cond2.backedge, %for.end
%i.1.in = phi i32 [ %n, %for.end ], [ %i.1, %for.cond2.backedge ]
%i.1 = add nsw i32 %i.1.in, 1
%cmp.i15 = icmp slt i32 %i.1.in, 1
br i1 %cmp.i15, label %for.cond2.backedge, label %if.else.i16
for.cond2.backedge: ; preds = %for.body.i23, %for.cond2, %if.else3.i18
br label %for.cond2, !llvm.loop !12
if.else.i16: ; preds = %for.cond2
%cmp1.i17 = icmp eq i32 %i.1, 2
br i1 %cmp1.i17, label %for.end7, label %if.else3.i18
if.else3.i18: ; preds = %if.else.i16
%rem.i19 = and i32 %i.1, 1
%cmp4.i20 = icmp eq i32 %rem.i19, 0
br i1 %cmp4.i20, label %for.cond2.backedge, label %for.cond.preheader.i21
for.cond.preheader.i21: ; preds = %if.else3.i18
%cmp7.not21.i22 = icmp ult i32 %i.1, 9
br i1 %cmp7.not21.i22, label %for.end7, label %for.body.i23
for.cond.i27: ; preds = %for.body.i23
%add.i28 = add nuw nsw i32 %i.022.i24, 2
%mul.i29 = mul nsw i32 %add.i28, %add.i28
%cmp7.not.i30 = icmp sgt i32 %mul.i29, %i.1
br i1 %cmp7.not.i30, label %for.end7, label %for.body.i23, !llvm.loop !11
for.body.i23: ; preds = %for.cond.preheader.i21, %for.cond.i27
%i.022.i24 = phi i32 [ %add.i28, %for.cond.i27 ], [ 3, %for.cond.preheader.i21 ]
%rem8.i25 = srem i32 %i.1, %i.022.i24
%cmp9.i26 = icmp eq i32 %rem8.i25, 0
br i1 %cmp9.i26, label %for.cond2.backedge, label %for.cond.i27, !llvm.loop !12
for.end7: ; preds = %if.else.i16, %for.cond.preheader.i21, %for.cond.i27
%call8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.1)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrime(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp = icmp slt i32 %n, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %n, 2
br i1 %cmp1, label %cleanup, label %if.else3
if.else3: ; preds = %if.else
%rem = and i32 %n, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else3
%cmp7.not21 = icmp ult i32 %n, 9
br i1 %cmp7.not21, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.022, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %n
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !11
for.body: ; preds = %for.cond.preheader, %for.cond
%i.022 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %n, %i.022
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, 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: 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 = { 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}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
int main(){
int n; scanf("%d",&n);
int a[101010];
rep(i,n) scanf("%d",a+i);
if(n==1){puts("1"); return 0;}
int up=0,ans=1;
rep(i,n-1){
if(up==0){
if(a[i]<a[i+1]) up=1;
if(a[i]>a[i+1]) up=-1;
}else{
if((up==1&&a[i]>a[i+1])||(up==-1&&a[i]<a[i+1])){
ans++;
up=0;
}
}
}
printf("%d\n",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162853/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162853/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [2 x i8] c"1\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [101010 x i32], align 16
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)
call void @llvm.lifetime.start.p0(i64 404040, ptr nonnull %a) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp63 = icmp sgt i32 %0, 0
br i1 %cmp63, label %for.body, label %for.cond.cleanup7
for.cond.cleanup: ; preds = %for.body
%cmp2 = icmp eq i32 %1, 1
br i1 %cmp2, label %if.then, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.cond.cleanup
%cmp665 = icmp sgt i32 %1, 1
br i1 %cmp665, label %for.body8.preheader, label %for.cond.cleanup7
for.body8.preheader: ; preds = %for.cond5.preheader
%sub = add nsw i32 %1, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then: ; preds = %for.cond.cleanup
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
for.cond.cleanup7: ; preds = %for.inc43, %entry, %for.cond5.preheader
%ans.0.lcssa = phi i32 [ 1, %for.cond5.preheader ], [ 1, %entry ], [ %ans.1, %for.inc43 ]
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
br label %cleanup
for.body8: ; preds = %for.body8.preheader, %for.inc43
%indvars.iv73 = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next74, %for.inc43 ]
%ans.067 = phi i32 [ 1, %for.body8.preheader ], [ %ans.1, %for.inc43 ]
%up.066 = phi i32 [ 0, %for.body8.preheader ], [ %up.2, %for.inc43 ]
switch i32 %up.066, label %for.inc43 [
i32 0, label %if.then10
i32 1, label %land.lhs.true
i32 -1, label %land.lhs.true32
]
if.then10: ; preds = %for.body8
%arrayidx = getelementptr inbounds [101010 x i32], ptr %a, i64 0, i64 %indvars.iv73
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%4 = add nuw nsw i64 %indvars.iv73, 1
%arrayidx12 = getelementptr inbounds [101010 x i32], ptr %a, i64 0, i64 %4
%5 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp slt i32 %3, %5
%spec.select = zext i1 %cmp13 to i32
%cmp21 = icmp sgt i32 %3, %5
%spec.select62 = select i1 %cmp21, i32 -1, i32 %spec.select
br label %for.inc43
land.lhs.true: ; preds = %for.body8
%arrayidx26 = getelementptr inbounds [101010 x i32], ptr %a, i64 0, i64 %indvars.iv73
%6 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%7 = add nuw nsw i64 %indvars.iv73, 1
%arrayidx29 = getelementptr inbounds [101010 x i32], ptr %a, i64 0, i64 %7
%8 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %6, %8
br i1 %cmp30, label %if.then39, label %for.inc43
land.lhs.true32: ; preds = %for.body8
%arrayidx34 = getelementptr inbounds [101010 x i32], ptr %a, i64 0, i64 %indvars.iv73
%9 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%10 = add nuw nsw i64 %indvars.iv73, 1
%arrayidx37 = getelementptr inbounds [101010 x i32], ptr %a, i64 0, i64 %10
%11 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%cmp38 = icmp slt i32 %9, %11
br i1 %cmp38, label %if.then39, label %for.inc43
if.then39: ; preds = %land.lhs.true32, %land.lhs.true
%inc40 = add nsw i32 %ans.067, 1
br label %for.inc43
for.inc43: ; preds = %land.lhs.true, %if.then10, %for.body8, %if.then39, %land.lhs.true32
%up.2 = phi i32 [ 0, %if.then39 ], [ -1, %land.lhs.true32 ], [ %up.066, %for.body8 ], [ %spec.select62, %if.then10 ], [ 1, %land.lhs.true ]
%ans.1 = phi i32 [ %inc40, %if.then39 ], [ %ans.067, %land.lhs.true32 ], [ %ans.067, %for.body8 ], [ %ans.067, %if.then10 ], [ %ans.067, %land.lhs.true ]
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%exitcond.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup7, label %for.body8, !llvm.loop !11
cleanup: ; preds = %for.cond.cleanup7, %if.then
call void @llvm.lifetime.end.p0(i64 404040, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
long long a[100010]={0};
long long used[100010]={0};
int main(void)
{
int n, i, ans = 0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%lld", &a[i]);
}
for(i = 1; i < n; i++){
if(a[i] > a[i-1]){
while(a[i] >= a[i-1] && i < n){
used[i] = 1;
used[i-1] = 1;
i++;
}
ans++;
}
else if(a[i] < a[i-1]){
while(a[i] <= a[i-1] && i < n){
used[i] = 1;
used[i-1] = 1;
i++;
}
ans++;
}
}
if(used[n-1] != 1) ans++;
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162903/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162903/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@a = dso_local global [100010 x i64] zeroinitializer, align 16
@used = dso_local local_unnamed_addr global [100010 x i64] 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"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4
%cmp87 = icmp sgt i32 %0, 0
br i1 %cmp87, label %for.body, label %for.end53
for.cond2.preheader: ; preds = %for.body
%cmp3111 = icmp sgt i32 %2, 1
br i1 %cmp3111, label %for.body4.preheader, label %for.end53
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4
%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 !5
for.body4: ; preds = %for.body4.preheader, %for.inc51
%ans.0113 = phi i32 [ %ans.1, %for.inc51 ], [ 0, %for.body4.preheader ]
%i.1112 = phi i32 [ %inc52, %for.inc51 ], [ 1, %for.body4.preheader ]
%idxprom5 = sext i32 %i.1112 to i64
%arrayidx6 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %idxprom5
%4 = load i64, ptr %arrayidx6, align 8, !tbaa !7
%sub = add nsw i32 %i.1112, -1
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %idxprom7
%5 = load i64, ptr %arrayidx8, align 8, !tbaa !7
%cmp9 = icmp sgt i64 %4, %5
br i1 %cmp9, label %while.cond.preheader, label %if.else
while.cond.preheader: ; preds = %for.body4
%cmp16106 = icmp slt i32 %i.1112, %2
br i1 %cmp16106, label %while.body, label %while.end
while.body: ; preds = %while.cond.preheader, %while.body
%6 = phi i64 [ %7, %while.body ], [ %4, %while.cond.preheader ]
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %while.body ], [ %idxprom5, %while.cond.preheader ]
%idxprom13109 = phi i64 [ %indvars.iv120, %while.body ], [ %idxprom7, %while.cond.preheader ]
%arrayidx18 = getelementptr inbounds [100010 x i64], ptr @used, i64 0, i64 %indvars.iv120
store i64 1, ptr %arrayidx18, align 8, !tbaa !7
%arrayidx21 = getelementptr inbounds [100010 x i64], ptr @used, i64 0, i64 %idxprom13109
store i64 1, ptr %arrayidx21, align 8, !tbaa !7
%indvars.iv.next121 = add nsw i64 %indvars.iv120, 1
%arrayidx11 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv.next121
%7 = load i64, ptr %arrayidx11, align 8, !tbaa !7
%cmp15 = icmp sge i64 %7, %6
%cmp16 = icmp slt i64 %indvars.iv.next121, %1
%8 = and i1 %cmp16, %cmp15
br i1 %8, label %while.body, label %while.end.loopexit, !llvm.loop !11
while.end.loopexit: ; preds = %while.body
%9 = trunc i64 %indvars.iv.next121 to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %while.cond.preheader
%i.2.lcssa = phi i32 [ %i.1112, %while.cond.preheader ], [ %9, %while.end.loopexit ]
%inc23 = add nsw i32 %ans.0113, 1
br label %for.inc51
if.else: ; preds = %for.body4
%cmp29 = icmp slt i64 %4, %5
br i1 %cmp29, label %while.cond31.preheader, label %for.inc51
while.cond31.preheader: ; preds = %if.else
%cmp3995 = icmp slt i32 %i.1112, %2
br i1 %cmp3995, label %while.body41, label %while.end48
while.body41: ; preds = %while.cond31.preheader, %while.body41
%10 = phi i64 [ %11, %while.body41 ], [ %4, %while.cond31.preheader ]
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %while.body41 ], [ %idxprom5, %while.cond31.preheader ]
%idxprom3598 = phi i64 [ %indvars.iv117, %while.body41 ], [ %idxprom7, %while.cond31.preheader ]
%arrayidx43 = getelementptr inbounds [100010 x i64], ptr @used, i64 0, i64 %indvars.iv117
store i64 1, ptr %arrayidx43, align 8, !tbaa !7
%arrayidx46 = getelementptr inbounds [100010 x i64], ptr @used, i64 0, i64 %idxprom3598
store i64 1, ptr %arrayidx46, align 8, !tbaa !7
%indvars.iv.next118 = add nsw i64 %indvars.iv117, 1
%arrayidx33 = getelementptr inbounds [100010 x i64], ptr @a, i64 0, i64 %indvars.iv.next118
%11 = load i64, ptr %arrayidx33, align 8, !tbaa !7
%cmp37 = icmp sle i64 %11, %10
%cmp39 = icmp slt i64 %indvars.iv.next118, %1
%12 = and i1 %cmp39, %cmp37
br i1 %12, label %while.body41, label %while.end48.loopexit, !llvm.loop !12
while.end48.loopexit: ; preds = %while.body41
%13 = trunc i64 %indvars.iv.next118 to i32
br label %while.end48
while.end48: ; preds = %while.end48.loopexit, %while.cond31.preheader
%i.3.lcssa = phi i32 [ %i.1112, %while.cond31.preheader ], [ %13, %while.end48.loopexit ]
%inc49 = add nsw i32 %ans.0113, 1
br label %for.inc51
for.inc51: ; preds = %while.end, %while.end48, %if.else
%i.4 = phi i32 [ %i.2.lcssa, %while.end ], [ %i.3.lcssa, %while.end48 ], [ %i.1112, %if.else ]
%ans.1 = phi i32 [ %inc23, %while.end ], [ %inc49, %while.end48 ], [ %ans.0113, %if.else ]
%inc52 = add nsw i32 %i.4, 1
%cmp3 = icmp slt i32 %inc52, %2
br i1 %cmp3, label %for.body4, label %for.end53, !llvm.loop !13
for.end53: ; preds = %for.inc51, %entry, %for.cond2.preheader
%.lcssa125 = phi i32 [ %2, %for.cond2.preheader ], [ %0, %entry ], [ %2, %for.inc51 ]
%ans.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %ans.1, %for.inc51 ]
%sub54 = add nsw i32 %.lcssa125, -1
%idxprom55 = sext i32 %sub54 to i64
%arrayidx56 = getelementptr inbounds [100010 x i64], ptr @used, i64 0, i64 %idxprom55
%14 = load i64, ptr %arrayidx56, align 8, !tbaa !7
%cmp57.not = icmp ne i64 %14, 1
%inc59 = zext i1 %cmp57.not to i32
%spec.select = add nsw i32 %ans.0.lcssa, %inc59
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select)
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"long long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
|
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define MAXN (200000)
#define MOD (1000000007)
typedef struct
{
ll a;
ll b;
ll c;
}job;
int acs_js(const void *a, const void *b){return (((job*)a)->b) - (((job*)b)->b);} /* 1,2,3,4.. */
job js[MAXN];
int main(void)
{
ll n;
scanf("%ld",&n);
for(int i=0;i<n;i++)
{
scanf("%ld %ld",&(js[i].a),&(js[i].b));
js[i].c = js[i].b-js[i].a;
}
qsort(js,n,sizeof(job),acs_js);
ll t=0;
for(int i=0;i<n;i++)
{
t+=js[i].a;
if(t>js[i].b)
{
printf("No\n");
return 0;
}
}
printf("Yes\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162947/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162947/source.c"
target datalayout = "e-m:e-p270: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.job = type { i64, i64, i64 }
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@js = dso_local global [200000 x %struct.job] 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
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @acs(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @des(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @acs_js(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%b1 = getelementptr inbounds %struct.job, ptr %a, i64 0, i32 1
%0 = load i64, ptr %b1, align 8, !tbaa !9
%b2 = getelementptr inbounds %struct.job, ptr %b, i64 0, i32 1
%1 = load i64, ptr %b2, align 8, !tbaa !9
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !12
%cmp46 = icmp sgt i64 %0, 0
br i1 %cmp46, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %0, %entry ], [ %4, %for.body ]
call void @qsort(ptr noundef nonnull @js, i64 noundef %.lcssa, i64 noundef 24, ptr noundef nonnull @acs_js) #6
%1 = load i64, ptr %n, align 8, !tbaa !12
%cmp16.not49 = icmp sgt i64 %1, 0
br i1 %cmp16.not49, label %for.body19, label %cleanup33
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x %struct.job], ptr @js, i64 0, i64 %indvars.iv
%b = getelementptr inbounds [200000 x %struct.job], ptr @js, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %b)
%2 = load i64, ptr %b, align 8, !tbaa !9
%3 = load i64, ptr %arrayidx, align 8, !tbaa !13
%sub = sub nsw i64 %2, %3
%c = getelementptr inbounds [200000 x %struct.job], ptr @js, i64 0, i64 %indvars.iv, i32 2
store i64 %sub, ptr %c, align 8, !tbaa !14
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i64, ptr %n, align 8, !tbaa !12
%cmp = icmp sgt i64 %4, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !15
for.cond14: ; preds = %for.body19
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%exitcond.not = icmp eq i64 %indvars.iv.next56, %1
br i1 %exitcond.not, label %cleanup33, label %for.body19, !llvm.loop !17
for.body19: ; preds = %for.cond.cleanup, %for.cond14
%indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.cond14 ], [ 0, %for.cond.cleanup ]
%t.050 = phi i64 [ %add, %for.cond14 ], [ 0, %for.cond.cleanup ]
%arrayidx21 = getelementptr inbounds [200000 x %struct.job], ptr @js, i64 0, i64 %indvars.iv55
%5 = load i64, ptr %arrayidx21, align 8, !tbaa !13
%add = add nsw i64 %5, %t.050
%b25 = getelementptr inbounds [200000 x %struct.job], ptr @js, i64 0, i64 %indvars.iv55, i32 1
%6 = load i64, ptr %b25, align 8, !tbaa !9
%cmp26 = icmp sgt i64 %add, %6
br i1 %cmp26, label %cleanup33, label %for.cond14
cleanup33: ; preds = %for.cond14, %for.body19, %for.cond.cleanup
%str.sink = phi ptr [ @str.4, %for.cond.cleanup ], [ @str, %for.body19 ], [ @str.4, %for.cond14 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @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 = !{!10, !11, i64 8}
!10 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"long", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{!10, !11, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
|
#include<stdio.h>
#include<stdlib.h>
int cmp(const void *a, const void *b) {
int *c = *(int**)a, *d = *(int**)b;
if(c[1] > d[1]) { return 1; }
else if(c[1] == d[1]) { return 0;}
else { return -1;}
}
void solve(int **list, int N){
int sum = 0, i;
int flag = 1;
for(i = 0; i < N; ++i) {
sum += list[i][0];
if(sum > list[i][1]) { flag = 0; break;}
}
if(flag == 1) { printf("Yes\n"); } else {printf("No\n");}
}
int main()
{
int N, i;
scanf("%d", &N);
int **list = (int**)malloc((N+6)*sizeof(int*));
for(i = 0; i < N+6; ++i) {
list[i] = (int*)malloc(2*sizeof(int));
}
for(i = 0; i < N; ++i) {
scanf("%d %d", &list[i][0], &list[i][1]);
}
qsort(list, N, sizeof(int*), cmp);
/*
for(i = 0; i < N; ++i) {
printf("%d, %d\n", list[i][0], list[i][1]);
}
*/
solve(list, N);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_162990/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_162990/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !5
%1 = load ptr, ptr %b, align 8, !tbaa !5
%arrayidx = getelementptr inbounds i32, ptr %0, i64 1
%2 = load i32, ptr %arrayidx, align 4, !tbaa !9
%arrayidx1 = getelementptr inbounds i32, ptr %1, i64 1
%3 = load i32, ptr %arrayidx1, align 4, !tbaa !9
%cmp = icmp sgt i32 %2, %3
%cmp4 = icmp ne i32 %2, %3
%. = sext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @solve(ptr nocapture noundef readonly %list, i32 noundef %N) local_unnamed_addr #2 {
entry:
%cmp.not16 = icmp sgt i32 %N, 0
br i1 %cmp.not16, label %for.body.preheader, label %if.end9
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %if.end9, label %for.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%sum.017 = phi i32 [ 0, %for.body.preheader ], [ %add, %for.cond ]
%arrayidx = getelementptr inbounds ptr, ptr %list, i64 %indvars.iv
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%1 = load i32, ptr %0, align 4, !tbaa !9
%add = add nsw i32 %1, %sum.017
%arrayidx4 = getelementptr inbounds i32, ptr %0, i64 1
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !9
%cmp5 = icmp sgt i32 %add, %2
br i1 %cmp5, label %if.end9, label %for.cond
if.end9: ; preds = %for.body, %for.cond, %entry
%str.sink = phi ptr [ @str.4, %entry ], [ @str.4, %for.cond ], [ @str, %for.body ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !9
%add = add nsw i32 %0, 6
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp30 = icmp sgt i32 %0, -6
br i1 %cmp30, label %for.body.preheader, label %for.cond5.preheader.for.end18_crit_edge
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %add to i64
br label %for.body
for.cond5.preheader: ; preds = %for.body
%cmp632 = icmp sgt i32 %0, 0
br i1 %cmp632, label %for.body8, label %for.cond5.preheader.for.end18_crit_edge
for.cond5.preheader.for.end18_crit_edge: ; preds = %entry, %for.cond5.preheader
%.pre = sext i32 %0 to i64
br label %for.end18
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call4 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #8
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call4, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond5.preheader, label %for.body, !llvm.loop !13
for.body8: ; preds = %for.cond5.preheader, %for.body8
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %for.body8 ], [ 0, %for.cond5.preheader ]
%arrayidx10 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv36
%1 = load ptr, ptr %arrayidx10, align 8, !tbaa !5
%arrayidx14 = getelementptr inbounds i32, ptr %1, i64 1
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %1, ptr noundef nonnull %arrayidx14)
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%2 = load i32, ptr %N, align 4, !tbaa !9
%3 = sext i32 %2 to i64
%cmp6 = icmp slt i64 %indvars.iv.next37, %3
br i1 %cmp6, label %for.body8, label %for.end18, !llvm.loop !14
for.end18: ; preds = %for.body8, %for.cond5.preheader.for.end18_crit_edge
%conv19.pre-phi = phi i64 [ %.pre, %for.cond5.preheader.for.end18_crit_edge ], [ %3, %for.body8 ]
call void @qsort(ptr noundef %call1, i64 noundef %conv19.pre-phi, i64 noundef 8, ptr noundef nonnull @cmp) #7
%4 = load i32, ptr %N, align 4, !tbaa !9
%cmp.not16.i = icmp sgt i32 %4, 0
br i1 %cmp.not16.i, label %for.body.preheader.i, label %solve.exit
for.body.preheader.i: ; preds = %for.end18
%wide.trip.count.i = zext i32 %4 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %solve.exit, label %for.body.i, !llvm.loop !11
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.i ]
%sum.017.i = phi i32 [ 0, %for.body.preheader.i ], [ %add.i, %for.cond.i ]
%arrayidx.i = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv.i
%5 = load ptr, ptr %arrayidx.i, align 8, !tbaa !5
%6 = load i32, ptr %5, align 4, !tbaa !9
%add.i = add nsw i32 %6, %sum.017.i
%arrayidx4.i = getelementptr inbounds i32, ptr %5, i64 1
%7 = load i32, ptr %arrayidx4.i, align 4, !tbaa !9
%cmp5.i = icmp sgt i32 %add.i, %7
br i1 %cmp5.i, label %solve.exit, label %for.cond.i
solve.exit: ; preds = %for.cond.i, %for.body.i, %for.end18
%str.sink.i = phi ptr [ @str.4, %for.end18 ], [ @str, %for.body.i ], [ @str.4, %for.cond.i ]
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn 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 #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
int sumdigits(int x)
{
int sum = 0;
while (x) {
sum += x % 10;
x /= 10;
}
return sum;
}
int main(void)
{
int a, b, n;
int min = 10000;
scanf("%d", &n);
for (a = 1; a < n; a++) {
b = n - a;
if (min > sumdigits(a) + sumdigits(b))
min = sumdigits(a) + sumdigits(b);
}
printf("%d", min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163032/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163032/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @sumdigits(i32 noundef %x) local_unnamed_addr #0 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%sum.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %sum.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp44 = icmp sgt i32 %0, 1
br i1 %cmp44, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%min.046 = phi i32 [ %min.1, %for.inc ], [ 10000, %entry ]
%a.045 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
br label %while.body.i
while.body.i: ; preds = %while.body.i, %for.body
%sum.06.i = phi i32 [ %add.i, %while.body.i ], [ 0, %for.body ]
%x.addr.05.i = phi i32 [ %div.i, %while.body.i ], [ %a.045, %for.body ]
%rem.i = srem i32 %x.addr.05.i, 10
%add.i = add nsw i32 %rem.i, %sum.06.i
%div.i = sdiv i32 %x.addr.05.i, 10
%x.addr.05.off.i = add i32 %x.addr.05.i, 9
%tobool.not.i = icmp ult i32 %x.addr.05.off.i, 19
br i1 %tobool.not.i, label %sumdigits.exit, label %while.body.i, !llvm.loop !5
sumdigits.exit: ; preds = %while.body.i
%sub = sub nsw i32 %0, %a.045
%tobool.not4.i = icmp eq i32 %sub, 0
br i1 %tobool.not4.i, label %sumdigits.exit22, label %while.body.i14
while.body.i14: ; preds = %sumdigits.exit, %while.body.i14
%sum.06.i15 = phi i32 [ %add.i18, %while.body.i14 ], [ 0, %sumdigits.exit ]
%x.addr.05.i16 = phi i32 [ %div.i19, %while.body.i14 ], [ %sub, %sumdigits.exit ]
%rem.i17 = srem i32 %x.addr.05.i16, 10
%add.i18 = add nsw i32 %rem.i17, %sum.06.i15
%div.i19 = sdiv i32 %x.addr.05.i16, 10
%x.addr.05.off.i20 = add i32 %x.addr.05.i16, 9
%tobool.not.i21 = icmp ult i32 %x.addr.05.off.i20, 19
br i1 %tobool.not.i21, label %sumdigits.exit22, label %while.body.i14, !llvm.loop !5
sumdigits.exit22: ; preds = %while.body.i14, %sumdigits.exit
%sum.0.lcssa.i = phi i32 [ 0, %sumdigits.exit ], [ %add.i18, %while.body.i14 ]
%add = add nsw i32 %sum.0.lcssa.i, %add.i
%cmp3 = icmp sgt i32 %min.046, %add
br i1 %cmp3, label %while.body.i23, label %for.inc
while.body.i23: ; preds = %sumdigits.exit22, %while.body.i23
%sum.06.i24 = phi i32 [ %add.i27, %while.body.i23 ], [ 0, %sumdigits.exit22 ]
%x.addr.05.i25 = phi i32 [ %div.i28, %while.body.i23 ], [ %a.045, %sumdigits.exit22 ]
%rem.i26 = srem i32 %x.addr.05.i25, 10
%add.i27 = add nsw i32 %rem.i26, %sum.06.i24
%div.i28 = sdiv i32 %x.addr.05.i25, 10
%x.addr.05.off.i29 = add i32 %x.addr.05.i25, 9
%tobool.not.i30 = icmp ult i32 %x.addr.05.off.i29, 19
br i1 %tobool.not.i30, label %sumdigits.exit32, label %while.body.i23, !llvm.loop !5
sumdigits.exit32: ; preds = %while.body.i23
br i1 %tobool.not4.i, label %sumdigits.exit43, label %while.body.i34
while.body.i34: ; preds = %sumdigits.exit32, %while.body.i34
%sum.06.i35 = phi i32 [ %add.i38, %while.body.i34 ], [ 0, %sumdigits.exit32 ]
%x.addr.05.i36 = phi i32 [ %div.i39, %while.body.i34 ], [ %sub, %sumdigits.exit32 ]
%rem.i37 = srem i32 %x.addr.05.i36, 10
%add.i38 = add nsw i32 %rem.i37, %sum.06.i35
%div.i39 = sdiv i32 %x.addr.05.i36, 10
%x.addr.05.off.i40 = add i32 %x.addr.05.i36, 9
%tobool.not.i41 = icmp ult i32 %x.addr.05.off.i40, 19
br i1 %tobool.not.i41, label %sumdigits.exit43, label %while.body.i34, !llvm.loop !5
sumdigits.exit43: ; preds = %while.body.i34, %sumdigits.exit32
%sum.0.lcssa.i42 = phi i32 [ 0, %sumdigits.exit32 ], [ %add.i38, %while.body.i34 ]
%add6 = add nsw i32 %sum.0.lcssa.i42, %add.i27
br label %for.inc
for.inc: ; preds = %sumdigits.exit22, %sumdigits.exit43
%min.1 = phi i32 [ %add6, %sumdigits.exit43 ], [ %min.046, %sumdigits.exit22 ]
%inc = add nuw nsw i32 %a.045, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%min.0.lcssa = phi i32 [ 10000, %entry ], [ %min.1, %for.inc ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %min.0.lcssa)
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(){
int n,ans=0;
scanf("%d",&n);
if(n<=10)ans=n;
else if(n==100||n==1000||n==10000||n==100000)ans=10;
else {
while(n>0){
int tmp=n%10;
ans+=tmp;
n=(n-tmp)/10;
}
}
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163076/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163076/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4
%cmp = icmp slt i32 %0, 11
br i1 %cmp, label %if.end10, label %if.else
if.else: ; preds = %entry
switch i32 %0, label %while.body [
i32 100000, label %if.end10
i32 10000, label %if.end10
i32 1000, label %if.end10
i32 100, label %if.end10
]
while.body: ; preds = %if.else, %while.body
%ans.018 = phi i32 [ %add, %while.body ], [ 0, %if.else ]
%1 = phi i32 [ %div, %while.body ], [ %0, %if.else ]
%rem = urem i32 %1, 10
%add = add nuw nsw i32 %ans.018, %rem
%sub = sub nuw nsw i32 %1, %rem
%div = sdiv i32 %sub, 10
%cmp9 = icmp sgt i32 %sub, 9
br i1 %cmp9, label %while.body, label %while.cond.if.end10.loopexit_crit_edge, !llvm.loop !5
while.cond.if.end10.loopexit_crit_edge: ; preds = %while.body
store i32 %div, ptr %n, align 4, !tbaa !7
br label %if.end10
if.end10: ; preds = %while.cond.if.end10.loopexit_crit_edge, %if.else, %if.else, %if.else, %if.else, %entry
%ans.1 = phi i32 [ %0, %entry ], [ 10, %if.else ], [ 10, %if.else ], [ 10, %if.else ], [ 10, %if.else ], [ %add, %while.cond.if.end10.loopexit_crit_edge ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
int a, b;
int i;
int x, min = 1000000000;
for (i = 1; i <= n / 2; i++)
{
a = i;
b = n - a;
x = 0;
while (a != 0)
{
x += (a % 10);
a /= 10;
}
while (b != 0)
{
x += (b % 10);
b /= 10;
}
if (min > x)
min = x;
}
printf("%d\n", min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163126/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163126/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not28 = icmp slt i32 %0, 2
br i1 %cmp.not28, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%div3233 = lshr i32 %0, 1
br label %for.body
for.body: ; preds = %for.body.preheader, %while.end9
%min.030 = phi i32 [ %spec.select, %while.end9 ], [ 1000000000, %for.body.preheader ]
%i.029 = phi i32 [ %inc, %while.end9 ], [ 1, %for.body.preheader ]
br label %while.body
while.cond3.preheader: ; preds = %while.body
%sub = sub nsw i32 %0, %i.029
%cmp4.not25 = icmp eq i32 %sub, 0
br i1 %cmp4.not25, label %while.end9, label %while.body5
while.body: ; preds = %for.body, %while.body
%x.024 = phi i32 [ 0, %for.body ], [ %add, %while.body ]
%a.023 = phi i32 [ %i.029, %for.body ], [ %div2, %while.body ]
%rem = srem i32 %a.023, 10
%add = add nsw i32 %x.024, %rem
%div2 = sdiv i32 %a.023, 10
%a.023.off = add nsw i32 %a.023, 9
%cmp1.not = icmp ult i32 %a.023.off, 19
br i1 %cmp1.not, label %while.cond3.preheader, label %while.body, !llvm.loop !9
while.body5: ; preds = %while.cond3.preheader, %while.body5
%x.127 = phi i32 [ %add7, %while.body5 ], [ %add, %while.cond3.preheader ]
%b.026 = phi i32 [ %div8, %while.body5 ], [ %sub, %while.cond3.preheader ]
%rem6 = srem i32 %b.026, 10
%add7 = add nsw i32 %x.127, %rem6
%div8 = sdiv i32 %b.026, 10
%b.026.off = add i32 %b.026, 9
%cmp4.not = icmp ult i32 %b.026.off, 19
br i1 %cmp4.not, label %while.end9, label %while.body5, !llvm.loop !11
while.end9: ; preds = %while.body5, %while.cond3.preheader
%x.1.lcssa = phi i32 [ %add, %while.cond3.preheader ], [ %add7, %while.body5 ]
%spec.select = call i32 @llvm.smin.i32(i32 %min.030, i32 %x.1.lcssa)
%inc = add nuw nsw i32 %i.029, 1
%exitcond.not = icmp eq i32 %i.029, %div3233
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %while.end9, %entry
%min.0.lcssa = phi i32 [ 1000000000, %entry ], [ %spec.select, %while.end9 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(){
int x, cont=0;
scanf("%d", &x);
if (x>=400 && x<=599)
cont=8;
else if(x >= 600 && x <= 799)
cont=7;
else if(x >= 800 && x <= 999)
cont=6;
else if(x >= 1000 && x <= 1199)
cont=5;
else if(x >= 1200 && x <= 1399)
cont=4;
else if(x >= 1400 && x <= 1599)
cont=3;
else if(x >= 1600 && x <= 1799)
cont=2;
else if(x >= 1800 && x <= 1999)
cont=1;
printf("%d\n", cont);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163177/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163177/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4
%1 = add i32 %0, -400
%or.cond = icmp ult i32 %1, 200
br i1 %or.cond, label %if.end42, label %if.else
if.else: ; preds = %entry
%2 = add i32 %0, -600
%or.cond44 = icmp ult i32 %2, 200
br i1 %or.cond44, label %if.end42, label %if.else6
if.else6: ; preds = %if.else
%3 = add i32 %0, -800
%or.cond45 = icmp ult i32 %3, 200
br i1 %or.cond45, label %if.end42, label %if.else11
if.else11: ; preds = %if.else6
%4 = add i32 %0, -1000
%or.cond46 = icmp ult i32 %4, 200
br i1 %or.cond46, label %if.end42, label %if.else16
if.else16: ; preds = %if.else11
%5 = add i32 %0, -1200
%or.cond47 = icmp ult i32 %5, 200
br i1 %or.cond47, label %if.end42, label %if.else21
if.else21: ; preds = %if.else16
%6 = add i32 %0, -1400
%or.cond48 = icmp ult i32 %6, 200
br i1 %or.cond48, label %if.end42, label %if.else26
if.else26: ; preds = %if.else21
%7 = add i32 %0, -1600
%or.cond49 = icmp ult i32 %7, 200
br i1 %or.cond49, label %if.end42, label %if.else31
if.else31: ; preds = %if.else26
%8 = add i32 %0, -1800
%or.cond50 = icmp ult i32 %8, 200
%spec.select = zext i1 %or.cond50 to i32
br label %if.end42
if.end42: ; preds = %if.else31, %if.else26, %if.else21, %if.else16, %if.else11, %if.else6, %if.else, %entry
%cont.0 = phi i32 [ 8, %entry ], [ 7, %if.else ], [ 6, %if.else6 ], [ 5, %if.else11 ], [ 4, %if.else16 ], [ 3, %if.else21 ], [ 2, %if.else26 ], [ %spec.select, %if.else31 ]
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cont.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main(void){
int n,k,i,j;
int array[100];
int one,two,sum=0;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++) scanf("%d",&array[i]);
for(i=0;i<k;i++){
one=two=0;
for(j=0;j<n/k;j++){
//printf("%d ",i+j*k);
if(array[i+j*k]==1) one++;
else two++;
}
// puts("");
//printf("%d %d\n",one,two);
if(!one || !two) sum+=0;
else sum+=(one<two)?one:two;
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16322/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16322/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%array = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %array) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %13, %for.body ]
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp350 = icmp sgt i32 %1, 0
br i1 %cmp350, label %for.cond5.preheader.lr.ph, label %for.end25
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%div = sdiv i32 %.lcssa, %1
%cmp644 = icmp sgt i32 %div, 0
br i1 %cmp644, label %for.cond5.preheader.us.preheader, label %for.end25
for.cond5.preheader.us.preheader: ; preds = %for.cond5.preheader.lr.ph
%2 = zext i32 %1 to i64
%wide.trip.count65 = zext i32 %1 to i64
%wide.trip.count = zext i32 %div to i64
%xtraiter = and i64 %wide.trip.count, 1
%3 = icmp eq i32 %div, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.cond5.for.end15_crit_edge.us
%indvars.iv62 = phi i64 [ 0, %for.cond5.preheader.us.preheader ], [ %indvars.iv.next63, %for.cond5.for.end15_crit_edge.us ]
%sum.052.us = phi i32 [ 0, %for.cond5.preheader.us.preheader ], [ %sum.1.us, %for.cond5.for.end15_crit_edge.us ]
br i1 %3, label %for.cond5.for.end15_crit_edge.us.unr-lcssa, label %for.body7.us
for.body7.us: ; preds = %for.cond5.preheader.us, %for.body7.us
%indvars.iv57 = phi i64 [ %indvars.iv.next58.1, %for.body7.us ], [ 0, %for.cond5.preheader.us ]
%two.047.us = phi i32 [ %two.1.us.1, %for.body7.us ], [ 0, %for.cond5.preheader.us ]
%one.046.us = phi i32 [ %one.1.us.1, %for.body7.us ], [ 0, %for.cond5.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.body7.us ], [ 0, %for.cond5.preheader.us ]
%4 = mul nsw i64 %indvars.iv57, %2
%5 = add nuw nsw i64 %4, %indvars.iv62
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %5
%6 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp eq i32 %6, 1
%inc11.us = zext i1 %cmp10.us to i32
%one.1.us = add nuw nsw i32 %one.046.us, %inc11.us
%not.cmp10.us = xor i1 %cmp10.us, true
%inc12.us = zext i1 %not.cmp10.us to i32
%two.1.us = add nuw nsw i32 %two.047.us, %inc12.us
%indvars.iv.next58 = or i64 %indvars.iv57, 1
%7 = mul nsw i64 %indvars.iv.next58, %2
%8 = add nuw nsw i64 %7, %indvars.iv62
%arrayidx9.us.1 = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %8
%9 = load i32, ptr %arrayidx9.us.1, align 4, !tbaa !5
%cmp10.us.1 = icmp eq i32 %9, 1
%inc11.us.1 = zext i1 %cmp10.us.1 to i32
%one.1.us.1 = add nuw nsw i32 %one.1.us, %inc11.us.1
%not.cmp10.us.1 = xor i1 %cmp10.us.1, true
%inc12.us.1 = zext i1 %not.cmp10.us.1 to i32
%two.1.us.1 = add nuw nsw i32 %two.1.us, %inc12.us.1
%indvars.iv.next58.1 = add nuw nsw i64 %indvars.iv57, 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.cond5.for.end15_crit_edge.us.unr-lcssa, label %for.body7.us, !llvm.loop !9
for.cond5.for.end15_crit_edge.us.unr-lcssa: ; preds = %for.body7.us, %for.cond5.preheader.us
%one.1.us.lcssa.ph = phi i32 [ undef, %for.cond5.preheader.us ], [ %one.1.us.1, %for.body7.us ]
%two.1.us.lcssa.ph = phi i32 [ undef, %for.cond5.preheader.us ], [ %two.1.us.1, %for.body7.us ]
%indvars.iv57.unr = phi i64 [ 0, %for.cond5.preheader.us ], [ %indvars.iv.next58.1, %for.body7.us ]
%two.047.us.unr = phi i32 [ 0, %for.cond5.preheader.us ], [ %two.1.us.1, %for.body7.us ]
%one.046.us.unr = phi i32 [ 0, %for.cond5.preheader.us ], [ %one.1.us.1, %for.body7.us ]
br i1 %lcmp.mod.not, label %for.cond5.for.end15_crit_edge.us, label %for.body7.us.epil
for.body7.us.epil: ; preds = %for.cond5.for.end15_crit_edge.us.unr-lcssa
%10 = mul nsw i64 %indvars.iv57.unr, %2
%11 = add nuw nsw i64 %10, %indvars.iv62
%arrayidx9.us.epil = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %11
%12 = load i32, ptr %arrayidx9.us.epil, align 4, !tbaa !5
%cmp10.us.epil = icmp eq i32 %12, 1
%inc11.us.epil = zext i1 %cmp10.us.epil to i32
%one.1.us.epil = add nuw nsw i32 %one.046.us.unr, %inc11.us.epil
%not.cmp10.us.epil = xor i1 %cmp10.us.epil, true
%inc12.us.epil = zext i1 %not.cmp10.us.epil to i32
%two.1.us.epil = add nuw nsw i32 %two.047.us.unr, %inc12.us.epil
br label %for.cond5.for.end15_crit_edge.us
for.cond5.for.end15_crit_edge.us: ; preds = %for.cond5.for.end15_crit_edge.us.unr-lcssa, %for.body7.us.epil
%one.1.us.lcssa = phi i32 [ %one.1.us.lcssa.ph, %for.cond5.for.end15_crit_edge.us.unr-lcssa ], [ %one.1.us.epil, %for.body7.us.epil ]
%two.1.us.lcssa = phi i32 [ %two.1.us.lcssa.ph, %for.cond5.for.end15_crit_edge.us.unr-lcssa ], [ %two.1.us.epil, %for.body7.us.epil ]
%tobool.us = icmp ne i32 %one.1.us.lcssa, 0
%tobool16.us = icmp ne i32 %two.1.us.lcssa, 0
%or.cond.us = select i1 %tobool.us, i1 %tobool16.us, i1 false
%cond.us = call i32 @llvm.smin.i32(i32 %one.1.us.lcssa, i32 %two.1.us.lcssa)
%add21.us = select i1 %or.cond.us, i32 %cond.us, i32 0
%sum.1.us = add nuw nsw i32 %add21.us, %sum.052.us
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%exitcond66.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count65
br i1 %exitcond66.not, label %for.end25, label %for.cond5.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %array, 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
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !12
for.end25: ; preds = %for.cond5.for.end15_crit_edge.us, %for.cond5.preheader.lr.ph, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %for.cond5.preheader.lr.ph ], [ %sum.1.us, %for.cond5.for.end15_crit_edge.us ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %array) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main() {
int n;
scanf("%d", &n);
if (400 <= n && n <= 599) {
puts("8");
}
else if (600 <= n && n <= 799) {
puts("7");
}
else if (800 <= n && n <= 999) {
puts("6");
}
else if (1000 <= n && n <= 1199) {
puts("5");
}
else if (1200 <= n && n <= 1399) {
puts("4");
}
else if (1400 <= n && n <= 1599) {
puts("3");
}
else if (1600 <= n && n <= 1799) {
puts("2");
}
else if (1800 <= n && n <= 1999) {
puts("1");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163263/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163263/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [2 x i8] c"8\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"7\00", align 1
@.str.3 = private unnamed_addr constant [2 x i8] c"6\00", align 1
@.str.4 = private unnamed_addr constant [2 x i8] c"5\00", align 1
@.str.5 = private unnamed_addr constant [2 x i8] c"4\00", align 1
@.str.6 = private unnamed_addr constant [2 x i8] c"3\00", align 1
@.str.7 = private unnamed_addr constant [2 x i8] c"2\00", align 1
@.str.8 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4
%1 = add i32 %0, -400
%or.cond = icmp ult i32 %1, 200
br i1 %or.cond, label %if.end50.sink.split, label %if.else
if.else: ; preds = %entry
%2 = add i32 %0, -600
%or.cond51 = icmp ult i32 %2, 200
br i1 %or.cond51, label %if.end50.sink.split, label %if.else8
if.else8: ; preds = %if.else
%3 = add i32 %0, -800
%or.cond52 = icmp ult i32 %3, 200
br i1 %or.cond52, label %if.end50.sink.split, label %if.else14
if.else14: ; preds = %if.else8
%4 = add i32 %0, -1000
%or.cond53 = icmp ult i32 %4, 200
br i1 %or.cond53, label %if.end50.sink.split, label %if.else20
if.else20: ; preds = %if.else14
%5 = add i32 %0, -1200
%or.cond54 = icmp ult i32 %5, 200
br i1 %or.cond54, label %if.end50.sink.split, label %if.else26
if.else26: ; preds = %if.else20
%6 = add i32 %0, -1400
%or.cond55 = icmp ult i32 %6, 200
br i1 %or.cond55, label %if.end50.sink.split, label %if.else32
if.else32: ; preds = %if.else26
%7 = add i32 %0, -1600
%or.cond56 = icmp ult i32 %7, 200
br i1 %or.cond56, label %if.end50.sink.split, label %if.else38
if.else38: ; preds = %if.else32
%8 = add i32 %0, -1800
%or.cond57 = icmp ult i32 %8, 200
br i1 %or.cond57, label %if.end50.sink.split, label %if.end50
if.end50.sink.split: ; preds = %if.else38, %if.else32, %if.else26, %if.else20, %if.else14, %if.else8, %if.else, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ @.str.3, %if.else8 ], [ @.str.4, %if.else14 ], [ @.str.5, %if.else20 ], [ @.str.6, %if.else26 ], [ @.str.7, %if.else32 ], [ @.str.8, %if.else38 ]
%call7 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
br label %if.end50
if.end50: ; preds = %if.end50.sink.split, %if.else38
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 @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)"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t
#include <math.h>
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
int get_int(void) {
int num;
scanf("%d", &num);
return num;
}
int get_int2(int *a1, int *a2) {
scanf("%d %d", a1, a2);
return 0;
}
int get_int3(int *a1, int *a2, int *a3) {
scanf("%d %d %d", a1, a2, a3);
return 0;
}
int get_int4(int *a1, int *a2, int *a3, int *a4) {
scanf("%d %d %d %d", a1, a2, a3, a4);
return 0;
}
int get_int5(int *a1, int *a2, int *a3, int *a4, int *a5) {
scanf("%d %d %d %d %d", a1, a2, a3, a4, a5);
return 0;
}
// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
int i;
for(i = 0; i < size; i++) {
scanf("%d", &arr[i]);
}
return 0;
}
#define NUM_MAX 2000
#define INF (1e+9)
int main() {
int num, xscore, yscore;
get_int3(&num, &xscore, &yscore);
static int arr[NUM_MAX];
fget_array(arr, num);
static int dp[NUM_MAX+1][2];
int last = arr[num-1];
int i;
int prev_x = INF;
int prev_y = 0;
for (i = num-1; i >= 0; i--) {
int Y = (i ? arr[i-1] : yscore);
dp[i][0] = max(abs(Y - last), prev_y);
prev_x = min(prev_x, dp[i][0]);
int X = (i ? arr[i-1] : xscore);
dp[i][1] = min(abs(X - last), prev_x);
prev_y = max(prev_y, dp[i][1]);
}
printf("%d\n", dp[0][0]);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163313/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163313/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.3 = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.4 = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@main.arr = internal global [2000 x i32] zeroinitializer, align 16
@main.dp = internal unnamed_addr global [2001 x [2 x i32]] zeroinitializer, align 16
@.str.5 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 %0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 @get_int2(ptr noundef %a1, ptr noundef %a2) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %a1, ptr noundef %a2)
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int3(ptr noundef %a1, ptr noundef %a2, ptr noundef %a3) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %a1, ptr noundef %a2, ptr noundef %a3)
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int4(ptr noundef %a1, ptr noundef %a2, ptr noundef %a3, ptr noundef %a4) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %a1, ptr noundef %a2, ptr noundef %a3, ptr noundef %a4)
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int5(ptr noundef %a1, ptr noundef %a2, ptr noundef %a3, ptr noundef %a4, ptr noundef %a5) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef %a1, ptr noundef %a2, ptr noundef %a3, ptr noundef %a4, ptr noundef %a5)
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fget_array(ptr noundef %arr, i32 noundef %size) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i32 %size, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %size to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%xscore = alloca i32, align 4
%yscore = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %xscore) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %yscore) #5
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %num, ptr noundef nonnull %xscore, ptr noundef nonnull %yscore)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp3.i = icmp sgt i32 %0, 0
br i1 %cmp3.i, label %for.body.preheader.i, label %for.end
for.body.preheader.i: ; preds = %entry
%wide.trip.count.i = zext i32 %0 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr @main.arr, i64 %indvars.iv.i
%call.i80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.i)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %fget_array.exit, label %for.body.i, !llvm.loop !9
fget_array.exit: ; preds = %for.body.i
%.pre = load i32, ptr %num, align 4, !tbaa !5
%sub = add nsw i32 %.pre, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [2000 x i32], ptr @main.arr, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp81 = icmp sgt i32 %.pre, 0
br i1 %cmp81, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %fget_array.exit
%2 = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %2, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%prev_x.083 = phi i32 [ 1000000000, %for.body.preheader ], [ %cond26, %for.body ]
%prev_y.082 = phi i32 [ 0, %for.body.preheader ], [ %cond55, %for.body ]
%tobool.not = icmp eq i64 %indvars.iv, 0
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom4 = and i64 %indvars.iv.next, 4294967295
%arrayidx5 = getelementptr inbounds [2000 x i32], ptr @main.arr, i64 0, i64 %idxprom4
%cond.in = select i1 %tobool.not, ptr %yscore, ptr %arrayidx5
%cond = load i32, ptr %cond.in, align 4, !tbaa !5
%sub6 = sub nsw i32 %cond, %1
%3 = call i32 @llvm.abs.i32(i32 %sub6, i1 true)
%cond12 = call i32 @llvm.smax.i32(i32 %3, i32 %prev_y.082)
%arrayidx14 = getelementptr inbounds [2001 x [2 x i32]], ptr @main.dp, i64 0, i64 %indvars.iv
store i32 %cond12, ptr %arrayidx14, align 8, !tbaa !5
%cond26 = call i32 @llvm.smin.i32(i32 %prev_x.083, i32 %cond12)
%cond34.in = select i1 %tobool.not, ptr %xscore, ptr %arrayidx5
%cond34 = load i32, ptr %cond34.in, align 4, !tbaa !5
%sub35 = sub nsw i32 %cond34, %1
%4 = call i32 @llvm.abs.i32(i32 %sub35, i1 true)
%cond41 = call i32 @llvm.smin.i32(i32 %4, i32 %cond26)
%arrayidx44 = getelementptr inbounds [2001 x [2 x i32]], ptr @main.dp, i64 0, i64 %indvars.iv, i64 1
store i32 %cond41, ptr %arrayidx44, align 4, !tbaa !5
%cond55 = call i32 @llvm.smax.i32(i32 %prev_y.082, i32 %cond41)
%cmp.not = icmp eq i64 %indvars.iv, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %entry, %fget_array.exit
%5 = load i32, ptr @main.dp, align 16, !tbaa !5
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %yscore) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %xscore) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main( )
{
int n , i , k=0 ;
scanf("%d" , &n);
for( i = 1 ; i <= n ; i++)
{
k = k+i ;
}
printf("%d\n" , k);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163357/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163357/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%k.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int F[202][10003]={0};
int N,st=0,sw=0;
void init();
void Dp(int,int);
int main()
{
//freopen("1.in","r",stdin);
init();
//doit();
//fclose(stdin);
return 0;
}
void init()
{
int i,j,t,w;
scanf("%d",&N);
F[0][0]=1;
for(i=1;i<=N;i++)
{
scanf("%d%d",&t,&w);
st+=t;sw+=w;
Dp(t,w);
}
for(i=1;i<=st;i++)
for(j=0;j<=i;j++)
if(F[i][j]) {
printf("%d\n",i);
return ;
}
}
void Dp(int t,int w)
{
int i,j;
for(i=st;i>=0;i--)
for(j=sw;j>=0;j--)
if((i-t>=0&&F[i-t][j])||(j-w>=0&&F[i][j-w])) F[i][j]=1;
else F[i][j]=0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16340/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16340/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@F = dso_local local_unnamed_addr global [202 x [10003 x i32]] zeroinitializer, align 16
@st = dso_local local_unnamed_addr global i32 0, align 4
@sw = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
tail call void @init()
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @init() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
store i32 1, ptr @F, align 16, !tbaa !5
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %0, 1
br i1 %cmp.not31, label %entry.for.cond3.preheader_crit_edge, label %for.body
entry.for.cond3.preheader_crit_edge: ; preds = %entry
%.pre = load i32, ptr @st, align 4, !tbaa !5
br label %for.cond3.preheader
for.cond3.preheader: ; preds = %Dp.exit, %entry.for.cond3.preheader_crit_edge
%1 = phi i32 [ %.pre, %entry.for.cond3.preheader_crit_edge ], [ %add, %Dp.exit ]
%cmp4.not34 = icmp slt i32 %1, 1
br i1 %cmp4.not34, label %cleanup, label %for.cond6.preheader.preheader
for.cond6.preheader.preheader: ; preds = %for.cond3.preheader
%2 = add nuw i32 %1, 1
%wide.trip.count48 = zext i32 %2 to i64
br label %for.cond6.preheader
for.body: ; preds = %entry, %Dp.exit
%i.032 = phi i32 [ %inc, %Dp.exit ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %w)
%3 = load i32, ptr %t, align 4, !tbaa !5
%4 = load i32, ptr @st, align 4, !tbaa !5
%add = add nsw i32 %4, %3
store i32 %add, ptr @st, align 4, !tbaa !5
%5 = load i32, ptr %w, align 4, !tbaa !5
%6 = load i32, ptr @sw, align 4, !tbaa !5
%add2 = add i32 %6, %5
store i32 %add2, ptr @sw, align 4, !tbaa !5
%cmp44.i = icmp sgt i32 %add, -1
%cmp242.i = icmp sgt i32 %add2, -1
%or.cond = select i1 %cmp44.i, i1 %cmp242.i, i1 false
br i1 %or.cond, label %for.body.us.preheader.i, label %Dp.exit
for.body.us.preheader.i: ; preds = %for.body
%7 = zext i32 %add2 to i64
%8 = zext i32 %add to i64
%9 = and i64 %7, 1
%lcmp.mod.not.not = icmp eq i64 %9, 0
%cmp9.us49.i.prol = icmp sgt i32 %6, -1
%idxprom14.us51.i.prol = zext i32 %6 to i64
%indvars.iv.next.i.prol = add nsw i64 %7, -1
%10 = icmp eq i32 %add2, 0
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond1.for.inc25_crit_edge.us.i, %for.body.us.preheader.i
%indvars.iv71.i = phi i64 [ %8, %for.body.us.preheader.i ], [ %indvars.iv.next72.i, %for.cond1.for.inc25_crit_edge.us.i ]
%11 = trunc i64 %indvars.iv71.i to i32
%sub.us.i = sub nsw i32 %11, %3
%cmp4.us.i = icmp sgt i32 %sub.us.i, -1
%idxprom.us.i = zext i32 %sub.us.i to i64
br i1 %cmp4.us.i, label %for.body3.us.us.i, label %for.body3.us46.i.preheader
for.body3.us46.i.preheader: ; preds = %for.body.us.i
br i1 %lcmp.mod.not.not, label %for.body3.us46.i.prol, label %for.body3.us46.i.prol.loopexit
for.body3.us46.i.prol: ; preds = %for.body3.us46.i.preheader
br i1 %cmp9.us49.i.prol, label %land.lhs.true10.us50.i.prol, label %if.else.us57.i.prol
land.lhs.true10.us50.i.prol: ; preds = %for.body3.us46.i.prol
%arrayidx15.us52.i.prol = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71.i, i64 %idxprom14.us51.i.prol
%12 = load i32, ptr %arrayidx15.us52.i.prol, align 4, !tbaa !5
%tobool16.not.us53.i.prol = icmp eq i32 %12, 0
br i1 %tobool16.not.us53.i.prol, label %if.else.us57.i.prol, label %for.inc.us60.i.prol
if.else.us57.i.prol: ; preds = %land.lhs.true10.us50.i.prol, %for.body3.us46.i.prol
br label %for.inc.us60.i.prol
for.inc.us60.i.prol: ; preds = %if.else.us57.i.prol, %land.lhs.true10.us50.i.prol
%.sink.i.prol = phi i32 [ 0, %if.else.us57.i.prol ], [ 1, %land.lhs.true10.us50.i.prol ]
%arrayidx24.us59.i.prol = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71.i, i64 %7
store i32 %.sink.i.prol, ptr %arrayidx24.us59.i.prol, align 4, !tbaa !5
br label %for.body3.us46.i.prol.loopexit
for.body3.us46.i.prol.loopexit: ; preds = %for.inc.us60.i.prol, %for.body3.us46.i.preheader
%indvars.iv.i.unr = phi i64 [ %7, %for.body3.us46.i.preheader ], [ %indvars.iv.next.i.prol, %for.inc.us60.i.prol ]
br i1 %10, label %for.cond1.for.inc25_crit_edge.us.i, label %for.body3.us46.i
for.body3.us46.i: ; preds = %for.body3.us46.i.prol.loopexit, %for.inc.us60.i.1
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.1, %for.inc.us60.i.1 ], [ %indvars.iv.i.unr, %for.body3.us46.i.prol.loopexit ]
%13 = trunc i64 %indvars.iv.i to i32
%sub8.us48.i = sub nsw i32 %13, %5
%cmp9.us49.i = icmp sgt i32 %sub8.us48.i, -1
br i1 %cmp9.us49.i, label %land.lhs.true10.us50.i, label %if.else.us57.i
land.lhs.true10.us50.i: ; preds = %for.body3.us46.i
%idxprom14.us51.i = zext i32 %sub8.us48.i to i64
%arrayidx15.us52.i = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71.i, i64 %idxprom14.us51.i
%14 = load i32, ptr %arrayidx15.us52.i, align 4, !tbaa !5
%tobool16.not.us53.i = icmp eq i32 %14, 0
br i1 %tobool16.not.us53.i, label %if.else.us57.i, label %for.inc.us60.i
if.else.us57.i: ; preds = %land.lhs.true10.us50.i, %for.body3.us46.i
br label %for.inc.us60.i
for.inc.us60.i: ; preds = %if.else.us57.i, %land.lhs.true10.us50.i
%.sink.i = phi i32 [ 0, %if.else.us57.i ], [ 1, %land.lhs.true10.us50.i ]
%arrayidx24.us59.i = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71.i, i64 %indvars.iv.i
store i32 %.sink.i, ptr %arrayidx24.us59.i, align 4, !tbaa !5
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%15 = trunc i64 %indvars.iv.next.i to i32
%sub8.us48.i.1 = sub nsw i32 %15, %5
%cmp9.us49.i.1 = icmp sgt i32 %sub8.us48.i.1, -1
br i1 %cmp9.us49.i.1, label %land.lhs.true10.us50.i.1, label %if.else.us57.i.1
land.lhs.true10.us50.i.1: ; preds = %for.inc.us60.i
%idxprom14.us51.i.1 = zext i32 %sub8.us48.i.1 to i64
%arrayidx15.us52.i.1 = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71.i, i64 %idxprom14.us51.i.1
%16 = load i32, ptr %arrayidx15.us52.i.1, align 4, !tbaa !5
%tobool16.not.us53.i.1 = icmp eq i32 %16, 0
br i1 %tobool16.not.us53.i.1, label %if.else.us57.i.1, label %for.inc.us60.i.1
if.else.us57.i.1: ; preds = %land.lhs.true10.us50.i.1, %for.inc.us60.i
br label %for.inc.us60.i.1
for.inc.us60.i.1: ; preds = %if.else.us57.i.1, %land.lhs.true10.us50.i.1
%.sink.i.1 = phi i32 [ 0, %if.else.us57.i.1 ], [ 1, %land.lhs.true10.us50.i.1 ]
%arrayidx24.us59.i.1 = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71.i, i64 %indvars.iv.next.i
store i32 %.sink.i.1, ptr %arrayidx24.us59.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nsw i64 %indvars.iv.i, -2
%cmp2.us62.i.1 = icmp sgt i64 %indvars.iv.i, 1
br i1 %cmp2.us62.i.1, label %for.body3.us46.i, label %for.cond1.for.inc25_crit_edge.us.i, !llvm.loop !9
for.cond1.for.inc25_crit_edge.us.i: ; preds = %for.body3.us46.i.prol.loopexit, %for.inc.us60.i.1, %for.inc.us.us.i
%indvars.iv.next72.i = add nsw i64 %indvars.iv71.i, -1
%cmp.us.i = icmp sgt i64 %indvars.iv71.i, 0
br i1 %cmp.us.i, label %for.body.us.i, label %Dp.exit, !llvm.loop !11
for.body3.us.us.i: ; preds = %for.body.us.i, %for.inc.us.us.i
%indvars.iv68.i = phi i64 [ %indvars.iv.next69.i, %for.inc.us.us.i ], [ %7, %for.body.us.i ]
%arrayidx7.us.us.i = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %idxprom.us.i, i64 %indvars.iv68.i
%17 = load i32, ptr %arrayidx7.us.us.i, align 4, !tbaa !5
%tobool.not.us.us.i = icmp eq i32 %17, 0
br i1 %tobool.not.us.us.i, label %lor.lhs.false.us.us.i, label %for.inc.us.us.i
lor.lhs.false.us.us.i: ; preds = %for.body3.us.us.i
%18 = trunc i64 %indvars.iv68.i to i32
%sub8.us.us.i = sub nsw i32 %18, %5
%cmp9.us.us.i = icmp sgt i32 %sub8.us.us.i, -1
br i1 %cmp9.us.us.i, label %land.lhs.true10.us.us.i, label %if.else.us.us.i
land.lhs.true10.us.us.i: ; preds = %lor.lhs.false.us.us.i
%idxprom14.us.us.i = zext i32 %sub8.us.us.i to i64
%arrayidx15.us.us.i = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71.i, i64 %idxprom14.us.us.i
%19 = load i32, ptr %arrayidx15.us.us.i, align 4, !tbaa !5
%tobool16.not.us.us.i = icmp eq i32 %19, 0
br i1 %tobool16.not.us.us.i, label %if.else.us.us.i, label %for.inc.us.us.i
if.else.us.us.i: ; preds = %land.lhs.true10.us.us.i, %lor.lhs.false.us.us.i
br label %for.inc.us.us.i
for.inc.us.us.i: ; preds = %if.else.us.us.i, %land.lhs.true10.us.us.i, %for.body3.us.us.i
%.sink75.i = phi i32 [ 0, %if.else.us.us.i ], [ 1, %land.lhs.true10.us.us.i ], [ 1, %for.body3.us.us.i ]
%arrayidx24.us.us.i = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71.i, i64 %indvars.iv68.i
store i32 %.sink75.i, ptr %arrayidx24.us.us.i, align 4, !tbaa !5
%indvars.iv.next69.i = add nsw i64 %indvars.iv68.i, -1
%cmp2.us.us.i = icmp sgt i64 %indvars.iv68.i, 0
br i1 %cmp2.us.us.i, label %for.body3.us.us.i, label %for.cond1.for.inc25_crit_edge.us.i, !llvm.loop !9
Dp.exit: ; preds = %for.cond1.for.inc25_crit_edge.us.i, %for.body
%inc = add nuw nsw i32 %i.032, 1
%20 = load i32, ptr @N, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.032, %20
br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !12
for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc15
%indvars.iv43 = phi i64 [ 1, %for.cond6.preheader.preheader ], [ %indvars.iv.next44, %for.inc15 ]
%indvars.iv41 = phi i64 [ 2, %for.cond6.preheader.preheader ], [ %indvars.iv.next42, %for.inc15 ]
br label %for.body8
for.cond6: ; preds = %for.body8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv41
br i1 %exitcond.not, label %for.inc15, label %for.body8, !llvm.loop !13
for.body8: ; preds = %for.cond6.preheader, %for.cond6
%indvars.iv = phi i64 [ 0, %for.cond6.preheader ], [ %indvars.iv.next, %for.cond6 ]
%arrayidx10 = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv43, i64 %indvars.iv
%21 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%tobool.not = icmp eq i32 %21, 0
br i1 %tobool.not, label %for.cond6, label %if.then
if.then: ; preds = %for.body8
%22 = trunc i64 %indvars.iv43 to i32
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
br label %cleanup
for.inc15: ; preds = %for.cond6
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond49.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count48
br i1 %exitcond49.not, label %cleanup, label %for.cond6.preheader, !llvm.loop !14
cleanup: ; preds = %for.inc15, %for.cond3.preheader, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Dp(i32 noundef %t, i32 noundef %w) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @st, align 4, !tbaa !5
%cmp44 = icmp sgt i32 %0, -1
br i1 %cmp44, label %for.body.lr.ph, label %for.end27
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr @sw, align 4, !tbaa !5
%cmp242 = icmp sgt i32 %1, -1
br i1 %cmp242, label %for.body.us.preheader, label %for.end27
for.body.us.preheader: ; preds = %for.body.lr.ph
%2 = zext i32 %1 to i64
%3 = zext i32 %0 to i64
%4 = and i64 %2, 1
%lcmp.mod.not.not = icmp eq i64 %4, 0
%sub8.us48.prol = sub nsw i32 %1, %w
%cmp9.us49.prol = icmp sgt i32 %sub8.us48.prol, -1
%idxprom14.us51.prol = zext i32 %sub8.us48.prol to i64
%indvars.iv.next.prol = add nsw i64 %2, -1
%5 = icmp eq i32 %1, 0
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond1.for.inc25_crit_edge.us
%indvars.iv71 = phi i64 [ %3, %for.body.us.preheader ], [ %indvars.iv.next72, %for.cond1.for.inc25_crit_edge.us ]
%6 = trunc i64 %indvars.iv71 to i32
%sub.us = sub nsw i32 %6, %t
%cmp4.us = icmp sgt i32 %sub.us, -1
%idxprom.us = zext i32 %sub.us to i64
br i1 %cmp4.us, label %for.body3.us.us, label %for.body3.us46.preheader
for.body3.us46.preheader: ; preds = %for.body.us
br i1 %lcmp.mod.not.not, label %for.body3.us46.prol, label %for.body3.us46.prol.loopexit
for.body3.us46.prol: ; preds = %for.body3.us46.preheader
br i1 %cmp9.us49.prol, label %land.lhs.true10.us50.prol, label %if.else.us57.prol
land.lhs.true10.us50.prol: ; preds = %for.body3.us46.prol
%arrayidx15.us52.prol = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71, i64 %idxprom14.us51.prol
%7 = load i32, ptr %arrayidx15.us52.prol, align 4, !tbaa !5
%tobool16.not.us53.prol = icmp eq i32 %7, 0
br i1 %tobool16.not.us53.prol, label %if.else.us57.prol, label %for.inc.us60.prol
if.else.us57.prol: ; preds = %land.lhs.true10.us50.prol, %for.body3.us46.prol
br label %for.inc.us60.prol
for.inc.us60.prol: ; preds = %if.else.us57.prol, %land.lhs.true10.us50.prol
%.sink.prol = phi i32 [ 0, %if.else.us57.prol ], [ 1, %land.lhs.true10.us50.prol ]
%arrayidx24.us59.prol = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71, i64 %2
store i32 %.sink.prol, ptr %arrayidx24.us59.prol, align 4, !tbaa !5
br label %for.body3.us46.prol.loopexit
for.body3.us46.prol.loopexit: ; preds = %for.inc.us60.prol, %for.body3.us46.preheader
%indvars.iv.unr = phi i64 [ %2, %for.body3.us46.preheader ], [ %indvars.iv.next.prol, %for.inc.us60.prol ]
br i1 %5, label %for.cond1.for.inc25_crit_edge.us, label %for.body3.us46
for.body3.us46: ; preds = %for.body3.us46.prol.loopexit, %for.inc.us60.1
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc.us60.1 ], [ %indvars.iv.unr, %for.body3.us46.prol.loopexit ]
%8 = trunc i64 %indvars.iv to i32
%sub8.us48 = sub nsw i32 %8, %w
%cmp9.us49 = icmp sgt i32 %sub8.us48, -1
br i1 %cmp9.us49, label %land.lhs.true10.us50, label %if.else.us57
land.lhs.true10.us50: ; preds = %for.body3.us46
%idxprom14.us51 = zext i32 %sub8.us48 to i64
%arrayidx15.us52 = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71, i64 %idxprom14.us51
%9 = load i32, ptr %arrayidx15.us52, align 4, !tbaa !5
%tobool16.not.us53 = icmp eq i32 %9, 0
br i1 %tobool16.not.us53, label %if.else.us57, label %for.inc.us60
if.else.us57: ; preds = %land.lhs.true10.us50, %for.body3.us46
br label %for.inc.us60
for.inc.us60: ; preds = %land.lhs.true10.us50, %if.else.us57
%.sink = phi i32 [ 0, %if.else.us57 ], [ 1, %land.lhs.true10.us50 ]
%arrayidx24.us59 = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71, i64 %indvars.iv
store i32 %.sink, ptr %arrayidx24.us59, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%10 = trunc i64 %indvars.iv.next to i32
%sub8.us48.1 = sub nsw i32 %10, %w
%cmp9.us49.1 = icmp sgt i32 %sub8.us48.1, -1
br i1 %cmp9.us49.1, label %land.lhs.true10.us50.1, label %if.else.us57.1
land.lhs.true10.us50.1: ; preds = %for.inc.us60
%idxprom14.us51.1 = zext i32 %sub8.us48.1 to i64
%arrayidx15.us52.1 = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71, i64 %idxprom14.us51.1
%11 = load i32, ptr %arrayidx15.us52.1, align 4, !tbaa !5
%tobool16.not.us53.1 = icmp eq i32 %11, 0
br i1 %tobool16.not.us53.1, label %if.else.us57.1, label %for.inc.us60.1
if.else.us57.1: ; preds = %land.lhs.true10.us50.1, %for.inc.us60
br label %for.inc.us60.1
for.inc.us60.1: ; preds = %if.else.us57.1, %land.lhs.true10.us50.1
%.sink.1 = phi i32 [ 0, %if.else.us57.1 ], [ 1, %land.lhs.true10.us50.1 ]
%arrayidx24.us59.1 = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71, i64 %indvars.iv.next
store i32 %.sink.1, ptr %arrayidx24.us59.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, -2
%cmp2.us62.1 = icmp sgt i64 %indvars.iv, 1
br i1 %cmp2.us62.1, label %for.body3.us46, label %for.cond1.for.inc25_crit_edge.us, !llvm.loop !9
for.cond1.for.inc25_crit_edge.us: ; preds = %for.body3.us46.prol.loopexit, %for.inc.us60.1, %for.inc.us.us
%indvars.iv.next72 = add nsw i64 %indvars.iv71, -1
%cmp.us = icmp sgt i64 %indvars.iv71, 0
br i1 %cmp.us, label %for.body.us, label %for.end27, !llvm.loop !11
for.body3.us.us: ; preds = %for.body.us, %for.inc.us.us
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %for.inc.us.us ], [ %2, %for.body.us ]
%arrayidx7.us.us = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %idxprom.us, i64 %indvars.iv68
%12 = load i32, ptr %arrayidx7.us.us, align 4, !tbaa !5
%tobool.not.us.us = icmp eq i32 %12, 0
br i1 %tobool.not.us.us, label %lor.lhs.false.us.us, label %for.inc.us.us
lor.lhs.false.us.us: ; preds = %for.body3.us.us
%13 = trunc i64 %indvars.iv68 to i32
%sub8.us.us = sub nsw i32 %13, %w
%cmp9.us.us = icmp sgt i32 %sub8.us.us, -1
br i1 %cmp9.us.us, label %land.lhs.true10.us.us, label %if.else.us.us
land.lhs.true10.us.us: ; preds = %lor.lhs.false.us.us
%idxprom14.us.us = zext i32 %sub8.us.us to i64
%arrayidx15.us.us = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71, i64 %idxprom14.us.us
%14 = load i32, ptr %arrayidx15.us.us, align 4, !tbaa !5
%tobool16.not.us.us = icmp eq i32 %14, 0
br i1 %tobool16.not.us.us, label %if.else.us.us, label %for.inc.us.us
if.else.us.us: ; preds = %land.lhs.true10.us.us, %lor.lhs.false.us.us
br label %for.inc.us.us
for.inc.us.us: ; preds = %for.body3.us.us, %land.lhs.true10.us.us, %if.else.us.us
%.sink75 = phi i32 [ 0, %if.else.us.us ], [ 1, %land.lhs.true10.us.us ], [ 1, %for.body3.us.us ]
%arrayidx24.us.us = getelementptr inbounds [202 x [10003 x i32]], ptr @F, i64 0, i64 %indvars.iv71, i64 %indvars.iv68
store i32 %.sink75, ptr %arrayidx24.us.us, align 4, !tbaa !5
%indvars.iv.next69 = add nsw i64 %indvars.iv68, -1
%cmp2.us.us = icmp sgt i64 %indvars.iv68, 0
br i1 %cmp2.us.us, label %for.body3.us.us, label %for.cond1.for.inc25_crit_edge.us, !llvm.loop !9
for.end27: ; preds = %for.cond1.for.inc25_crit_edge.us, %for.body.lr.ph, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(void){
int N;
scanf("%d",&N);
printf("%d\n",N*(N+1)/2);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163443/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163443/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%mul = mul nsw i32 %add, %0
%div = sdiv i32 %mul, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,i,s=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
s=s+i;
printf("%d\n",s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163487/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163487/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%s.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %s.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int n,a[101],m,i,x,y;
int main()
{
scanf("%d",&n);
a[0]=0;
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
scanf("%d",&m);
while(m--)
{
scanf("%d%d",&x,&y);
if(x-1>=1)
a[x-1]+=y-1;
if(x+1<=n)
a[x+1]+=a[x]-y;
a[x]=0;
}
for(i=1;i<=n;i++)
printf("%d\n",a[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16353/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16353/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@a = dso_local global [101 x i32] zeroinitializer, align 16
@i = dso_local local_unnamed_addr global i32 0, align 4
@m = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@x = dso_local global i32 0, align 4
@y = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 0, ptr @a, align 16, !tbaa !5
store i32 1, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not33 = icmp slt i32 %0, 1
br i1 %cmp.not33, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%storemerge34 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%idxprom = sext i32 %storemerge34 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %idxprom
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %1, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
%3 = load i32, ptr @m, align 4, !tbaa !5
%dec35 = add nsw i32 %3, -1
store i32 %dec35, ptr @m, align 4, !tbaa !5
%tobool.not36 = icmp eq i32 %3, 0
br i1 %tobool.not36, label %for.end.for.cond22.preheader_crit_edge, label %while.body
for.end.for.cond22.preheader_crit_edge: ; preds = %for.end
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.cond22.preheader
for.cond22.preheader: ; preds = %if.end19, %for.end.for.cond22.preheader_crit_edge
%4 = phi i32 [ %.pre, %for.end.for.cond22.preheader_crit_edge ], [ %8, %if.end19 ]
store i32 1, ptr @i, align 4, !tbaa !5
%cmp23.not37 = icmp slt i32 %4, 1
br i1 %cmp23.not37, label %for.end30, label %for.body24
while.body: ; preds = %for.end, %if.end19
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x, ptr noundef nonnull @y)
%5 = load i32, ptr @x, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %5, 1
br i1 %cmp4, label %if.then, label %if.end
if.then: ; preds = %while.body
%sub = add nsw i32 %5, -1
%6 = load i32, ptr @y, align 4, !tbaa !5
%sub5 = add nsw i32 %6, -1
%idxprom7 = zext i32 %sub to i64
%arrayidx8 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %idxprom7
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%add = add nsw i32 %sub5, %7
store i32 %add, ptr %arrayidx8, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%8 = load i32, ptr @n, align 4, !tbaa !5
%cmp10.not.not = icmp slt i32 %5, %8
br i1 %cmp10.not.not, label %if.then11, label %if.end.if.end19_crit_edge
if.end.if.end19_crit_edge: ; preds = %if.end
%.pre39 = sext i32 %5 to i64
br label %if.end19
if.then11: ; preds = %if.end
%add9 = add nsw i32 %5, 1
%idxprom12 = sext i32 %5 to i64
%arrayidx13 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %idxprom12
%9 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%10 = load i32, ptr @y, align 4, !tbaa !5
%sub14 = sub i32 %9, %10
%idxprom16 = sext i32 %add9 to i64
%arrayidx17 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %idxprom16
%11 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%add18 = add nsw i32 %sub14, %11
store i32 %add18, ptr %arrayidx17, align 4, !tbaa !5
br label %if.end19
if.end19: ; preds = %if.end.if.end19_crit_edge, %if.then11
%idxprom20.pre-phi = phi i64 [ %.pre39, %if.end.if.end19_crit_edge ], [ %idxprom12, %if.then11 ]
%arrayidx21 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %idxprom20.pre-phi
store i32 0, ptr %arrayidx21, align 4, !tbaa !5
%12 = load i32, ptr @m, align 4, !tbaa !5
%dec = add nsw i32 %12, -1
store i32 %dec, ptr @m, align 4, !tbaa !5
%tobool.not = icmp eq i32 %12, 0
br i1 %tobool.not, label %for.cond22.preheader, label %while.body, !llvm.loop !11
for.body24: ; preds = %for.cond22.preheader, %for.body24
%storemerge3238 = phi i32 [ %inc29, %for.body24 ], [ 1, %for.cond22.preheader ]
%idxprom25 = sext i32 %storemerge3238 to i64
%arrayidx26 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %idxprom25
%13 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%call27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%14 = load i32, ptr @i, align 4, !tbaa !5
%inc29 = add nsw i32 %14, 1
store i32 %inc29, ptr @i, align 4, !tbaa !5
%15 = load i32, ptr @n, align 4, !tbaa !5
%cmp23.not.not = icmp slt i32 %14, %15
br i1 %cmp23.not.not, label %for.body24, label %for.end30, !llvm.loop !12
for.end30: ; preds = %for.body24, %for.cond22.preheader
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
int a,sum=0;
scanf("%d",&a);
for(int i=1;i<=a;i++)
{
sum+=i;
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163573/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163573/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
printf("%d\n",n*(n+1)/2);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163616/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163616/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%mul = mul nsw i32 %add, %0
%div = sdiv i32 %mul, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],i=0,x,y,m;
while(i<n)
scanf("%d",&a[i++]);
scanf("%d",&m);
while(m--)
{
scanf("%d %d",&x,&y);
if(x<n)
a[x]+=a[x-1]-y;
if(x-2>=0)
a[x-2]+=y-1;
a[x-1]=0;
}
for(i=0;i<n;i++)
printf("%d\n",a[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16366/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16366/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
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 %m) #4
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %3, 0
br i1 %cmp34, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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 %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%6 = load i32, ptr %m, align 4, !tbaa !5
%dec36 = add nsw i32 %6, -1
store i32 %dec36, ptr %m, align 4, !tbaa !5
%tobool.not37 = icmp eq i32 %6, 0
br i1 %tobool.not37, label %while.end.for.cond.preheader_crit_edge, label %while.body4
while.end.for.cond.preheader_crit_edge: ; preds = %while.end
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond.preheader
for.cond.preheader: ; preds = %if.end20, %while.end.for.cond.preheader_crit_edge
%7 = phi i32 [ %.pre, %while.end.for.cond.preheader_crit_edge ], [ %9, %if.end20 ]
%cmp2538 = icmp sgt i32 %7, 0
br i1 %cmp2538, label %for.body, label %for.end
while.body4: ; preds = %while.end, %if.end20
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%8 = load i32, ptr %x, align 4, !tbaa !5
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp slt i32 %8, %9
br i1 %cmp6, label %if.then, label %if.end
if.then: ; preds = %while.body4
%sub = add nsw i32 %8, -1
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %idxprom7
%10 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%11 = load i32, ptr %y, align 4, !tbaa !5
%sub9 = sub i32 %10, %11
%idxprom10 = sext i32 %8 to i64
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %idxprom10
%12 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%add = add nsw i32 %sub9, %12
store i32 %add, ptr %arrayidx11, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body4
%cmp13 = icmp sgt i32 %8, 1
br i1 %cmp13, label %if.then14, label %if.end20
if.then14: ; preds = %if.end
%sub12 = add nsw i32 %8, -2
%13 = load i32, ptr %y, align 4, !tbaa !5
%sub15 = add nsw i32 %13, -1
%idxprom17 = zext i32 %sub12 to i64
%arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %idxprom17
%14 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%add19 = add nsw i32 %sub15, %14
store i32 %add19, ptr %arrayidx18, align 4, !tbaa !5
br label %if.end20
if.end20: ; preds = %if.then14, %if.end
%sub21 = add nsw i32 %8, -1
%idxprom22 = sext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds i32, ptr %vla, i64 %idxprom22
store i32 0, ptr %arrayidx23, align 4, !tbaa !5
%15 = load i32, ptr %m, align 4, !tbaa !5
%dec = add nsw i32 %15, -1
store i32 %dec, ptr %m, align 4, !tbaa !5
%tobool.not = icmp eq i32 %15, 0
br i1 %tobool.not, label %for.cond.preheader, label %while.body4, !llvm.loop !11
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv41
%16 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp25 = icmp slt i64 %indvars.iv.next42, %18
br i1 %cmp25, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(){
int N;
scanf("%d",&N);
printf("%d\n",N*(N+1)/2);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163702/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163702/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%mul = mul nsw i32 %add, %0
%div = sdiv i32 %mul, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int x=0,sum=0,a=0,b=0;
scanf("%d,%d,%d",&a,&x,&b);
while (x<a)
x=x+1;
b=x;
sum=(b+1)*b/2;
printf("%d\n",sum);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163746/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163746/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d,%d,%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
store i32 0, ptr %x, align 4, !tbaa !5
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 %x, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%x.promoted = load i32, ptr %x, align 4, !tbaa !5
%cmp4 = icmp slt i32 %x.promoted, %0
br i1 %cmp4, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
store i32 %0, ptr %x, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.body.preheader, %entry
%.lcssa = phi i32 [ %0, %while.body.preheader ], [ %x.promoted, %entry ]
store i32 %.lcssa, ptr %b, align 4, !tbaa !5
%add1 = add nsw i32 %.lcssa, 1
%mul = mul nsw i32 %add1, %.lcssa
%div = sdiv i32 %mul, 2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int main(){
int n,i=0,j=0;
int cnt=0;
scanf("%d",&n);
for (i=1; i<=n; i++) {
for (j=i; j<=n; j++) {
long double kk=sqrtl((long double)((i*i)+(j*j)));
kk=(int)kk;
if((kk*kk)==((i*i) +(j*j)) && i<=j && j<=kk && kk<=n){
//printf("%Lf %Lf %Lf\n",i,j,kk);
cnt++;
}
}
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16379/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16379/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not53 = icmp slt i32 %0, 1
br i1 %cmp.not53, label %for.end28, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc26
%1 = phi i32 [ %2, %for.inc26 ], [ %0, %entry ]
%i.055 = phi i32 [ %inc27, %for.inc26 ], [ 1, %entry ]
%cnt.054 = phi i32 [ %cnt.1.lcssa, %for.inc26 ], [ 0, %entry ]
%cmp2.not50 = icmp sgt i32 %i.055, %1
br i1 %cmp2.not50, label %for.inc26, label %for.body3.lr.ph
for.body3.lr.ph: ; preds = %for.cond1.preheader
%mul = mul nsw i32 %i.055, %i.055
br label %for.body3
for.body3: ; preds = %for.body3.lr.ph, %for.body3
%cnt.152 = phi i32 [ %cnt.054, %for.body3.lr.ph ], [ %cnt.2, %for.body3 ]
%j.051 = phi i32 [ %i.055, %for.body3.lr.ph ], [ %inc25, %for.body3 ]
%mul4 = mul nsw i32 %j.051, %j.051
%add = add nuw nsw i32 %mul4, %mul
%conv = sitofp i32 %add to x86_fp80
%call5 = call x86_fp80 @sqrtl(x86_fp80 noundef %conv) #4
%conv6 = fptosi x86_fp80 %call5 to i32
%conv7 = sitofp i32 %conv6 to x86_fp80
%mul8 = fmul x86_fp80 %conv7, %conv7
%cmp13 = fcmp une x86_fp80 %mul8, %conv
%cmp15.not = icmp ugt i32 %i.055, %j.051
%or.cond = or i1 %cmp15.not, %cmp13
%conv18 = sitofp i32 %j.051 to x86_fp80
%cmp19 = fcmp ugt x86_fp80 %conv18, %conv7
%or.cond49 = or i1 %cmp19, %or.cond
%.pre = load i32, ptr %n, align 4, !tbaa !5
%conv22 = sitofp i32 %.pre to x86_fp80
%cmp23 = fcmp ugt x86_fp80 %conv7, %conv22
%or.cond57 = or i1 %or.cond49, %cmp23
%not.or.cond57 = xor i1 %or.cond57, true
%inc = zext i1 %not.or.cond57 to i32
%cnt.2 = add nsw i32 %cnt.152, %inc
%inc25 = add nuw nsw i32 %j.051, 1
%cmp2.not.not = icmp slt i32 %j.051, %.pre
br i1 %cmp2.not.not, label %for.body3, label %for.inc26, !llvm.loop !9
for.inc26: ; preds = %for.body3, %for.cond1.preheader
%2 = phi i32 [ %1, %for.cond1.preheader ], [ %.pre, %for.body3 ]
%cnt.1.lcssa = phi i32 [ %cnt.054, %for.cond1.preheader ], [ %cnt.2, %for.body3 ]
%inc27 = add nuw nsw i32 %i.055, 1
%cmp.not.not = icmp slt i32 %i.055, %2
br i1 %cmp.not.not, label %for.cond1.preheader, label %for.end28, !llvm.loop !11
for.end28: ; preds = %for.inc26, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.1.lcssa, %for.inc26 ]
%call29 = 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 %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 x86_fp80 @sqrtl(x86_fp80 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int i,n,result;
scanf("%d", &n);
for(result=0,i=1;i<=n;i++){
result += i;
}
printf("%d\n",result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163876/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163876/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%result.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = 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 %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int n,i,sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++) sum+=i;
printf("%d\n",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163919/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163919/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %0, 1
br i1 %cmp.not5, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i32 %0, 1
%2 = add nsw i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add nsw i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %1, %8
%10 = add i32 %9, -1
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %10, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
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"}
|
#if 0
cat <<EOF >mistaken-paste
#endif
// thanks for @rsk0315_h4x
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define BIG 2000000007
#define VERYBIG 2000000000000007LL
#define MOD 1000000007
#define FOD 998244353
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 1000000
#ifdef __cplusplus
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <functional>
#include <array>
using std::queue;
using std::priority_queue;
using std::stack;
using std::tuple;
using std::set;
using std::map;
using std::vector;
using std::greater;
using std::pair;
using std::string;
using std::get;
template <typename T, typename U>
pair<T, U> operator+(pair<T, U> l, pair<T, U> r) {
return pair<T, U>(l.first + r.first, l.second + r.second);
}
#endif
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
sll a;
sll b;
sll c;
} hwllc;
typedef struct {
hwll a;
hwll b;
} linell;
ull n, m;
ull h, w;
ull k;
ull q;
sll va, vb, vc, vd, ve, vf;
ull ua, ub, uc, ud, ue, uf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
char ch, dh;
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
ull divide (ull a, ull b, ull modulo) {
return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
ull udiff (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sdiff (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
#define BEGCMP(NAME) int32_t NAME (const void *left, const void *right)
#define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right
#define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1
// int32_t pullcomp (const void *left, const void *right) {
// ull l = *(ull*)left;
// ull r = *(ull*)right;
// if (l < r) {
// return -1;
// }
// if (l > r) {
// return +1;
// }
// return 0;
// }
BEGCMP(pullcomp){
DEFLR(ull);
CMPRET(l, r);
return 0;
}
BEGCMP(prevcomp){
DEFLR(ull);
CMPRET(r, l);
return 0;
}
BEGCMP(psllcomp){
DEFLR(sll);
CMPRET(l, r);
return 0;
}
BEGCMP(pcharcomp){
DEFLR(char);
CMPRET(l, r);
return 0;
}
BEGCMP(pdoublecomp){
DEFLR(double);
CMPRET(l, r);
return 0;
}
int32_t pstrcomp (const void *left, const void *right) {
char* l = *(char**)left;
char* r = *(char**)right;
return strcmp(l, r);
}
BEGCMP(phwllABcomp){
DEFLR(hwll);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
return 0;
}
BEGCMP(phwllREVcomp){
DEFLR(hwll);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
return 0;
}
BEGCMP(ptriplecomp){
DEFLR(hwllc);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
CMPRET(l.c, r.c);
return 0;
}
BEGCMP(ptripleREVcomp){
DEFLR(hwllc);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
CMPRET(l.c, r.c);
return 0;
}
int32_t pquadcomp (const void *left, const void *right) {
linell l = *(linell*)left;
linell r = *(linell*)right;
sll ac = phwllABcomp(&(l.a), &(r.a));
if (ac) return ac;
sll bc = phwllABcomp(&(l.b), &(r.b));
if (bc) return bc;
return 0;
}
bool isinrange (sll left, sll x, sll right) {
return (left <= x && x <= right);
}
bool isinrange_soft (sll left, sll x, sll right) {
return (left <= x && x <= right) || (left >= x && x >= right);
}
sll a[N_MAX + 5];
// ull a[N_MAX + 5];
// sll a[3001][3001];
sll b[N_MAX + 5];
// ull b[N_MAX + 5];
// sll b[3001][3001];
sll c[N_MAX + 5];
ull d[N_MAX + 5];
sll e[N_MAX];
// char s[N_MAX + 1];
char s[3010][3010];
char t[N_MAX + 1];
// char t[3010][3010];
char u[N_MAX + 1];
hwll xy[N_MAX + 5];
hwllc tup[N_MAX + 5];
sll table[3005][3005];
// here we go
double p[N_MAX];
sll seg[524288], base = 262144;
sll segf_ (sll l, sll r, sll beg, sll end, sll i) {
if (end <= l || r <= beg) return 0;
if (l <= beg && end <= r) return seg[i];
sll med = (beg + end) / 2;
sll vl = segf_(l, r, beg, med, i * 2);
sll vr = segf_(l, r, med, end, i * 2 + 1);
return smax(vl, vr);
}
sll segf (sll l, sll r) {
return segf_(l, r, 0, base, 1);
}
void segup (sll v, sll x) {
seg[v += base] = x;
while (v /= 2) {
seg[v] = smax(seg[v * 2], seg[v * 2 + 1]);
}
}
ull bcnt (ull x) {
if (!x) return 0;
return bcnt(x / 2) + (x % 2);
}
ull gin[N_MAX];
hwll dp1[N_MAX];
void dfs1 (ull v, ull p) {
dp1[v].a = dp1[v].b = 1;
for (sll i = gin[v]; i < gin[v + 1]; i++) {
ull u = xy[i].b;
if (u == p) continue;
dfs1(u, v);
}
}
ull dp[3005][3005];
ull solve () {
sll i, j, ki, li;
// ull result = 0;
sll result = 0;
double dresult = 0;
// ull maybe = 0;
sll maybe = 0;
// ull sum = 0;
sll sum = 0;
sll item;
ull *dpcell;
dp[0][0] = 1;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
if (s[i][j] == '#') continue;
if (i) dp[i][j] += dp[i - 1][j];
if (j) dp[i][j] += dp[i][j - 1];
dp[i][j] %= MOD;
}
}
result = dp[h - 1][w - 1];
printf("%lld\n", result);
// printf("%.15lf\n", dresult);
// puts(s);
return 0;
success:
puts("YES");
// puts("Yes");
// printf("%llu\n", result);
// puts("0");
// puts("Yay!");
return 0;
fail:
// puts("NO");
// puts("No");
// puts("0");
puts("-1");
// puts("-1 -1 -1");
// puts("Impossible");
return 1;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
scanf("%llu%llu", &h, &w);
// scanf("%llu", &n, &m);
// scanf("%llu", &k, &n, &m);
// scanf("%llu%llu", &h, &w);
// scanf("%llu", &q);
// scanf("%s", s);
// scanf("%lld%lld", &va, &vb, &vc, &vd);
// scanf("%llu%llu%llu", &ua, &ub, &uc, &ud);
// scanf("%s", t);
// scanf("%lld", &m);
// for (i = 0; i < n; i++) {
// // scanf("%lld%lld", &xy[i].a, &xy[i].b);
// // scanf("%lld%lld%lld", &tup[i].a, &tup[i].b, &tup[i].c);
// scanf("%lld", &a[i]);
// scanf("%lld", &b[i]);
// // scanf("%lld", &c[i]);
// // scanf("%lld", &d[i]);
// // a[i]--;
// // b[i]--;
// // c[i]--;
// // d[i]--;
// // xy[i].a--;
// // xy[i].b--;
// // tup[i].a--;
// // tup[i].b--;
// }
// scanf("%llu", &m, &k);
// scanf("%llu", &q);
// scanf("%s", s);
// for (i = 0; i < n; i++) {
// scanf("%lld", &a[i]);
// // scanf("%lld", &b[i]);
// // b[i]--;
// // c[i]--;
// }
// scanf("%llu", &q);
// for (i = 0; i < q; i++) {
// scanf("%lld%lld", &xy[i].a, &xy[i].b);
// xy[i].a--;
// xy[i].b--;
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < n; j++) {
// scanf("%lld", &table[i][j]);
// // table[i][j]--;
// }
// }
for (i = 0; i < h; i++) {
scanf("%s", s[i]);
}
// scanf("%llu", &q);
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_163962/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_163962/source.c"
target datalayout = "e-m:e-p270: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.hwll = type { i64, i64 }
%struct.hwllc = type { i64, i64, i64 }
@base = dso_local local_unnamed_addr global i64 262144, align 8
@seg = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16
@dp1 = dso_local local_unnamed_addr global [1000000 x %struct.hwll] zeroinitializer, align 16
@gin = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@xy = dso_local local_unnamed_addr global [1000005 x %struct.hwll] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [3005 x [3005 x i64]] zeroinitializer, align 16
@h = dso_local global i64 0, align 8
@w = dso_local global i64 0, align 8
@s = dso_local global [3010 x [3010 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.3 = private unnamed_addr constant [9 x i8] c"%llu%llu\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@n = dso_local local_unnamed_addr global i64 0, align 8
@m = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local local_unnamed_addr global i64 0, align 8
@q = dso_local local_unnamed_addr global i64 0, align 8
@va = dso_local local_unnamed_addr global i64 0, align 8
@vb = dso_local local_unnamed_addr global i64 0, align 8
@vc = dso_local local_unnamed_addr global i64 0, align 8
@vd = dso_local local_unnamed_addr global i64 0, align 8
@ve = dso_local local_unnamed_addr global i64 0, align 8
@vf = dso_local local_unnamed_addr global i64 0, align 8
@ua = dso_local local_unnamed_addr global i64 0, align 8
@ub = dso_local local_unnamed_addr global i64 0, align 8
@uc = dso_local local_unnamed_addr global i64 0, align 8
@ud = dso_local local_unnamed_addr global i64 0, align 8
@ue = dso_local local_unnamed_addr global i64 0, align 8
@uf = dso_local local_unnamed_addr global i64 0, align 8
@vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@ch = dso_local local_unnamed_addr global i8 0, align 1
@dh = dso_local local_unnamed_addr global i8 0, align 1
@a = dso_local local_unnamed_addr global [1000005 x i64] zeroinitializer, align 16
@b = dso_local local_unnamed_addr global [1000005 x i64] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [1000005 x i64] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [1000005 x i64] zeroinitializer, align 16
@e = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16
@u = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16
@tup = dso_local local_unnamed_addr global [1000005 x %struct.hwllc] zeroinitializer, align 16
@table = dso_local local_unnamed_addr global [3005 x [3005 x i64]] zeroinitializer, align 16
@p = dso_local local_unnamed_addr global [1000000 x double] zeroinitializer, align 16
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ]
%y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ]
%cmp = icmp ult i64 %x.tr, %y.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.else
if.else: ; preds = %tailrecurse
%cmp1 = icmp eq i64 %y.tr, 0
br i1 %cmp1, label %return, label %if.else3
if.else3: ; preds = %if.else
%rem = urem i64 %x.tr, %y.tr
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.else3, %tailrecurse
%y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ]
br label %tailrecurse
return: ; preds = %if.else
ret i64 %x.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%tobool.not12 = icmp eq i64 %x, 0
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%result.015 = phi i64 [ %result.1, %if.end ], [ 1, %entry ]
%a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%x.addr.013 = phi i64 [ %div11, %if.end ], [ %x, %entry ]
%and = and i64 %x.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %result.015, %a.addr.014
%rem = urem i64 %mul, %modulo
br label %if.end
if.end: ; preds = %if.then, %while.body
%result.1 = phi i64 [ %rem, %if.then ], [ %result.015, %while.body ]
%div11 = lshr i64 %x.addr.013, 1
%mul2 = mul i64 %a.addr.014, %a.addr.014
%rem3 = urem i64 %mul2, %modulo
%tobool.not = icmp ult i64 %x.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ]
ret i64 %result.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%sub = add i64 %modulo, -2
%tobool.not12.i = icmp eq i64 %sub, 0
br i1 %tobool.not12.i, label %bitpow.exit, label %while.body.i
while.body.i: ; preds = %entry, %if.end.i
%result.015.i = phi i64 [ %result.1.i, %if.end.i ], [ 1, %entry ]
%a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %b, %entry ]
%x.addr.013.i = phi i64 [ %div11.i, %if.end.i ], [ %sub, %entry ]
%and.i = and i64 %x.addr.013.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul i64 %a.addr.014.i, %result.015.i
%rem.i = urem i64 %mul.i, %modulo
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%result.1.i = phi i64 [ %rem.i, %if.then.i ], [ %result.015.i, %while.body.i ]
%div11.i = lshr i64 %x.addr.013.i, 1
%mul2.i = mul i64 %a.addr.014.i, %a.addr.014.i
%rem3.i = urem i64 %mul2.i, %modulo
%tobool.not.i = icmp ult i64 %x.addr.013.i, 2
br i1 %tobool.not.i, label %bitpow.exit, label %while.body.i, !llvm.loop !5
bitpow.exit: ; preds = %if.end.i, %entry
%result.0.lcssa.i = phi i64 [ 1, %entry ], [ %result.1.i, %if.end.i ]
%mul = mul i64 %result.0.lcssa.i, %a
%rem = urem i64 %mul, %modulo
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @udiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not = icmp ult i64 %a, %b
%sub = sub i64 %a, %b
%sub1 = sub i64 %b, %a
%retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sdiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %a, %b
%retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 {
entry:
%tobool.not6 = icmp eq i64 %n, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ]
%0 = trunc i64 %n.addr.07 to i32
%1 = and i32 %0, 1
%spec.select = add i32 %1, %result.08
%div5 = lshr i64 %n.addr.07, 1
%tobool.not = icmp ult i64 %n.addr.07, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !7
while.end: ; preds = %while.body, %entry
%result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
ret i32 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp ult i64 %0, %1
%cmp1 = icmp ugt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @prevcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp ult i64 %1, %0
%cmp1 = icmp ugt i64 %1, %0
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i8, ptr %left, align 1, !tbaa !12
%1 = load i8, ptr %right, align 1, !tbaa !12
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp sgt i8 %0, %1
%. = zext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pdoublecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load double, ptr %left, align 8, !tbaa !13
%1 = load double, ptr %right, align 8, !tbaa !13
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp ogt double %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @pstrcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr %left, align 8, !tbaa !15
%1 = load ptr, ptr %right, align 8, !tbaa !15
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #12
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptriplecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptripleREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pquadcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !20
%l.sroa.4.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.4.0.copyload = load i64, ptr %l.sroa.4.0.left.sroa_idx, align 8, !tbaa.struct !19
%l.sroa.5.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0.left.sroa_idx, align 8, !tbaa.struct !17
%l.sroa.6.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 24
%l.sroa.6.0.copyload = load i64, ptr %l.sroa.6.0.left.sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !20
%r.sroa.4.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.4.0.copyload = load i64, ptr %r.sroa.4.0.right.sroa_idx, align 8, !tbaa.struct !19
%r.sroa.5.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0.right.sroa_idx, align 8, !tbaa.struct !17
%r.sroa.6.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 24
%r.sroa.6.0.copyload = load i64, ptr %r.sroa.6.0.right.sroa_idx, align 8, !tbaa.struct !18
%cmp.i = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp.i, label %cleanup10, label %if.end.i
if.end.i: ; preds = %entry
%cmp4.i = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4.i, label %cleanup10, label %if.end6.i
if.end6.i: ; preds = %if.end.i
%cmp8.i = icmp slt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp8.i, label %cleanup10, label %phwllABcomp.exit
phwllABcomp.exit: ; preds = %if.end6.i
%cmp13.i.not = icmp sgt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp13.i.not, label %cleanup10, label %if.end
if.end: ; preds = %phwllABcomp.exit
%cmp.i21 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp.i21, label %cleanup10, label %if.end.i22
if.end.i22: ; preds = %if.end
%cmp4.i23 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4.i23, label %cleanup10, label %if.end6.i24
if.end6.i24: ; preds = %if.end.i22
%cmp8.i25 = icmp slt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
br i1 %cmp8.i25, label %cleanup10, label %if.end10.i26
if.end10.i26: ; preds = %if.end6.i24
%cmp13.i27 = icmp sgt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
%..i28 = zext i1 %cmp13.i27 to i32
br label %cleanup10
cleanup10: ; preds = %if.end10.i26, %if.end6.i24, %if.end.i22, %if.end, %if.end6.i, %if.end.i, %entry, %phwllABcomp.exit
%retval.1 = phi i32 [ 1, %phwllABcomp.exit ], [ -1, %if.end6.i ], [ 1, %if.end.i ], [ -1, %entry ], [ -1, %if.end ], [ 1, %if.end.i22 ], [ -1, %if.end6.i24 ], [ %..i28, %if.end10.i26 ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp = icmp sle i64 %left, %x
%cmp1 = icmp sle i64 %x, %right
%0 = and i1 %cmp, %cmp1
ret i1 %0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange_soft(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %left, %x
%cmp1.not = icmp sgt i64 %x, %right
%or.cond = or i1 %cmp.not, %cmp1.not
br i1 %or.cond, label %lor.rhs, label %lor.end
lor.rhs: ; preds = %entry
%cmp2 = icmp sge i64 %left, %x
%cmp3 = icmp sge i64 %x, %right
%0 = and i1 %cmp2, %cmp3
br label %lor.end
lor.end: ; preds = %entry, %lor.rhs
%1 = phi i1 [ %0, %lor.rhs ], [ true, %entry ]
ret i1 %1
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @segf_(i64 noundef %l, i64 noundef %r, i64 noundef %beg, i64 noundef %end, i64 noundef %i) local_unnamed_addr #6 {
entry:
%cmp.not = icmp sgt i64 %end, %l
%cmp1.not = icmp sgt i64 %r, %beg
%or.cond = and i1 %cmp1.not, %cmp.not
br i1 %or.cond, label %if.end, label %common.ret26
if.end: ; preds = %entry
%cmp2.not = icmp sgt i64 %l, %beg
%cmp3.not = icmp sgt i64 %end, %r
%or.cond25 = or i1 %cmp2.not, %cmp3.not
br i1 %or.cond25, label %if.end5, label %if.then4
if.then4: ; preds = %if.end
%arrayidx = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %i
%0 = load i64, ptr %arrayidx, align 8, !tbaa !8
br label %common.ret26
common.ret26: ; preds = %entry, %if.then4, %if.end5
%common.ret26.op = phi i64 [ %cond.i, %if.end5 ], [ %0, %if.then4 ], [ 0, %entry ]
ret i64 %common.ret26.op
if.end5: ; preds = %if.end
%add = add nsw i64 %end, %beg
%div = sdiv i64 %add, 2
%mul = shl nsw i64 %i, 1
%call = tail call i64 @segf_(i64 noundef %l, i64 noundef %r, i64 noundef %beg, i64 noundef %div, i64 noundef %mul)
%add7 = or i64 %mul, 1
%call8 = tail call i64 @segf_(i64 noundef %l, i64 noundef %r, i64 noundef %div, i64 noundef %end, i64 noundef %add7)
%cond.i = tail call i64 @llvm.smax.i64(i64 %call, i64 %call8)
br label %common.ret26
}
; Function Attrs: nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @segf(i64 noundef %l, i64 noundef %r) local_unnamed_addr #7 {
entry:
%0 = load i64, ptr @base, align 8, !tbaa !8
%call = tail call i64 @segf_(i64 noundef %l, i64 noundef %r, i64 noundef 0, i64 noundef %0, i64 noundef 1)
ret i64 %call
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @segup(i64 noundef %v, i64 noundef %x) local_unnamed_addr #8 {
entry:
%0 = load i64, ptr @base, align 8, !tbaa !8
%add = add nsw i64 %0, %v
%arrayidx = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %add
store i64 %x, ptr %arrayidx, align 8, !tbaa !8
%v.addr.0.off10 = add i64 %add, 1
%tobool.not11 = icmp ult i64 %v.addr.0.off10, 3
br i1 %tobool.not11, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%v.addr.012 = phi i64 [ %div, %while.body ], [ %add, %entry ]
%div = sdiv i64 %v.addr.012, 2
%mul = shl nsw i64 %div, 1
%arrayidx1 = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %mul
%1 = load i64, ptr %arrayidx1, align 16, !tbaa !8
%add3 = or i64 %mul, 1
%arrayidx4 = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %add3
%2 = load i64, ptr %arrayidx4, align 8, !tbaa !8
%cond.i = tail call i64 @llvm.smax.i64(i64 %1, i64 %2)
%arrayidx5 = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %div
store i64 %cond.i, ptr %arrayidx5, align 8, !tbaa !8
%v.addr.0.off = add nsw i64 %div, 1
%tobool.not = icmp ult i64 %v.addr.0.off, 3
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !21
while.end: ; preds = %while.body, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bcnt(i64 noundef %x) local_unnamed_addr #1 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr6 = phi i64 [ %div3, %if.end ], [ %x, %entry ]
%accumulator.tr5 = phi i64 [ %add, %if.end ], [ 0, %entry ]
%div3 = lshr i64 %x.tr6, 1
%rem = and i64 %x.tr6, 1
%add = add i64 %rem, %accumulator.tr5
%tobool.not = icmp ult i64 %x.tr6, 2
br i1 %tobool.not, label %return, label %if.end
return: ; preds = %if.end, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %if.end ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs1(i64 noundef %v, i64 noundef %p) local_unnamed_addr #8 {
entry:
%arrayidx = getelementptr inbounds [1000000 x %struct.hwll], ptr @dp1, i64 0, i64 %v
%b = getelementptr inbounds [1000000 x %struct.hwll], ptr @dp1, i64 0, i64 %v, i32 1
store i64 1, ptr %b, align 8, !tbaa !22
store i64 1, ptr %arrayidx, align 16, !tbaa !24
%arrayidx2 = getelementptr inbounds [1000000 x i64], ptr @gin, i64 0, i64 %v
%0 = load i64, ptr %arrayidx2, align 8, !tbaa !8
%add = add i64 %v, 1
%arrayidx3 = getelementptr inbounds [1000000 x i64], ptr @gin, i64 0, i64 %add
%1 = load i64, ptr %arrayidx3, align 8, !tbaa !8
%cmp15 = icmp ult i64 %0, %1
br i1 %cmp15, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %cleanup, %entry
ret void
for.body: ; preds = %entry, %cleanup
%2 = phi i64 [ %4, %cleanup ], [ %1, %entry ]
%i.016 = phi i64 [ %inc, %cleanup ], [ %0, %entry ]
%b5 = getelementptr inbounds [1000005 x %struct.hwll], ptr @xy, i64 0, i64 %i.016, i32 1
%3 = load i64, ptr %b5, align 8, !tbaa !22
%cmp6 = icmp eq i64 %3, %p
br i1 %cmp6, label %cleanup, label %if.end
if.end: ; preds = %for.body
tail call void @dfs1(i64 noundef %3, i64 noundef %v)
%.pre = load i64, ptr %arrayidx3, align 8, !tbaa !8
br label %cleanup
cleanup: ; preds = %for.body, %if.end
%4 = phi i64 [ %2, %for.body ], [ %.pre, %if.end ]
%inc = add nuw nsw i64 %i.016, 1
%cmp = icmp ult i64 %inc, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !25
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #9 {
entry:
store i64 1, ptr @dp, align 16, !tbaa !8
%0 = load i64, ptr @h, align 8, !tbaa !8
%cmp60.not = icmp eq i64 %0, 0
%.pre89 = load i64, ptr @w, align 8, !tbaa !8
%cmp258.not = icmp eq i64 %.pre89, 0
%or.cond = select i1 %cmp60.not, i1 true, i1 %cmp258.not
br i1 %or.cond, label %for.end26, label %for.cond1.preheader.us.preheader
for.cond1.preheader.us.preheader: ; preds = %entry
%exitcond.peel.not = icmp eq i64 %.pre89, 1
%1 = load i8, ptr @s, align 16
%cmp5.us.us.peel = icmp eq i8 %1, 35
%exitcond85.peel.not = icmp eq i64 %.pre89, 1
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc24_crit_edge.us
%i.061.us = phi i64 [ %inc25.us, %for.cond1.for.inc24_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ]
%tobool.not.us = icmp eq i64 %i.061.us, 0
%sub.us = add nsw i64 %i.061.us, -1
br i1 %tobool.not.us, label %for.body3.us.us.preheader, label %for.body3.us63.preheader
for.body3.us63.preheader: ; preds = %for.cond1.preheader.us
%arrayidx4.us65.peel = getelementptr inbounds [3010 x [3010 x i8]], ptr @s, i64 0, i64 %i.061.us, i64 0
%2 = load i8, ptr %arrayidx4.us65.peel, align 2, !tbaa !12
%cmp5.us66.peel = icmp eq i8 %2, 35
br i1 %cmp5.us66.peel, label %for.inc.us77.peel, label %if.end21.us74.peel
if.end21.us74.peel: ; preds = %for.body3.us63.preheader
%arrayidx9.us.peel = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 %sub.us, i64 0
%3 = load i64, ptr %arrayidx9.us.peel, align 8, !tbaa !8
%arrayidx11.us.peel = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 %i.061.us, i64 0
%4 = load i64, ptr %arrayidx11.us.peel, align 8, !tbaa !8
%add.us.peel = add i64 %4, %3
%rem.us76.peel = urem i64 %add.us.peel, 1000000007
store i64 %rem.us76.peel, ptr %arrayidx11.us.peel, align 8, !tbaa !8
br label %for.inc.us77.peel
for.inc.us77.peel: ; preds = %if.end21.us74.peel, %for.body3.us63.preheader
br i1 %exitcond.peel.not, label %for.cond1.for.inc24_crit_edge.us, label %for.body3.us63
for.body3.us.us.preheader: ; preds = %for.cond1.preheader.us
br i1 %cmp5.us.us.peel, label %for.inc.us.us.peel, label %if.end21.us.us.peel
if.end21.us.us.peel: ; preds = %for.body3.us.us.preheader
%.pre = load i64, ptr @dp, align 16, !tbaa !8
%rem.us.us.peel = urem i64 %.pre, 1000000007
store i64 %rem.us.us.peel, ptr @dp, align 16, !tbaa !8
br label %for.inc.us.us.peel
for.inc.us.us.peel: ; preds = %if.end21.us.us.peel, %for.body3.us.us.preheader
br i1 %exitcond85.peel.not, label %for.cond1.for.inc24_crit_edge.us, label %for.body3.us.us
for.body3.us63: ; preds = %for.inc.us77.peel, %for.inc.us77
%j.059.us64 = phi i64 [ %inc.us78, %for.inc.us77 ], [ 1, %for.inc.us77.peel ]
%arrayidx4.us65 = getelementptr inbounds [3010 x [3010 x i8]], ptr @s, i64 0, i64 %i.061.us, i64 %j.059.us64
%5 = load i8, ptr %arrayidx4.us65, align 1, !tbaa !12
%cmp5.us66 = icmp eq i8 %5, 35
br i1 %cmp5.us66, label %for.inc.us77, label %if.end21.us74
if.end21.us74: ; preds = %for.body3.us63
%arrayidx9.us = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 %sub.us, i64 %j.059.us64
%6 = load i64, ptr %arrayidx9.us, align 8, !tbaa !8
%arrayidx11.us = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 %i.061.us, i64 %j.059.us64
%7 = load i64, ptr %arrayidx11.us, align 8, !tbaa !8
%add.us = add i64 %7, %6
%sub16.us70 = add nsw i64 %j.059.us64, -1
%arrayidx17.us71 = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 %i.061.us, i64 %sub16.us70
%8 = load i64, ptr %arrayidx17.us71, align 8, !tbaa !8
%add20.us73 = add i64 %add.us, %8
%rem.us76 = urem i64 %add20.us73, 1000000007
store i64 %rem.us76, ptr %arrayidx11.us, align 8, !tbaa !8
br label %for.inc.us77
for.inc.us77: ; preds = %if.end21.us74, %for.body3.us63
%inc.us78 = add nuw nsw i64 %j.059.us64, 1
%exitcond.not = icmp eq i64 %inc.us78, %.pre89
br i1 %exitcond.not, label %for.cond1.for.inc24_crit_edge.us, label %for.body3.us63, !llvm.loop !26
for.cond1.for.inc24_crit_edge.us: ; preds = %for.inc.us77, %for.inc.us.us, %for.inc.us77.peel, %for.inc.us.us.peel
%inc25.us = add nuw i64 %i.061.us, 1
%exitcond87.not = icmp eq i64 %inc25.us, %0
br i1 %exitcond87.not, label %for.end26, label %for.cond1.preheader.us, !llvm.loop !28
for.body3.us.us: ; preds = %for.inc.us.us.peel, %for.inc.us.us
%j.059.us.us = phi i64 [ %inc.us.us, %for.inc.us.us ], [ 1, %for.inc.us.us.peel ]
%arrayidx4.us.us = getelementptr inbounds [3010 x [3010 x i8]], ptr @s, i64 0, i64 0, i64 %j.059.us.us
%9 = load i8, ptr %arrayidx4.us.us, align 1, !tbaa !12
%cmp5.us.us = icmp eq i8 %9, 35
br i1 %cmp5.us.us, label %for.inc.us.us, label %if.end21.us.us
if.end21.us.us: ; preds = %for.body3.us.us
%sub16.us.us = add nsw i64 %j.059.us.us, -1
%arrayidx17.us.us = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 0, i64 %sub16.us.us
%10 = load i64, ptr %arrayidx17.us.us, align 8, !tbaa !8
%arrayidx19.us.us = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 0, i64 %j.059.us.us
%11 = load i64, ptr %arrayidx19.us.us, align 8, !tbaa !8
%add20.us.us = add i64 %11, %10
%arrayidx23.us.us = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 0, i64 %j.059.us.us
%rem.us.us = urem i64 %add20.us.us, 1000000007
store i64 %rem.us.us, ptr %arrayidx23.us.us, align 8, !tbaa !8
br label %for.inc.us.us
for.inc.us.us: ; preds = %if.end21.us.us, %for.body3.us.us
%inc.us.us = add nuw nsw i64 %j.059.us.us, 1
%exitcond85.not = icmp eq i64 %inc.us.us, %.pre89
br i1 %exitcond85.not, label %for.cond1.for.inc24_crit_edge.us, label %for.body3.us.us, !llvm.loop !29
for.end26: ; preds = %for.cond1.for.inc24_crit_edge.us, %entry
%sub27 = add i64 %0, -1
%sub29 = add i64 %.pre89, -1
%arrayidx30 = getelementptr inbounds [3005 x [3005 x i64]], ptr @dp, i64 0, i64 %sub27, i64 %sub29
%12 = load i64, ptr %arrayidx30, align 8, !tbaa !8
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %12)
ret i64 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #9 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @h, ptr noundef nonnull @w)
%0 = load i64, ptr @h, align 8, !tbaa !8
%cmp6.not = icmp eq i64 %0, 0
br i1 %cmp6.not, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [3010 x [3010 x i8]], ptr @s, i64 0, i64 %indvars.iv
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%1 = load i64, ptr @h, align 8, !tbaa !8
%cmp = icmp ugt i64 %1, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !30
for.end: ; preds = %for.body, %entry
%call3 = tail call i64 @solve()
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #11
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #12 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!10, !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !10, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !10, i64 0}
!17 = !{i64 0, i64 8, !8, i64 8, i64 8, !8}
!18 = !{i64 0, i64 8, !8}
!19 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8}
!20 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8, i64 24, i64 8, !8}
!21 = distinct !{!21, !6}
!22 = !{!23, !9, i64 8}
!23 = !{!"", !9, i64 0, !9, i64 8}
!24 = !{!23, !9, i64 0}
!25 = distinct !{!25, !6}
!26 = distinct !{!26, !6, !27}
!27 = !{!"llvm.loop.peeled.count", i32 1}
!28 = distinct !{!28, !6}
!29 = distinct !{!29, !6, !27}
!30 = distinct !{!30, !6}
|
#include<stdio.h>
#include<stdlib.h>
int cmp(const void *a,const void *b)
{
return *(int*)b-*(int*)a;
}
int main()
{
int n,k;
scanf("%d%d",&n,&k);
int l[n];
int i;
int ans=0;
for(i=0;i<n;i++)
{
scanf("%d",&l[i]);
}
qsort(l,n,sizeof(int),cmp);
for(i=0;i<k;i++)
{
ans+=l[i];
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164011/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164011/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = 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
%cmp18 = icmp sgt i32 %3, 0
br i1 %cmp18, 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.1, 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 @cmp) #7
%6 = load i32, ptr %k, align 4, !tbaa !5
%cmp320 = icmp sgt i32 %6, 0
br i1 %cmp320, label %for.body5.preheader, label %for.end10
for.body5.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %6 to i64
%min.iters.check = icmp ult i32 %6, 8
br i1 %min.iters.check, label %for.body5.preheader31, label %vector.ph
vector.ph: ; preds = %for.body5.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%vec.phi29 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%7 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load30 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = add <4 x i32> %wide.load, %vec.phi
%10 = add <4 x i32> %wide.load30, %vec.phi29
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %10, %9
%12 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end10, label %for.body5.preheader31
for.body5.preheader31: ; preds = %for.body5.preheader, %middle.block
%indvars.iv26.ph = phi i64 [ 0, %for.body5.preheader ], [ %n.vec, %middle.block ]
%ans.022.ph = phi i32 [ 0, %for.body5.preheader ], [ %12, %middle.block ]
br label %for.body5
for.body5: ; preds = %for.body5.preheader31, %for.body5
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.body5 ], [ %indvars.iv26.ph, %for.body5.preheader31 ]
%ans.022 = phi i32 [ %add, %for.body5 ], [ %ans.022.ph, %for.body5.preheader31 ]
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv26
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %13, %ans.022
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%exitcond.not = icmp eq i64 %indvars.iv.next27, %wide.trip.count
br i1 %exitcond.not, label %for.end10, label %for.body5, !llvm.loop !14
for.end10: ; preds = %for.body5, %middle.block, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ %12, %middle.block ], [ %add, %for.body5 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include <stdio.h>
#include <math.h>
#include <string.h>
#define pai 3.1415926535
int main(void) {
int N, K;
scanf("%d%d", &N, &K);
int l[50];
int a;
int count = 0;
int sum = 0;
for (int i = 0; i < N; i++) {
scanf("%d", &l[i]);
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N - 1 - i; j++) {
if (l[j] > l[j + 1]) {
a = l[j];
l[j] = l[j + 1];
l[j + 1] = a;
}
}
}
for (int i = N - 1; count < K; i--) {
sum += l[i];
count++;
}
printf("%d", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164055/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164055/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%l = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %l) #4
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp62 = icmp sgt i32 %0, 0
br i1 %cmp62, label %for.body, label %for.cond35.preheader
for.cond3.preheader: ; preds = %for.body
%cmp466 = icmp sgt i32 %1, 0
br i1 %cmp466, label %for.cond7.preheader, label %for.cond35.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %l, 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.cond3.preheader, !llvm.loop !9
for.cond7.preheader: ; preds = %for.cond3.preheader, %for.cond.cleanup10
%i2.067 = phi i32 [ %inc31, %for.cond.cleanup10 ], [ 0, %for.cond3.preheader ]
%3 = xor i32 %i2.067, -1
%4 = add i32 %1, %3
%5 = zext i32 %4 to i64
%6 = xor i32 %i2.067, -1
%sub8 = add i32 %1, %6
%cmp964 = icmp sgt i32 %sub8, 0
br i1 %cmp964, label %for.body11.preheader, label %for.cond.cleanup10
for.body11.preheader: ; preds = %for.cond7.preheader
%.pre = load i32, ptr %l, align 16, !tbaa !5
%xtraiter = and i64 %5, 1
%7 = icmp eq i32 %4, 1
br i1 %7, label %for.cond.cleanup10.loopexit.unr-lcssa, label %for.body11.preheader.new
for.body11.preheader.new: ; preds = %for.body11.preheader
%unroll_iter = and i64 %5, 4294967294
br label %for.body11
for.cond35.preheader: ; preds = %for.cond.cleanup10, %entry, %for.cond3.preheader
%.lcssa87 = phi i32 [ %1, %for.cond3.preheader ], [ %0, %entry ], [ %1, %for.cond.cleanup10 ]
%8 = load i32, ptr %K, align 4, !tbaa !5
%cmp3668 = icmp sgt i32 %8, 0
br i1 %cmp3668, label %for.body38.preheader, label %for.cond.cleanup37
for.body38.preheader: ; preds = %for.cond35.preheader
%9 = sext i32 %.lcssa87 to i64
%10 = zext i32 %8 to i64
%min.iters.check = icmp ult i32 %8, 8
br i1 %min.iters.check, label %for.body38.preheader93, label %vector.ph
vector.ph: ; preds = %for.body38.preheader
%n.vec = and i64 %10, 4294967288
%ind.end = sub nsw i64 %9, %n.vec
%ind.end88 = trunc i64 %n.vec to i32
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%vec.phi90 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%11 = xor i64 %index, -1
%12 = add i64 %11, %9
%13 = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %12
%14 = getelementptr inbounds i32, ptr %13, i64 -3
%wide.load = load <4 x i32>, ptr %14, align 4, !tbaa !5
%reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%15 = getelementptr inbounds i32, ptr %13, i64 -7
%wide.load91 = load <4 x i32>, ptr %15, align 4, !tbaa !5
%reverse92 = shufflevector <4 x i32> %wide.load91, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%16 = add <4 x i32> %reverse, %vec.phi
%17 = add <4 x i32> %reverse92, %vec.phi90
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %10
br i1 %cmp.n, label %for.cond.cleanup37, label %for.body38.preheader93
for.body38.preheader93: ; preds = %for.body38.preheader, %middle.block
%indvars.iv81.ph = phi i64 [ %9, %for.body38.preheader ], [ %ind.end, %middle.block ]
%sum.070.ph = phi i32 [ 0, %for.body38.preheader ], [ %19, %middle.block ]
%count.069.ph = phi i32 [ 0, %for.body38.preheader ], [ %ind.end88, %middle.block ]
br label %for.body38
for.cond.cleanup10.loopexit.unr-lcssa: ; preds = %for.inc27.1, %for.body11.preheader
%.unr = phi i32 [ %.pre, %for.body11.preheader ], [ %25, %for.inc27.1 ]
%indvars.iv75.unr = phi i64 [ 0, %for.body11.preheader ], [ %indvars.iv.next76.1, %for.inc27.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup10, label %for.body11.epil
for.body11.epil: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa
%indvars.iv.next76.epil = add nuw nsw i64 %indvars.iv75.unr, 1
%arrayidx15.epil = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %indvars.iv.next76.epil
%20 = load i32, ptr %arrayidx15.epil, align 4, !tbaa !5
%cmp16.epil = icmp sgt i32 %.unr, %20
br i1 %cmp16.epil, label %if.then.epil, label %for.cond.cleanup10
if.then.epil: ; preds = %for.body11.epil
%arrayidx13.epil = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %indvars.iv75.unr
store i32 %20, ptr %arrayidx13.epil, align 4, !tbaa !5
store i32 %.unr, ptr %arrayidx15.epil, align 4, !tbaa !5
br label %for.cond.cleanup10
for.cond.cleanup10: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa, %if.then.epil, %for.body11.epil, %for.cond7.preheader
%inc31 = add nuw nsw i32 %i2.067, 1
%exitcond80.not = icmp eq i32 %inc31, %1
br i1 %exitcond80.not, label %for.cond35.preheader, label %for.cond7.preheader, !llvm.loop !14
for.body11: ; preds = %for.inc27.1, %for.body11.preheader.new
%21 = phi i32 [ %.pre, %for.body11.preheader.new ], [ %25, %for.inc27.1 ]
%indvars.iv75 = phi i64 [ 0, %for.body11.preheader.new ], [ %indvars.iv.next76.1, %for.inc27.1 ]
%niter = phi i64 [ 0, %for.body11.preheader.new ], [ %niter.next.1, %for.inc27.1 ]
%indvars.iv.next76 = or i64 %indvars.iv75, 1
%arrayidx15 = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %indvars.iv.next76
%22 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %21, %22
br i1 %cmp16, label %if.then, label %for.inc27
if.then: ; preds = %for.body11
%arrayidx13 = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %indvars.iv75
store i32 %22, ptr %arrayidx13, align 8, !tbaa !5
store i32 %21, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc27
for.inc27: ; preds = %for.body11, %if.then
%23 = phi i32 [ %22, %for.body11 ], [ %21, %if.then ]
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%arrayidx15.1 = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %indvars.iv.next76.1
%24 = load i32, ptr %arrayidx15.1, align 8, !tbaa !5
%cmp16.1 = icmp sgt i32 %23, %24
br i1 %cmp16.1, label %if.then.1, label %for.inc27.1
if.then.1: ; preds = %for.inc27
%arrayidx13.1 = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %indvars.iv.next76
store i32 %24, ptr %arrayidx13.1, align 4, !tbaa !5
store i32 %23, ptr %arrayidx15.1, align 8, !tbaa !5
br label %for.inc27.1
for.inc27.1: ; preds = %if.then.1, %for.inc27
%25 = phi i32 [ %24, %for.inc27 ], [ %23, %if.then.1 ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup10.loopexit.unr-lcssa, label %for.body11, !llvm.loop !15
for.cond.cleanup37: ; preds = %for.body38, %middle.block, %for.cond35.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond35.preheader ], [ %19, %middle.block ], [ %add41, %for.body38 ]
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body38: ; preds = %for.body38.preheader93, %for.body38
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body38 ], [ %indvars.iv81.ph, %for.body38.preheader93 ]
%sum.070 = phi i32 [ %add41, %for.body38 ], [ %sum.070.ph, %for.body38.preheader93 ]
%count.069 = phi i32 [ %inc42, %for.body38 ], [ %count.069.ph, %for.body38.preheader93 ]
%indvars.iv.next82 = add nsw i64 %indvars.iv81, -1
%arrayidx40 = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %indvars.iv.next82
%26 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%add41 = add nsw i32 %26, %sum.070
%inc42 = add nuw nsw i32 %count.069, 1
%exitcond84.not = icmp eq i32 %inc42, %8
br i1 %exitcond84.not, label %for.cond.cleanup37, label %for.body38, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !13, !12}
|
#include<stdio.h>
#include<stdlib.h>
#define SENTINEL 1000000000
int count = 0;
void merge(long long int A[], int left, int mid, int right);
void mergeSort(long long int A[], int left, int right) {
int i, mid;
if (left + 1 < right) {
mid = (left + right) / 2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
void merge(long long int A[], int left, int mid, int right) {
int n1, n2, i, j, k;
long long int *L, *R;
n1 = mid - left;
n2 = right - mid;
L = (long long int *)malloc(sizeof(long long int)*(n1 + 1));
R = (long long int *)malloc(sizeof(long long int)*(n2 + 1));
for (i = 0; i <= n1 - 1; i++) {
L[i] = A[left + i];
}
for (j = 0; j <= n2 - 1; j++) {
R[j] = A[mid + j];
}
L[n1] = SENTINEL;
R[n2] = SENTINEL;
i = 0;
j = 0;
for (k = left; k <= right - 1; k++) {
if (L[i] <= R[j]) {
A[k] = L[i];
i++;
count++;
}
else {
A[k] = R[j];
j++;
count++;
}
}
free(L);
free(R);
}
int main() {
long long int a, b, c, d, n, m, num[2000]= {}, result = 0;
char str[200005];
scanf("%lld%lld", &n,&m);
for (int i = 0; i < n; i++) {
scanf("%lld", &num[i]);
}
mergeSort(num, 0, n);
for (int i = n-1; i >=n-m; i--) {
result += num[i];
}
printf("%lld", result);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164099/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164099/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #8
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 3
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #8
%cmp.not.not90 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not90, label %for.body.preheader, label %for.cond11.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 3
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 3
%6 = add nuw nsw i64 %5, 8
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %call, ptr noundef nonnull align 8 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body.preheader, %entry
%cmp13.not.not92 = icmp sgt i32 %sub1, 0
br i1 %cmp13.not.not92, label %for.body15.preheader, label %for.end23
for.body15.preheader: ; preds = %for.cond11.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 3
%scevgep102 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 3
%13 = add nuw nsw i64 %12, 8
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %call5, ptr noundef nonnull align 8 dereferenceable(1) %scevgep102, i64 %13, i1 false), !tbaa !5
br label %for.end23
for.end23: ; preds = %for.body15.preheader, %for.cond11.preheader
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds i64, ptr %call, i64 %idxprom24
store i64 1000000000, ptr %arrayidx25, align 8, !tbaa !5
%idxprom26 = sext i32 %sub1 to i64
%arrayidx27 = getelementptr inbounds i64, ptr %call5, i64 %idxprom26
store i64 1000000000, ptr %arrayidx27, align 8, !tbaa !5
%cmp30.not.not95 = icmp slt i32 %left, %right
br i1 %cmp30.not.not95, label %for.body32.preheader, label %for.end53
for.body32.preheader: ; preds = %for.end23
%count.promoted = load i32, ptr @count, align 4, !tbaa !9
%14 = sext i32 %left to i64
%15 = add i32 %count.promoted, %right
%wide.trip.count = sext i32 %right to i64
%16 = sub nsw i64 %wide.trip.count, %14
%xtraiter = and i64 %16, 1
%17 = sub nsw i64 0, %wide.trip.count
%18 = xor i64 %14, %17
%19 = icmp eq i64 %18, -1
br i1 %19, label %for.cond28.for.end53_crit_edge.unr-lcssa, label %for.body32.preheader.new
for.body32.preheader.new: ; preds = %for.body32.preheader
%unroll_iter = and i64 %16, -2
%invariant.gep = getelementptr i64, ptr %A, i64 1
br label %for.body32
for.body32: ; preds = %for.body32, %for.body32.preheader.new
%indvars.iv = phi i64 [ %14, %for.body32.preheader.new ], [ %indvars.iv.next.1, %for.body32 ]
%i.199 = phi i32 [ 0, %for.body32.preheader.new ], [ %i.2.1, %for.body32 ]
%j.198 = phi i32 [ 0, %for.body32.preheader.new ], [ %j.2.1, %for.body32 ]
%niter = phi i64 [ 0, %for.body32.preheader.new ], [ %niter.next.1, %for.body32 ]
%idxprom33 = zext i32 %i.199 to i64
%arrayidx34 = getelementptr inbounds i64, ptr %call, i64 %idxprom33
%20 = load i64, ptr %arrayidx34, align 8, !tbaa !5
%idxprom35 = zext i32 %j.198 to i64
%arrayidx36 = getelementptr inbounds i64, ptr %call5, i64 %idxprom35
%21 = load i64, ptr %arrayidx36, align 8, !tbaa !5
%cmp37.not = icmp sgt i64 %20, %21
%.sink = tail call i64 @llvm.smin.i64(i64 %20, i64 %21)
%inc49 = zext i1 %cmp37.not to i32
%j.2 = add nuw nsw i32 %j.198, %inc49
%not.cmp37.not = xor i1 %cmp37.not, true
%inc43 = zext i1 %not.cmp37.not to i32
%i.2 = add nuw nsw i32 %i.199, %inc43
%22 = getelementptr inbounds i64, ptr %A, i64 %indvars.iv
store i64 %.sink, ptr %22, align 8
%idxprom33.1 = zext i32 %i.2 to i64
%arrayidx34.1 = getelementptr inbounds i64, ptr %call, i64 %idxprom33.1
%23 = load i64, ptr %arrayidx34.1, align 8, !tbaa !5
%idxprom35.1 = zext i32 %j.2 to i64
%arrayidx36.1 = getelementptr inbounds i64, ptr %call5, i64 %idxprom35.1
%24 = load i64, ptr %arrayidx36.1, align 8, !tbaa !5
%cmp37.not.1 = icmp sgt i64 %23, %24
%.sink.1 = tail call i64 @llvm.smin.i64(i64 %23, i64 %24)
%inc49.1 = zext i1 %cmp37.not.1 to i32
%j.2.1 = add nuw nsw i32 %j.2, %inc49.1
%not.cmp37.not.1 = xor i1 %cmp37.not.1, true
%inc43.1 = zext i1 %not.cmp37.not.1 to i32
%i.2.1 = add nuw nsw i32 %i.2, %inc43.1
%gep = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv
store i64 %.sink.1, ptr %gep, align 8
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond28.for.end53_crit_edge.unr-lcssa.loopexit, label %for.body32, !llvm.loop !11
for.cond28.for.end53_crit_edge.unr-lcssa.loopexit: ; preds = %for.body32
%25 = zext i32 %i.2.1 to i64
%26 = zext i32 %j.2.1 to i64
br label %for.cond28.for.end53_crit_edge.unr-lcssa
for.cond28.for.end53_crit_edge.unr-lcssa: ; preds = %for.cond28.for.end53_crit_edge.unr-lcssa.loopexit, %for.body32.preheader
%indvars.iv.unr = phi i64 [ %14, %for.body32.preheader ], [ %indvars.iv.next.1, %for.cond28.for.end53_crit_edge.unr-lcssa.loopexit ]
%i.199.unr = phi i64 [ 0, %for.body32.preheader ], [ %25, %for.cond28.for.end53_crit_edge.unr-lcssa.loopexit ]
%j.198.unr = phi i64 [ 0, %for.body32.preheader ], [ %26, %for.cond28.for.end53_crit_edge.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond28.for.end53_crit_edge, label %for.body32.epil
for.body32.epil: ; preds = %for.cond28.for.end53_crit_edge.unr-lcssa
%arrayidx34.epil = getelementptr inbounds i64, ptr %call, i64 %i.199.unr
%27 = load i64, ptr %arrayidx34.epil, align 8, !tbaa !5
%arrayidx36.epil = getelementptr inbounds i64, ptr %call5, i64 %j.198.unr
%28 = load i64, ptr %arrayidx36.epil, align 8, !tbaa !5
%.sink.epil = tail call i64 @llvm.smin.i64(i64 %27, i64 %28)
%29 = getelementptr inbounds i64, ptr %A, i64 %indvars.iv.unr
store i64 %.sink.epil, ptr %29, align 8
br label %for.cond28.for.end53_crit_edge
for.cond28.for.end53_crit_edge: ; preds = %for.cond28.for.end53_crit_edge.unr-lcssa, %for.body32.epil
%30 = sub i32 %15, %left
store i32 %30, ptr @count, align 4, !tbaa !9
br label %for.end53
for.end53: ; preds = %for.cond28.for.end53_crit_edge, %for.end23
tail call void @free(ptr noundef nonnull %call) #9
tail call void @free(ptr noundef nonnull %call5) #9
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
%num = alloca [2000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #9
call void @llvm.lifetime.start.p0(i64 16000, ptr nonnull %num) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16000) %num, i8 0, i64 16000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp23 = icmp sgt i64 %0, 0
br i1 %cmp23, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %0, %entry ], [ %30, %for.body ]
%conv3 = trunc i64 %.lcssa to i32
call void @mergeSort(ptr noundef nonnull %num, i32 noundef 0, i32 noundef %conv3)
%1 = load i64, ptr %n, align 8, !tbaa !5
%2 = trunc i64 %1 to i32
%3 = load i64, ptr %m, align 8, !tbaa !5
%sub8 = sub nsw i64 %1, %3
%i4.026 = add i32 %2, -1
%conv727 = sext i32 %i4.026 to i64
%cmp9.not28 = icmp sgt i64 %sub8, %conv727
br i1 %cmp9.not28, label %for.cond.cleanup11, label %for.body12.preheader
for.body12.preheader: ; preds = %for.cond.cleanup
%4 = shl i64 %1, 32
%sext = add i64 %4, -8589934592
%5 = ashr exact i64 %sext, 32
%6 = add nsw i64 %5, 2
%7 = add nsw i64 %5, 1
%smin40 = call i64 @llvm.smin.i64(i64 %sub8, i64 %7)
%8 = sub i64 %6, %smin40
%min.iters.check = icmp ult i64 %8, 42
br i1 %min.iters.check, label %for.body12.preheader46, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body12.preheader
%9 = add i32 %2, -2
%10 = sext i32 %9 to i64
%11 = add nsw i64 %10, 1
%12 = add nsw i64 %10, 1
%smin = call i64 @llvm.smin.i64(i64 %sub8, i64 %12)
%13 = sub i64 %11, %smin
%14 = trunc i64 %13 to i32
%15 = sub i32 %i4.026, %14
%16 = icmp sgt i32 %15, %i4.026
%17 = trunc i64 %13 to i32
%18 = sub i32 %9, %17
%19 = icmp sgt i32 %18, %9
%20 = icmp ugt i64 %13, 4294967295
%21 = or i1 %19, %20
%22 = or i1 %16, %21
br i1 %22, label %for.body12.preheader46, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %8, -4
%ind.end = sub i64 %conv727, %n.vec
%.cast = trunc i64 %n.vec to i32
%ind.end41 = sub i32 %i4.026, %.cast
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %26, %vector.body ]
%vec.phi43 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %27, %vector.body ]
%offset.idx = sub i64 %conv727, %index
%23 = getelementptr inbounds [2000 x i64], ptr %num, i64 0, i64 %offset.idx
%24 = getelementptr inbounds i64, ptr %23, i64 -1
%wide.load = load <2 x i64>, ptr %24, align 8, !tbaa !5
%reverse = shufflevector <2 x i64> %wide.load, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
%25 = getelementptr inbounds i64, ptr %23, i64 -3
%wide.load44 = load <2 x i64>, ptr %25, align 8, !tbaa !5
%reverse45 = shufflevector <2 x i64> %wide.load44, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
%26 = add <2 x i64> %reverse, %vec.phi
%27 = add <2 x i64> %reverse45, %vec.phi43
%index.next = add nuw i64 %index, 4
%28 = icmp eq i64 %index.next, %n.vec
br i1 %28, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %27, %26
%29 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %8, %n.vec
br i1 %cmp.n, label %for.cond.cleanup11, label %for.body12.preheader46
for.body12.preheader46: ; preds = %vector.scevcheck, %for.body12.preheader, %middle.block
%conv731.ph = phi i64 [ %conv727, %vector.scevcheck ], [ %conv727, %for.body12.preheader ], [ %ind.end, %middle.block ]
%i4.030.ph = phi i32 [ %i4.026, %vector.scevcheck ], [ %i4.026, %for.body12.preheader ], [ %ind.end41, %middle.block ]
%result.029.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %for.body12.preheader ], [ %29, %middle.block ]
br label %for.body12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [2000 x i64], ptr %num, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%30 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %30, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !16
for.cond.cleanup11: ; preds = %for.body12, %middle.block, %for.cond.cleanup
%result.0.lcssa = phi i64 [ 0, %for.cond.cleanup ], [ %29, %middle.block ], [ %add, %for.body12 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 16000, ptr nonnull %num) #9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #9
ret i32 0
for.body12: ; preds = %for.body12.preheader46, %for.body12
%conv731 = phi i64 [ %conv7, %for.body12 ], [ %conv731.ph, %for.body12.preheader46 ]
%i4.030 = phi i32 [ %i4.0, %for.body12 ], [ %i4.030.ph, %for.body12.preheader46 ]
%result.029 = phi i64 [ %add, %for.body12 ], [ %result.029.ph, %for.body12.preheader46 ]
%arrayidx14 = getelementptr inbounds [2000 x i64], ptr %num, i64 0, i64 %conv731
%31 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%add = add nsw i64 %31, %result.029
%i4.0 = add i32 %i4.030, -1
%conv7 = sext i32 %i4.0 to i64
%cmp9.not = icmp sgt i64 %sub8, %conv7
br i1 %cmp9.not, label %for.cond.cleanup11, label %for.body12, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !14}
|
#include <stdio.h>
#include <stdlib.h>
int comp(const void *a, const void *b){ return *(int *)a - *(int *)b; }
void swap(int *x, int *y)
{
int tmp = *x;
*x = *y;
*y = tmp;
}
void reverse_array(int array[], int size)
{
int i=0;
while (i < size/2){
swap(&array[i], &array[size-i-1]);
i++;
}
}
int main()
{
int n, k, i, l[50], ans=0;
scanf("%d %d", &n, &k);
for (i=0; i<n; i++) scanf("%d", &l[i]);
qsort(l, n, sizeof(int), comp);
reverse_array(l, n);
for (i=0; i<k; i++) ans += l[i];
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164149/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164149/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
ret void
}
; 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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @reverse_array(ptr nocapture noundef %array, i32 noundef %size) local_unnamed_addr #3 {
entry:
%cmp9 = icmp sgt i32 %size, 1
br i1 %cmp9, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
%div1213 = lshr i32 %size, 1
%wide.trip.count = zext i32 %div1213 to i64
%xtraiter = and i64 %wide.trip.count, 1
%0 = icmp eq i32 %div1213, 1
br i1 %0, label %while.end.loopexit.unr-lcssa, label %while.body.preheader.new
while.body.preheader.new: ; preds = %while.body.preheader
%unroll_iter = and i64 %wide.trip.count, 2147483646
br label %while.body
while.body: ; preds = %while.body, %while.body.preheader.new
%indvars.iv = phi i64 [ 0, %while.body.preheader.new ], [ %indvars.iv.next.1, %while.body ]
%niter = phi i64 [ 0, %while.body.preheader.new ], [ %niter.next.1, %while.body ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%1 = trunc i64 %indvars.iv to i32
%2 = xor i32 %1, -1
%sub1 = add i32 %2, %size
%idxprom2 = sext i32 %sub1 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %array, i64 %idxprom2
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx3, align 4, !tbaa !5
store i32 %4, ptr %arrayidx, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.next
%5 = trunc i64 %indvars.iv.next to i32
%6 = xor i32 %5, -1
%sub1.1 = add i32 %6, %size
%idxprom2.1 = sext i32 %sub1.1 to i64
%arrayidx3.1 = getelementptr inbounds i32, ptr %array, i64 %idxprom2.1
%7 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%8 = load i32, ptr %arrayidx3.1, align 4, !tbaa !5
store i32 %8, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %7, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %while.end.loopexit.unr-lcssa, label %while.body, !llvm.loop !9
while.end.loopexit.unr-lcssa: ; preds = %while.body, %while.body.preheader
%indvars.iv.unr = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next.1, %while.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.end, label %while.body.epil
while.body.epil: ; preds = %while.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.unr
%9 = trunc i64 %indvars.iv.unr to i32
%10 = xor i32 %9, -1
%sub1.epil = add i32 %10, %size
%idxprom2.epil = sext i32 %sub1.epil to i64
%arrayidx3.epil = getelementptr inbounds i32, ptr %array, i64 %idxprom2.epil
%11 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%12 = load i32, ptr %arrayidx3.epil, align 4, !tbaa !5
store i32 %12, ptr %arrayidx.epil, align 4, !tbaa !5
store i32 %11, ptr %arrayidx3.epil, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.body.epil, %while.end.loopexit.unr-lcssa, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%l = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %l) #8
%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
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, 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 [50 x i32], ptr %l, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %l, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @comp) #8
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp9.i = icmp sgt i32 %3, 1
br i1 %cmp9.i, label %while.body.preheader.i, label %reverse_array.exit
while.body.preheader.i: ; preds = %for.end
%div1213.i = lshr i32 %3, 1
%wide.trip.count.i = zext i32 %div1213.i to i64
%xtraiter = and i64 %wide.trip.count.i, 1
%4 = icmp eq i32 %div1213.i, 1
br i1 %4, label %reverse_array.exit.loopexit.unr-lcssa, label %while.body.preheader.i.new
while.body.preheader.i.new: ; preds = %while.body.preheader.i
%unroll_iter = and i64 %wide.trip.count.i, 2147483646
br label %while.body.i
while.body.i: ; preds = %while.body.i, %while.body.preheader.i.new
%indvars.iv.i = phi i64 [ 0, %while.body.preheader.i.new ], [ %indvars.iv.next.i.1, %while.body.i ]
%niter = phi i64 [ 0, %while.body.preheader.i.new ], [ %niter.next.1, %while.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %l, i64 %indvars.iv.i
%5 = trunc i64 %indvars.iv.i to i32
%6 = xor i32 %5, -1
%sub1.i = add i32 %3, %6
%idxprom2.i = sext i32 %sub1.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %l, i64 %idxprom2.i
%7 = load i32, ptr %arrayidx.i, align 8, !tbaa !5
%8 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
store i32 %8, ptr %arrayidx.i, align 8, !tbaa !5
store i32 %7, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i32, ptr %l, i64 %indvars.iv.next.i
%9 = trunc i64 %indvars.iv.next.i to i32
%10 = xor i32 %9, -1
%sub1.i.1 = add i32 %3, %10
%idxprom2.i.1 = sext i32 %sub1.i.1 to i64
%arrayidx3.i.1 = getelementptr inbounds i32, ptr %l, i64 %idxprom2.i.1
%11 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5
%12 = load i32, ptr %arrayidx3.i.1, align 4, !tbaa !5
store i32 %12, ptr %arrayidx.i.1, align 4, !tbaa !5
store i32 %11, ptr %arrayidx3.i.1, align 4, !tbaa !5
%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 %reverse_array.exit.loopexit.unr-lcssa, label %while.body.i, !llvm.loop !9
reverse_array.exit.loopexit.unr-lcssa: ; preds = %while.body.i, %while.body.preheader.i
%indvars.iv.i.unr = phi i64 [ 0, %while.body.preheader.i ], [ %indvars.iv.next.i.1, %while.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %reverse_array.exit, label %while.body.i.epil
while.body.i.epil: ; preds = %reverse_array.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i32, ptr %l, i64 %indvars.iv.i.unr
%13 = trunc i64 %indvars.iv.i.unr to i32
%14 = xor i32 %13, -1
%sub1.i.epil = add i32 %3, %14
%idxprom2.i.epil = sext i32 %sub1.i.epil to i64
%arrayidx3.i.epil = getelementptr inbounds i32, ptr %l, i64 %idxprom2.i.epil
%15 = load i32, ptr %arrayidx.i.epil, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx3.i.epil, align 4, !tbaa !5
store i32 %16, ptr %arrayidx.i.epil, align 4, !tbaa !5
store i32 %15, ptr %arrayidx3.i.epil, align 4, !tbaa !5
br label %reverse_array.exit
reverse_array.exit: ; preds = %while.body.i.epil, %reverse_array.exit.loopexit.unr-lcssa, %for.end
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp421 = icmp sgt i32 %17, 0
br i1 %cmp421, label %for.body6.preheader, label %for.end11
for.body6.preheader: ; preds = %reverse_array.exit
%wide.trip.count = zext i32 %17 to i64
%min.iters.check = icmp ult i32 %17, 8
br i1 %min.iters.check, label %for.body6.preheader32, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
%vec.phi30 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
%18 = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds i32, ptr %18, i64 4
%wide.load31 = load <4 x i32>, ptr %19, align 16, !tbaa !5
%20 = add <4 x i32> %wide.load, %vec.phi
%21 = add <4 x i32> %wide.load31, %vec.phi30
%index.next = add nuw i64 %index, 8
%22 = icmp eq i64 %index.next, %n.vec
br i1 %22, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %21, %20
%23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end11, label %for.body6.preheader32
for.body6.preheader32: ; preds = %for.body6.preheader, %middle.block
%indvars.iv27.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
%ans.023.ph = phi i32 [ 0, %for.body6.preheader ], [ %23, %middle.block ]
br label %for.body6
for.body6: ; preds = %for.body6.preheader32, %for.body6
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body6 ], [ %indvars.iv27.ph, %for.body6.preheader32 ]
%ans.023 = phi i32 [ %add, %for.body6 ], [ %ans.023.ph, %for.body6.preheader32 ]
%arrayidx8 = getelementptr inbounds [50 x i32], ptr %l, i64 0, i64 %indvars.iv27
%24 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%add = add nsw i32 %24, %ans.023
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%exitcond.not = icmp eq i64 %indvars.iv.next28, %wide.trip.count
br i1 %exitcond.not, label %for.end11, label %for.body6, !llvm.loop !15
for.end11: ; preds = %for.body6, %middle.block, %reverse_array.exit
%ans.0.lcssa = phi i32 [ 0, %reverse_array.exit ], [ %23, %middle.block ], [ %add, %for.body6 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %l) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include<stdio.h>
int main(){
int K,N,i,j,x,y,z;
int a[51];
scanf("%d %d",&N,&K);
for(i=0;i<N;i++){
scanf("%d",&a[i]);
}
z=0;
for(i=0;i<K;i++){
x=0;
y=0;
for(j=0;j<N;j++){
if(x<a[j]){
x=a[j];
y=j;
}
}
z+=x;
a[y]=0;
}
printf("%d\n",z);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164192/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164192/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%K = alloca i32, align 4
%N = alloca i32, align 4
%a = alloca [51 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %13, %for.body ]
%1 = load i32, ptr %K, align 4, !tbaa !5
%cmp341 = icmp sgt i32 %1, 0
br i1 %cmp341, label %for.cond5.preheader.lr.ph, label %for.end20
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%cmp635 = icmp sgt i32 %.lcssa, 0
br i1 %cmp635, label %for.cond5.preheader.us.preheader, label %for.cond5.preheader.lr.ph.split
for.cond5.preheader.us.preheader: ; preds = %for.cond5.preheader.lr.ph
%wide.trip.count = zext i32 %.lcssa to i64
%xtraiter = and i64 %wide.trip.count, 3
%2 = icmp ult i32 %.lcssa, 4
%unroll_iter = and i64 %wide.trip.count, 4294967292
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.cond5.for.end15_crit_edge.us
%z.043.us = phi i32 [ %add.us, %for.cond5.for.end15_crit_edge.us ], [ 0, %for.cond5.preheader.us.preheader ]
%i.142.us = phi i32 [ %inc19.us, %for.cond5.for.end15_crit_edge.us ], [ 0, %for.cond5.preheader.us.preheader ]
br i1 %2, label %for.cond5.for.end15_crit_edge.us.unr-lcssa, label %for.body7.us
for.body7.us: ; preds = %for.cond5.preheader.us, %for.body7.us
%indvars.iv48 = phi i64 [ %indvars.iv.next49.3, %for.body7.us ], [ 0, %for.cond5.preheader.us ]
%y.038.us = phi i32 [ %spec.select32.us.3, %for.body7.us ], [ 0, %for.cond5.preheader.us ]
%x.037.us = phi i32 [ %spec.select.us.3, %for.body7.us ], [ 0, %for.cond5.preheader.us ]
%niter = phi i64 [ %niter.next.3, %for.body7.us ], [ 0, %for.cond5.preheader.us ]
%arrayidx9.us = getelementptr inbounds [51 x i32], ptr %a, i64 0, i64 %indvars.iv48
%3 = load i32, ptr %arrayidx9.us, align 16, !tbaa !5
%cmp10.us = icmp slt i32 %x.037.us, %3
%spec.select.us = call i32 @llvm.smax.i32(i32 %x.037.us, i32 %3)
%4 = trunc i64 %indvars.iv48 to i32
%spec.select32.us = select i1 %cmp10.us, i32 %4, i32 %y.038.us
%indvars.iv.next49 = or i64 %indvars.iv48, 1
%arrayidx9.us.1 = getelementptr inbounds [51 x i32], ptr %a, i64 0, i64 %indvars.iv.next49
%5 = load i32, ptr %arrayidx9.us.1, align 4, !tbaa !5
%cmp10.us.1 = icmp slt i32 %spec.select.us, %5
%spec.select.us.1 = call i32 @llvm.smax.i32(i32 %spec.select.us, i32 %5)
%6 = trunc i64 %indvars.iv.next49 to i32
%spec.select32.us.1 = select i1 %cmp10.us.1, i32 %6, i32 %spec.select32.us
%indvars.iv.next49.1 = or i64 %indvars.iv48, 2
%arrayidx9.us.2 = getelementptr inbounds [51 x i32], ptr %a, i64 0, i64 %indvars.iv.next49.1
%7 = load i32, ptr %arrayidx9.us.2, align 8, !tbaa !5
%cmp10.us.2 = icmp slt i32 %spec.select.us.1, %7
%spec.select.us.2 = call i32 @llvm.smax.i32(i32 %spec.select.us.1, i32 %7)
%8 = trunc i64 %indvars.iv.next49.1 to i32
%spec.select32.us.2 = select i1 %cmp10.us.2, i32 %8, i32 %spec.select32.us.1
%indvars.iv.next49.2 = or i64 %indvars.iv48, 3
%arrayidx9.us.3 = getelementptr inbounds [51 x i32], ptr %a, i64 0, i64 %indvars.iv.next49.2
%9 = load i32, ptr %arrayidx9.us.3, align 4, !tbaa !5
%cmp10.us.3 = icmp slt i32 %spec.select.us.2, %9
%spec.select.us.3 = call i32 @llvm.smax.i32(i32 %spec.select.us.2, i32 %9)
%10 = trunc i64 %indvars.iv.next49.2 to i32
%spec.select32.us.3 = select i1 %cmp10.us.3, i32 %10, i32 %spec.select32.us.2
%indvars.iv.next49.3 = add nuw nsw i64 %indvars.iv48, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond5.for.end15_crit_edge.us.unr-lcssa, label %for.body7.us, !llvm.loop !9
for.cond5.for.end15_crit_edge.us.unr-lcssa: ; preds = %for.body7.us, %for.cond5.preheader.us
%spec.select.us.lcssa.ph = phi i32 [ undef, %for.cond5.preheader.us ], [ %spec.select.us.3, %for.body7.us ]
%spec.select32.us.lcssa.ph = phi i32 [ undef, %for.cond5.preheader.us ], [ %spec.select32.us.3, %for.body7.us ]
%indvars.iv48.unr = phi i64 [ 0, %for.cond5.preheader.us ], [ %indvars.iv.next49.3, %for.body7.us ]
%y.038.us.unr = phi i32 [ 0, %for.cond5.preheader.us ], [ %spec.select32.us.3, %for.body7.us ]
%x.037.us.unr = phi i32 [ 0, %for.cond5.preheader.us ], [ %spec.select.us.3, %for.body7.us ]
br i1 %lcmp.mod.not, label %for.cond5.for.end15_crit_edge.us, label %for.body7.us.epil
for.body7.us.epil: ; preds = %for.cond5.for.end15_crit_edge.us.unr-lcssa, %for.body7.us.epil
%indvars.iv48.epil = phi i64 [ %indvars.iv.next49.epil, %for.body7.us.epil ], [ %indvars.iv48.unr, %for.cond5.for.end15_crit_edge.us.unr-lcssa ]
%y.038.us.epil = phi i32 [ %spec.select32.us.epil, %for.body7.us.epil ], [ %y.038.us.unr, %for.cond5.for.end15_crit_edge.us.unr-lcssa ]
%x.037.us.epil = phi i32 [ %spec.select.us.epil, %for.body7.us.epil ], [ %x.037.us.unr, %for.cond5.for.end15_crit_edge.us.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body7.us.epil ], [ 0, %for.cond5.for.end15_crit_edge.us.unr-lcssa ]
%arrayidx9.us.epil = getelementptr inbounds [51 x i32], ptr %a, i64 0, i64 %indvars.iv48.epil
%11 = load i32, ptr %arrayidx9.us.epil, align 4, !tbaa !5
%cmp10.us.epil = icmp slt i32 %x.037.us.epil, %11
%spec.select.us.epil = call i32 @llvm.smax.i32(i32 %x.037.us.epil, i32 %11)
%12 = trunc i64 %indvars.iv48.epil to i32
%spec.select32.us.epil = select i1 %cmp10.us.epil, i32 %12, i32 %y.038.us.epil
%indvars.iv.next49.epil = add nuw nsw i64 %indvars.iv48.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond5.for.end15_crit_edge.us, label %for.body7.us.epil, !llvm.loop !11
for.cond5.for.end15_crit_edge.us: ; preds = %for.body7.us.epil, %for.cond5.for.end15_crit_edge.us.unr-lcssa
%spec.select.us.lcssa = phi i32 [ %spec.select.us.lcssa.ph, %for.cond5.for.end15_crit_edge.us.unr-lcssa ], [ %spec.select.us.epil, %for.body7.us.epil ]
%spec.select32.us.lcssa = phi i32 [ %spec.select32.us.lcssa.ph, %for.cond5.for.end15_crit_edge.us.unr-lcssa ], [ %spec.select32.us.epil, %for.body7.us.epil ]
%add.us = add nsw i32 %spec.select.us.lcssa, %z.043.us
%idxprom16.us = sext i32 %spec.select32.us.lcssa to i64
%arrayidx17.us = getelementptr inbounds [51 x i32], ptr %a, i64 0, i64 %idxprom16.us
store i32 0, ptr %arrayidx17.us, align 4, !tbaa !5
%inc19.us = add nuw nsw i32 %i.142.us, 1
%exitcond51.not = icmp eq i32 %inc19.us, %1
br i1 %exitcond51.not, label %for.end20, label %for.cond5.preheader.us, !llvm.loop !13
for.cond5.preheader.lr.ph.split: ; preds = %for.cond5.preheader.lr.ph
store i32 0, ptr %a, align 16, !tbaa !5
br label %for.end20
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 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
%13 = load i32, ptr %N, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !14
for.end20: ; preds = %for.cond5.for.end15_crit_edge.us, %for.cond5.preheader.lr.ph.split, %for.cond2.preheader
%z.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %for.cond5.preheader.lr.ph.split ], [ %add.us, %for.cond5.for.end15_crit_edge.us ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %z.0.lcssa)
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b){
return *(int*)b - *(int*)a;
}
int main(void){
int n, k;
scanf("%d%d", &n, &k);
int l[n];
for(int i = 0; i < n; i++){
scanf("%d", &l[i]);
}
qsort(l, n, sizeof(int), compare_int);
int ans = 0;
for(int i = 0; i < k; i++){
ans += l[i];
}
printf("%d\n", ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164235/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164235/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = 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
%cmp19 = icmp sgt i32 %3, 0
br i1 %cmp19, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %12, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compare_int) #7
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp421 = icmp sgt i32 %4, 0
br i1 %cmp421, label %for.body7.preheader, label %for.cond.cleanup6
for.body7.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body7.preheader32, label %vector.ph
vector.ph: ; preds = %for.body7.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi30 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%5 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load31 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = add <4 x i32> %wide.load, %vec.phi
%8 = add <4 x i32> %wide.load31, %vec.phi30
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup6, label %for.body7.preheader32
for.body7.preheader32: ; preds = %for.body7.preheader, %middle.block
%indvars.iv27.ph = phi i64 [ 0, %for.body7.preheader ], [ %n.vec, %middle.block ]
%ans.022.ph = phi i32 [ 0, %for.body7.preheader ], [ %10, %middle.block ]
br label %for.body7
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.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup6: ; preds = %for.body7, %middle.block, %for.cond.cleanup
%ans.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %10, %middle.block ], [ %add, %for.body7 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.body7: ; preds = %for.body7.preheader32, %for.body7
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body7 ], [ %indvars.iv27.ph, %for.body7.preheader32 ]
%ans.022 = phi i32 [ %add, %for.body7 ], [ %ans.022.ph, %for.body7.preheader32 ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv27
%13 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add = add nsw i32 %13, %ans.022
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%exitcond.not = icmp eq i64 %indvars.iv.next28, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include<stdio.h>
int main()
{
int x, i, a;
scanf("%d", &x);
for (i = 1; i <= 100000; i++) {
if (x >= 100 * i && x <= 105 * i) {
printf("1\n");
break;
}
else if (i * 100 >= x) {
printf("0\n");
break;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164279/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164279/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
br label %for.body
for.cond: ; preds = %if.else
%inc = add nuw nsw i32 %i.015, 1
%mul.1 = mul nuw nsw i32 %inc, 100
%cmp1.not.1 = icmp slt i32 %0, %mul.1
%mul2.1 = mul nuw nsw i32 %inc, 105
%cmp3.not.1 = icmp sgt i32 %0, %mul2.1
%or.cond.1 = select i1 %cmp1.not.1, i1 true, i1 %cmp3.not.1
br i1 %or.cond.1, label %if.else.1, label %for.end.sink.split
if.else.1: ; preds = %for.cond
%cmp6.not.1 = icmp slt i32 %mul.1, %0
br i1 %cmp6.not.1, label %for.cond.1, label %for.end.sink.split
for.cond.1: ; preds = %if.else.1
%inc.1 = add nuw nsw i32 %i.015, 2
%exitcond.not.1 = icmp eq i32 %inc.1, 100001
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.1, %entry
%i.015 = phi i32 [ 1, %entry ], [ %inc.1, %for.cond.1 ]
%mul = mul nuw nsw i32 %i.015, 100
%cmp1.not = icmp slt i32 %0, %mul
%mul2 = mul nuw nsw i32 %i.015, 105
%cmp3.not = icmp sgt i32 %0, %mul2
%or.cond = select i1 %cmp1.not, i1 true, i1 %cmp3.not
br i1 %or.cond, label %if.else, label %for.end.sink.split
if.else: ; preds = %for.body
%cmp6.not = icmp slt i32 %mul, %0
br i1 %cmp6.not, label %for.cond, label %for.end.sink.split
for.end.sink.split: ; preds = %if.else.1, %for.cond, %if.else, %for.body
%str.sink = phi ptr [ @str.3, %for.body ], [ @str, %if.else ], [ @str.3, %for.cond ], [ @str, %if.else.1 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
br label %for.end
for.end: ; preds = %for.cond.1, %for.end.sink.split
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 x;
scanf("%d", &x);
int max, hasu, num, ans=0;
max = (int)x/100;
hasu = x%100;
num = 0;
for(int i=5; i>0; i--){
num += (int) (hasu/i);
hasu = hasu%i;
}
//printf("max = %d, num = %d\n", max, num);
if(num <= max)printf("1\n");
else printf("0\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164321/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164321/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%rem = srem i32 %0, 100
%div1.lhs.trunc = trunc i32 %rem to i8
%div115 = sdiv i8 %div1.lhs.trunc, 5
%rem2.lhs.trunc = trunc i32 %rem to i8
%rem216 = srem i8 %rem2.lhs.trunc, 5
%div1.117 = sdiv i8 %rem216, 4
%narrow = add nsw i8 %div1.117, %div115
%rem2.118 = srem i8 %rem216, 4
%div1.219 = sdiv i8 %rem2.118, 3
%narrow23 = add nsw i8 %div1.219, %narrow
%add.2 = sext i8 %narrow23 to i32
%rem2.220 = srem i8 %rem2.118, 3
%div1.321 = sdiv i8 %rem2.220, 2
%div1.3.sext = sext i8 %div1.321 to i32
%add.3 = add nsw i32 %div1.3.sext, %add.2
%rem2.322 = srem i8 %rem2.220, 2
%rem2.3.sext = sext i8 %rem2.322 to i32
%add.4 = add nsw i32 %add.3, %rem2.3.sext
%div = sdiv i32 %0, 100
%cmp3.not = icmp sgt i32 %add.4, %div
%str.str.3 = select i1 %cmp3.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
long long int max(long long int a,long long int b);
int i,j,k;
int R,C,K;
int r,c,v;
int table[3001][3001];
long long int ret;
long long int dp[3001][3001][4];
int main(void)
{
scanf("%d %d %d",&R,&C,&K);
for (i=0;i<3001;i++){
for (j=0;j<3001;j++){
table[i][j]=0;
}
}
for (i=0;i<3001;i++){
for (j=0;j<3001;j++){
for (k=0;k<4;k++){
dp[i][j][k]=0;
}
}
}
for (i=0;i<K;i++){
scanf("%d %d %d",&r,&c,&v);
table[r-1][c-1]=v;
}
for (i=0;i<R;i++){
for (j=0;j<C;j++){
for (k=2;k>=0;k--){
dp[i][j][k+1]=max(dp[i][j][k+1],dp[i][j][k]+table[i][j]);
}
for (k=0;k<4;k++){
if (i<R-1) dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][k]);
if (j<C-1) dp[i][j+1][k]=max(dp[i][j+1][k],dp[i][j][k]);
}
}
}
ret=dp[R-1][C-1][0];
for (i=0;i<4;i++){
ret=max(ret,dp[R-1][C-1][i]);
}
printf("%lld",ret);
return 0;
}
long long int max(long long int a,long long int b){
if (a<b) return b;
else return a;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164365/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164365/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@R = dso_local global i32 0, align 4
@C = dso_local global i32 0, align 4
@K = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@table = dso_local local_unnamed_addr global [3001 x [3001 x i32]] zeroinitializer, align 16
@k = dso_local local_unnamed_addr global i32 0, align 4
@dp = dso_local local_unnamed_addr global [3001 x [3001 x [4 x i64]]] zeroinitializer, align 16
@r = dso_local global i32 0, align 4
@c = dso_local global i32 0, align 4
@v = dso_local global i32 0, align 4
@ret = dso_local local_unnamed_addr global i64 0, align 8
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @R, ptr noundef nonnull @C, ptr noundef nonnull @K)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(36024004) @table, i8 0, i64 36024004, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(288192032) @dp, i8 0, i64 288192032, i1 false), !tbaa !9
store i32 3001, ptr @j, align 4, !tbaa !5
store i32 4, ptr @k, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @K, align 4, !tbaa !5
%cmp34195 = icmp sgt i32 %0, 0
br i1 %cmp34195, label %for.body35, label %for.cond45.preheader
for.cond45.preheader: ; preds = %for.body35, %entry
%1 = load i32, ptr @R, align 4, !tbaa !5
%cmp46212 = icmp sgt i32 %1, 0
%.pre = load i32, ptr @C, align 4, !tbaa !5
br i1 %cmp46212, label %for.cond48.preheader.lr.ph, label %for.cond45.preheader.for.end141_crit_edge
for.cond45.preheader.for.end141_crit_edge: ; preds = %for.cond45.preheader
%.pre255 = add nsw i32 %1, -1
%.pre256 = add nsw i32 %.pre, -1
br label %for.end141
for.cond48.preheader.lr.ph: ; preds = %for.cond45.preheader
%cmp49210 = icmp sgt i32 %.pre, 0
%sub85 = add nsw i32 %1, -1
%sub107 = add nsw i32 %.pre, -1
br i1 %cmp49210, label %for.cond48.preheader.us.preheader, label %for.cond45.for.end141_crit_edge
for.cond48.preheader.us.preheader: ; preds = %for.cond48.preheader.lr.ph
%2 = zext i32 %sub107 to i64
%3 = zext i32 %sub85 to i64
%wide.trip.count249 = zext i32 %1 to i64
%wide.trip.count = zext i32 %.pre to i64
br label %for.cond48.preheader.us
for.cond48.preheader.us: ; preds = %for.cond48.preheader.us.preheader, %for.cond48.for.inc139_crit_edge.us
%indvars.iv246 = phi i64 [ 0, %for.cond48.preheader.us.preheader ], [ %indvars.iv.next247, %for.cond48.for.inc139_crit_edge.us ]
%cmp86.us = icmp ult i64 %indvars.iv246, %3
%indvars.iv.next247 = add nuw nsw i64 %indvars.iv246, 1
br label %for.cond51.preheader.us
for.body84.us.us.preheader: ; preds = %for.cond51.preheader.us
br i1 %cmp86.us, label %if.then.us.us.3, label %if.end.us.us.2
for.cond51.preheader.us: ; preds = %for.cond48.preheader.us, %for.inc136.us
%indvars.iv = phi i64 [ 0, %for.cond48.preheader.us ], [ %indvars.iv.next, %for.inc136.us ]
%arrayidx69.us = getelementptr inbounds [3001 x [3001 x i32]], ptr @table, i64 0, i64 %indvars.iv246, i64 %indvars.iv
%4 = load i32, ptr %arrayidx69.us, align 4, !tbaa !5
%conv.us = sext i32 %4 to i64
%arrayidx59.us = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv, i64 3
%5 = load i64, ptr %arrayidx59.us, align 8, !tbaa !9
%arrayidx65.us = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv, i64 2
%6 = load i64, ptr %arrayidx65.us, align 16, !tbaa !9
%add70.us = add nsw i64 %6, %conv.us
%b.a.i.us = tail call i64 @llvm.smax.i64(i64 %5, i64 %add70.us)
store i64 %b.a.i.us, ptr %arrayidx59.us, align 8, !tbaa !9
%arrayidx65.us.1 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv, i64 1
%7 = load i64, ptr %arrayidx65.us.1, align 8, !tbaa !9
%add70.us.1 = add nsw i64 %7, %conv.us
%b.a.i.us.1 = tail call i64 @llvm.smax.i64(i64 %6, i64 %add70.us.1)
store i64 %b.a.i.us.1, ptr %arrayidx65.us, align 16, !tbaa !9
%arrayidx65.us.2 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv, i64 0
%8 = load i64, ptr %arrayidx65.us.2, align 16, !tbaa !9
%add70.us.2 = add nsw i64 %8, %conv.us
%b.a.i.us.2 = tail call i64 @llvm.smax.i64(i64 %7, i64 %add70.us.2)
store i64 %b.a.i.us.2, ptr %arrayidx65.us.1, align 8, !tbaa !9
%cmp108.us = icmp ult i64 %indvars.iv, %2
%arrayidx92.us = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv.next247, i64 %indvars.iv
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br i1 %cmp108.us, label %for.body84.us.us.preheader, label %for.cond81.preheader.split.us222
for.cond81.preheader.split.us222: ; preds = %for.cond51.preheader.us
br i1 %cmp86.us, label %for.cond81.preheader.split.split.us.us, label %for.inc136.us
for.inc136.us: ; preds = %for.cond81.preheader.split.us222, %for.cond81.preheader.split.split.us.us, %if.end.us.us.3
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond48.for.inc139_crit_edge.us, label %for.cond51.preheader.us, !llvm.loop !11
if.end.us.us.2: ; preds = %for.body84.us.us.preheader
%arrayidx117.us.us = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv.next, i64 0
%9 = load i64, ptr %arrayidx117.us.us, align 16, !tbaa !9
%b.a.i184.us.us = tail call i64 @llvm.smax.i64(i64 %9, i64 %8)
store i64 %b.a.i184.us.us, ptr %arrayidx117.us.us, align 16, !tbaa !9
%arrayidx117.us.us.1 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv.next, i64 1
%10 = load i64, ptr %arrayidx117.us.us.1, align 8, !tbaa !9
%b.a.i184.us.us.1 = tail call i64 @llvm.smax.i64(i64 %10, i64 %b.a.i.us.2)
store i64 %b.a.i184.us.us.1, ptr %arrayidx117.us.us.1, align 8, !tbaa !9
%arrayidx117.us.us.2 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv.next, i64 2
%11 = load i64, ptr %arrayidx117.us.us.2, align 16, !tbaa !9
%b.a.i184.us.us.2 = tail call i64 @llvm.smax.i64(i64 %11, i64 %b.a.i.us.1)
store i64 %b.a.i184.us.us.2, ptr %arrayidx117.us.us.2, align 16, !tbaa !9
br label %if.end.us.us.3
if.then.us.us.3: ; preds = %for.body84.us.us.preheader
%12 = load i64, ptr %arrayidx92.us, align 16, !tbaa !9
%b.a.i183.us.us = tail call i64 @llvm.smax.i64(i64 %12, i64 %8)
store i64 %b.a.i183.us.us, ptr %arrayidx92.us, align 16, !tbaa !9
%arrayidx117.us.us257 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv.next, i64 0
%13 = load i64, ptr %arrayidx117.us.us257, align 16, !tbaa !9
%b.a.i184.us.us258 = tail call i64 @llvm.smax.i64(i64 %13, i64 %8)
store i64 %b.a.i184.us.us258, ptr %arrayidx117.us.us257, align 16, !tbaa !9
%b.a.i183.us.us.1 = tail call i64 @llvm.smax.i64(i64 %b.a.i183.us.us, i64 %b.a.i.us.2)
store i64 %b.a.i183.us.us.1, ptr %arrayidx92.us, align 16, !tbaa !9
%arrayidx117.us.us.1259 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv.next, i64 1
%14 = load i64, ptr %arrayidx117.us.us.1259, align 8, !tbaa !9
%b.a.i184.us.us.1260 = tail call i64 @llvm.smax.i64(i64 %14, i64 %b.a.i.us.2)
store i64 %b.a.i184.us.us.1260, ptr %arrayidx117.us.us.1259, align 8, !tbaa !9
%b.a.i183.us.us.2 = tail call i64 @llvm.smax.i64(i64 %b.a.i183.us.us.1, i64 %b.a.i.us.1)
store i64 %b.a.i183.us.us.2, ptr %arrayidx92.us, align 16, !tbaa !9
%arrayidx117.us.us.2261 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv.next, i64 2
%15 = load i64, ptr %arrayidx117.us.us.2261, align 16, !tbaa !9
%b.a.i184.us.us.2262 = tail call i64 @llvm.smax.i64(i64 %15, i64 %b.a.i.us.1)
store i64 %b.a.i184.us.us.2262, ptr %arrayidx117.us.us.2261, align 16, !tbaa !9
%b.a.i183.us.us.3 = tail call i64 @llvm.smax.i64(i64 %b.a.i183.us.us.2, i64 %b.a.i.us)
store i64 %b.a.i183.us.us.3, ptr %arrayidx92.us, align 16, !tbaa !9
br label %if.end.us.us.3
if.end.us.us.3: ; preds = %if.end.us.us.2, %if.then.us.us.3
%arrayidx117.us.us.3 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %indvars.iv246, i64 %indvars.iv.next, i64 3
%16 = load i64, ptr %arrayidx117.us.us.3, align 8, !tbaa !9
%b.a.i184.us.us.3 = tail call i64 @llvm.smax.i64(i64 %16, i64 %b.a.i.us)
store i64 %b.a.i184.us.us.3, ptr %arrayidx117.us.us.3, align 8, !tbaa !9
br label %for.inc136.us
for.cond81.preheader.split.split.us.us: ; preds = %for.cond81.preheader.split.us222
%arrayidx92.promoted.us = load i64, ptr %arrayidx92.us, align 16, !tbaa !9
%b.a.i183.us203.us = tail call i64 @llvm.smax.i64(i64 %arrayidx92.promoted.us, i64 %8)
%b.a.i183.us203.us.1 = tail call i64 @llvm.smax.i64(i64 %b.a.i183.us203.us, i64 %b.a.i.us.2)
%b.a.i183.us203.us.2 = tail call i64 @llvm.smax.i64(i64 %b.a.i183.us203.us.1, i64 %b.a.i.us.1)
%b.a.i183.us203.us.3 = tail call i64 @llvm.smax.i64(i64 %b.a.i183.us203.us.2, i64 %b.a.i.us)
store i64 %b.a.i183.us203.us.3, ptr %arrayidx92.us, align 16, !tbaa !9
br label %for.inc136.us
for.cond48.for.inc139_crit_edge.us: ; preds = %for.inc136.us
%exitcond250.not = icmp eq i64 %indvars.iv.next247, %wide.trip.count249
br i1 %exitcond250.not, label %for.cond45.for.end141_crit_edge.split.us, label %for.cond48.preheader.us, !llvm.loop !13
for.cond45.for.end141_crit_edge.split.us: ; preds = %for.cond48.for.inc139_crit_edge.us
store i32 4, ptr @k, align 4, !tbaa !5
br label %for.cond45.for.end141_crit_edge
for.body35: ; preds = %entry, %for.body35
%call36 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @r, ptr noundef nonnull @c, ptr noundef nonnull @v)
%17 = load i32, ptr @v, align 4, !tbaa !5
%18 = load i32, ptr @r, align 4, !tbaa !5
%sub = add nsw i32 %18, -1
%idxprom37 = sext i32 %sub to i64
%19 = load i32, ptr @c, align 4, !tbaa !5
%sub39 = add nsw i32 %19, -1
%idxprom40 = sext i32 %sub39 to i64
%arrayidx41 = getelementptr inbounds [3001 x [3001 x i32]], ptr @table, i64 0, i64 %idxprom37, i64 %idxprom40
store i32 %17, ptr %arrayidx41, align 4, !tbaa !5
%20 = load i32, ptr @i, align 4, !tbaa !5
%inc43 = add nsw i32 %20, 1
store i32 %inc43, ptr @i, align 4, !tbaa !5
%21 = load i32, ptr @K, align 4, !tbaa !5
%cmp34 = icmp slt i32 %inc43, %21
br i1 %cmp34, label %for.body35, label %for.cond45.preheader, !llvm.loop !14
for.cond45.for.end141_crit_edge: ; preds = %for.cond48.preheader.lr.ph, %for.cond45.for.end141_crit_edge.split.us
%.us-phi225 = phi i32 [ %.pre, %for.cond45.for.end141_crit_edge.split.us ], [ 0, %for.cond48.preheader.lr.ph ]
store i32 %.us-phi225, ptr @j, align 4, !tbaa !5
br label %for.end141
for.end141: ; preds = %for.cond45.preheader.for.end141_crit_edge, %for.cond45.for.end141_crit_edge
%sub145.pre-phi = phi i32 [ %.pre256, %for.cond45.preheader.for.end141_crit_edge ], [ %sub107, %for.cond45.for.end141_crit_edge ]
%sub142.pre-phi = phi i32 [ %.pre255, %for.cond45.preheader.for.end141_crit_edge ], [ %sub85, %for.cond45.for.end141_crit_edge ]
%idxprom143 = sext i32 %sub142.pre-phi to i64
%idxprom146 = sext i32 %sub145.pre-phi to i64
%arrayidx147 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %idxprom143, i64 %idxprom146
%22 = load i64, ptr %arrayidx147, align 16, !tbaa !9
%arrayidx160.1 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %idxprom143, i64 %idxprom146, i64 1
%23 = load i64, ptr %arrayidx160.1, align 8, !tbaa !9
%b.a.i185.1 = tail call i64 @llvm.smax.i64(i64 %22, i64 %23)
%arrayidx160.2 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %idxprom143, i64 %idxprom146, i64 2
%24 = load i64, ptr %arrayidx160.2, align 16, !tbaa !9
%b.a.i185.2 = tail call i64 @llvm.smax.i64(i64 %b.a.i185.1, i64 %24)
%arrayidx160.3 = getelementptr inbounds [3001 x [3001 x [4 x i64]]], ptr @dp, i64 0, i64 %idxprom143, i64 %idxprom146, i64 3
%25 = load i64, ptr %arrayidx160.3, align 8, !tbaa !9
%b.a.i185.3 = tail call i64 @llvm.smax.i64(i64 %b.a.i185.2, i64 %25)
store i32 4, ptr @i, align 4, !tbaa !5
store i64 %b.a.i185.3, ptr @ret, align 8, !tbaa !9
%call165 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %b.a.i185.3)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%b.a = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %b.a
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int min3(int a, int b, int c) {
int min=a;
if (b < min) min=b;
if (c < min) min=c;
return min;
}
int main() {
int N,A,B;
scanf("%d",&N);
scanf("%d %d",&A,&B);
int P[N];
for (int i = 0; i < N; i++) {
scanf("%d",&P[i]);
}
qsort(P, N, sizeof(int), compare_int);
int a=0,b=0,c;
for (int i = 0; i < N; i++) {
if (P[i] <= A) a++;
if (A < P[i] && P[i] <= B) b++;
}
c=N-(a+b);
int answer;
answer = min3(a, b, c);
printf("%d",answer);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164408/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min3(i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #1 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %b, i32 %a)
%min.1 = tail call i32 @llvm.smin.i32(i32 %spec.select, i32 %c)
ret i32 %min.1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A, ptr noundef nonnull %B)
%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
%cmp43 = icmp sgt i32 %3, 0
br i1 %cmp43, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %29, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compare_int) #8
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp545 = icmp sgt i32 %4, 0
br i1 %cmp545, label %for.body8.lr.ph, label %for.cond.cleanup7
for.body8.lr.ph: ; preds = %for.cond.cleanup
%5 = load i32, ptr %A, align 4, !tbaa !5
%6 = load i32, ptr %B, align 4
%wide.trip.count = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body8.preheader, label %vector.ph
vector.ph: ; preds = %for.body8.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %5, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert60 = insertelement <4 x i32> poison, i32 %6, i64 0
%broadcast.splat61 = shufflevector <4 x i32> %broadcast.splatinsert60, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %23, %vector.body ]
%vec.phi56 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
%vec.phi57 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi58 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%7 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load59 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = icmp sle <4 x i32> %wide.load, %broadcast.splat
%10 = icmp sle <4 x i32> %wide.load59, %broadcast.splat
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = add <4 x i32> %vec.phi57, %11
%14 = add <4 x i32> %vec.phi58, %12
%15 = icmp slt <4 x i32> %broadcast.splat, %wide.load
%16 = icmp slt <4 x i32> %broadcast.splat, %wide.load59
%17 = icmp sle <4 x i32> %wide.load, %broadcast.splat61
%18 = icmp sle <4 x i32> %wide.load59, %broadcast.splat61
%19 = select <4 x i1> %15, <4 x i1> %17, <4 x i1> zeroinitializer
%20 = select <4 x i1> %16, <4 x i1> %18, <4 x i1> zeroinitializer
%21 = zext <4 x i1> %19 to <4 x i32>
%22 = zext <4 x i1> %20 to <4 x i32>
%23 = add <4 x i32> %vec.phi, %21
%24 = add <4 x i32> %vec.phi56, %22
%index.next = add nuw i64 %index, 8
%25 = icmp eq i64 %index.next, %n.vec
br i1 %25, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx62 = add <4 x i32> %14, %13
%26 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx62)
%bin.rdx = add <4 x i32> %24, %23
%27 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup7, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body8.lr.ph, %middle.block
%indvars.iv53.ph = phi i64 [ 0, %for.body8.lr.ph ], [ %n.vec, %middle.block ]
%b.047.ph = phi i32 [ 0, %for.body8.lr.ph ], [ %27, %middle.block ]
%a.046.ph = phi i32 [ 0, %for.body8.lr.ph ], [ %26, %middle.block ]
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%28 = load i32, ptr %N, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp = icmp slt i64 %indvars.iv.next, %29
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup7: ; preds = %for.body8, %middle.block, %for.cond.cleanup
%a.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %26, %middle.block ], [ %spec.select, %for.body8 ]
%b.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %27, %middle.block ], [ %b.1, %for.body8 ]
%30 = add i32 %b.0.lcssa, %a.0.lcssa
%sub = sub i32 %4, %30
%spec.select.i = call i32 @llvm.smin.i32(i32 %b.0.lcssa, i32 %a.0.lcssa)
%min.1.i = call i32 @llvm.smin.i32(i32 %spec.select.i, i32 %sub)
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %min.1.i)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
ret i32 0
for.body8: ; preds = %for.body8.preheader, %for.body8
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body8 ], [ %indvars.iv53.ph, %for.body8.preheader ]
%b.047 = phi i32 [ %b.1, %for.body8 ], [ %b.047.ph, %for.body8.preheader ]
%a.046 = phi i32 [ %spec.select, %for.body8 ], [ %a.046.ph, %for.body8.preheader ]
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv53
%31 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp sle i32 %31, %5
%inc13 = zext i1 %cmp11.not to i32
%spec.select = add nuw nsw i32 %a.046, %inc13
%cmp16 = icmp slt i32 %5, %31
%cmp20.not = icmp sle i32 %31, %6
%or.cond.not = select i1 %cmp16, i1 %cmp20.not, i1 false
%inc23 = zext i1 %or.cond.not to i32
%b.1 = add nuw nsw i32 %b.047, %inc23
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%exitcond.not = icmp eq i64 %indvars.iv.next54, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup7, label %for.body8, !llvm.loop !14
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include <stdio.h>
#include <string.h>
#define NMAX 100000
int ufpar[NMAX], ufw[NMAX];
int UF_find(int);
int UF_weight(int);
int UF_union(int, int, int);
int UF_diff(int*, int, int);
int main(void)
{
int i, n, m, l, r, d;
scanf("%d %d", &n, &m);
memset(ufpar, -1, sizeof(ufpar));
for (i = 0; i < m; i++) {
scanf("%d %d %d", &l, &r, &d);
if (!UF_union(l - 1, r - 1, d)) {
if (ufw[l-1] != ufw[r-1] + d) {
printf("No\n");
return 0;
}
}
}
printf("Yes\n");
}
int UF_find(int a)
{
int p;
if (ufpar[a] < 0) return a;
p = UF_find(ufpar[a]);
ufw[a] += ufw[ufpar[a]];
return ufpar[a] = p;
}
int UF_weight(int a)
{
UF_find(a);
return ufw[a];
}
int UF_union(int x, int y, int w)
{
w -= UF_weight(x);
w += UF_weight(y);
x = UF_find(x);
y = UF_find(y);
if (x == y) return 0;
if (ufpar[x] > ufpar[y]) {
ufpar[y] += ufpar[x];
ufpar[x] = y;
ufw[x] = w;
} else {
ufpar[x] += ufpar[y];
ufpar[y] = x;
ufw[y] = -w;
}
return 1;
}
int UF_diff(int *ans, int x, int y)
{
if (UF_find(x) != UF_find(y)) return 0;
else {
*ans = ufw[x] - ufw[y];
return 1;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164451/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164451/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@ufpar = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@ufw = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) @ufpar, i8 -1, i64 400000, i1 false)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %cleanup
for.body: ; preds = %entry, %for.inc
%i.023 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l, ptr noundef nonnull %r, ptr noundef nonnull %d)
%1 = load i32, ptr %l, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%2 = load i32, ptr %r, align 4, !tbaa !5
%sub2 = add nsw i32 %2, -1
%3 = load i32, ptr %d, align 4, !tbaa !5
%call.i.i = call i32 @UF_find(i32 noundef %sub)
%idxprom.i.i = sext i32 %sub to i64
%arrayidx.i.i = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom.i.i
%4 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%sub.i = sub nsw i32 %3, %4
%call.i49.i = call i32 @UF_find(i32 noundef %sub2)
%idxprom.i50.i = sext i32 %sub2 to i64
%arrayidx.i51.i = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom.i50.i
%5 = load i32, ptr %arrayidx.i51.i, align 4, !tbaa !5
%add.i = add nsw i32 %5, %sub.i
%call2.i = call i32 @UF_find(i32 noundef %sub)
%call3.i = call i32 @UF_find(i32 noundef %sub2)
%cmp.i = icmp eq i32 %call2.i, %call3.i
br i1 %cmp.i, label %if.then, label %if.end.i
if.end.i: ; preds = %for.body
%idxprom.i = sext i32 %call2.i to i64
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @ufpar, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom4.i = sext i32 %call3.i to i64
%arrayidx5.i = getelementptr inbounds [100000 x i32], ptr @ufpar, i64 0, i64 %idxprom4.i
%7 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp sgt i32 %6, %7
%add12.i = add nsw i32 %7, %6
br i1 %cmp6.i, label %if.then7.i, label %if.else.i
if.then7.i: ; preds = %if.end.i
store i32 %add12.i, ptr %arrayidx5.i, align 4, !tbaa !5
store i32 %call3.i, ptr %arrayidx.i, align 4, !tbaa !5
br label %UF_union.exit
if.else.i: ; preds = %if.end.i
store i32 %add12.i, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %call2.i, ptr %arrayidx5.i, align 4, !tbaa !5
%sub24.i = sub nsw i32 0, %add.i
br label %UF_union.exit
UF_union.exit: ; preds = %if.then7.i, %if.else.i
%idxprom.sink.i = phi i64 [ %idxprom.i, %if.then7.i ], [ %idxprom4.i, %if.else.i ]
%add.sink.i = phi i32 [ %add.i, %if.then7.i ], [ %sub24.i, %if.else.i ]
%arrayidx16.i = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom.sink.i
store i32 %add.sink.i, ptr %arrayidx16.i, align 4, !tbaa !5
br label %for.inc
if.then: ; preds = %for.body
%8 = load i32, ptr %l, align 4, !tbaa !5
%sub4 = add nsw i32 %8, -1
%idxprom = sext i32 %sub4 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom
%9 = load i32, ptr %arrayidx, align 4, !tbaa !5
%10 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %10, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom6
%11 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%12 = load i32, ptr %d, align 4, !tbaa !5
%add = add nsw i32 %12, %11
%cmp8.not = icmp eq i32 %9, %add
br i1 %cmp8.not, label %for.inc, label %cleanup
for.inc: ; preds = %UF_union.exit, %if.then
%inc = add nuw nsw i32 %i.023, 1
%13 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %13
br i1 %cmp, label %for.body, label %cleanup, !llvm.loop !9
cleanup: ; preds = %for.inc, %if.then, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str.4, %if.then ], [ @str, %for.inc ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @UF_union(i32 noundef %x, i32 noundef %y, i32 noundef %w) local_unnamed_addr #4 {
entry:
%call.i = tail call i32 @UF_find(i32 noundef %x)
%idxprom.i = sext i32 %x to i64
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom.i
%0 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%sub = sub nsw i32 %w, %0
%call.i49 = tail call i32 @UF_find(i32 noundef %y)
%idxprom.i50 = sext i32 %y to i64
%arrayidx.i51 = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom.i50
%1 = load i32, ptr %arrayidx.i51, align 4, !tbaa !5
%add = add nsw i32 %1, %sub
%call2 = tail call i32 @UF_find(i32 noundef %x)
%call3 = tail call i32 @UF_find(i32 noundef %y)
%cmp = icmp eq i32 %call2, %call3
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %call2 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @ufpar, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom4 = sext i32 %call3 to i64
%arrayidx5 = getelementptr inbounds [100000 x i32], ptr @ufpar, i64 0, i64 %idxprom4
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %2, %3
%add12 = add nsw i32 %3, %2
br i1 %cmp6, label %if.then7, label %if.else
if.then7: ; preds = %if.end
store i32 %add12, ptr %arrayidx5, align 4, !tbaa !5
store i32 %call3, ptr %arrayidx, align 4, !tbaa !5
br label %return.sink.split
if.else: ; preds = %if.end
store i32 %add12, ptr %arrayidx, align 4, !tbaa !5
store i32 %call2, ptr %arrayidx5, align 4, !tbaa !5
%sub24 = sub nsw i32 0, %add
br label %return.sink.split
return.sink.split: ; preds = %if.else, %if.then7
%idxprom.sink = phi i64 [ %idxprom, %if.then7 ], [ %idxprom4, %if.else ]
%add.sink = phi i32 [ %add, %if.then7 ], [ %sub24, %if.else ]
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom.sink
store i32 %add.sink, ptr %arrayidx16, align 4, !tbaa !5
br label %return
return: ; preds = %return.sink.split, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %return.sink.split ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @UF_find(i32 noundef %a) local_unnamed_addr #5 {
entry:
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @ufpar, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 0
br i1 %cmp, label %common.ret16, label %if.end
common.ret16: ; preds = %entry, %if.end
%common.ret16.op = phi i32 [ %call, %if.end ], [ %a, %entry ]
ret i32 %common.ret16.op
if.end: ; preds = %entry
%call = tail call i32 @UF_find(i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom5 = sext i32 %1 to i64
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %add, ptr %arrayidx8, align 4, !tbaa !5
store i32 %call, ptr %arrayidx, align 4, !tbaa !5
br label %common.ret16
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @UF_weight(i32 noundef %a) local_unnamed_addr #4 {
entry:
%call = tail call i32 @UF_find(i32 noundef %a)
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @UF_diff(ptr nocapture noundef writeonly %ans, i32 noundef %x, i32 noundef %y) local_unnamed_addr #4 {
entry:
%call = tail call i32 @UF_find(i32 noundef %x)
%call1 = tail call i32 @UF_find(i32 noundef %y)
%cmp.not = icmp eq i32 %call, %call1
br i1 %cmp.not, label %if.else, label %return
if.else: ; preds = %entry
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom2 = sext i32 %y to i64
%arrayidx3 = getelementptr inbounds [100000 x i32], ptr @ufw, i64 0, i64 %idxprom2
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
store i32 %sub, ptr %ans, align 4, !tbaa !5
br label %return
return: ; preds = %entry, %if.else
%retval.0 = phi i32 [ 1, %if.else ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; } /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
#define MAX 100001
#define MOD 1000000007
#define INF 1000000001
typedef long long int lli;
long long int Gcd(int x, int y)
{
if (y == 0)
return x;
else
return Gcd(y, x % y);
}
int main(void)
{
int n, a[MAX];
scanf("%d", &n);
rep(i, n)
{
scanf("%d", &a[i]);
}
int first[MAX], second[MAX];
first[0] = a[0];
second[n - 1] = a[n - 1];
for (int i = 1; i < n; i++)
{
first[i] = Gcd(first[i - 1], a[i]);
second[n - 1 - i] = Gcd(second[n - i], a[n - 1 - i]);
}
int max = second[1];
for (int i = 1; i < n - 1; i++)
max = max(max, Gcd(first[i - 1], second[i + 1]));
max = max(max, first[n - 2]);
printf("%d\n", max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164501/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164501/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @acs(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @des(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !9
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmp_str(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !10
%1 = load ptr, ptr %b, align 8, !tbaa !10
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #8
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @Gcd(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 {
entry:
%cmp4 = icmp eq i32 %y, 0
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %if.else, %entry
%x.tr.lcssa = phi i32 [ %x, %entry ], [ %y.tr6, %if.else ]
%conv = sext i32 %x.tr.lcssa to i64
ret i64 %conv
if.else: ; preds = %entry, %if.else
%y.tr6 = phi i32 [ %rem, %if.else ], [ %y, %entry ]
%x.tr5 = phi i32 [ %y.tr6, %if.else ], [ %x, %entry ]
%rem = srem i32 %x.tr5, %y.tr6
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %if.then, label %if.else
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%a = alloca [100001 x i32], align 16
%first = alloca [100001 x i32], align 16
%second = alloca [100001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %a) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp128 = icmp sgt i32 %0, 0
br i1 %cmp128, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %first) #9
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %second) #9
%sub150 = add nsw i32 %0, -1
%idxprom4151 = sext i32 %sub150 to i64
%arrayidx5152 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom4151
%1 = load i32, ptr %arrayidx5152, align 4, !tbaa !5
%arrayidx8153 = getelementptr inbounds [100001 x i32], ptr %second, i64 0, i64 %idxprom4151
store i32 %1, ptr %arrayidx8153, align 4, !tbaa !5
br label %for.cond.cleanup12.thread
for.cond.cleanup: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %first) #9
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %second) #9
store i32 %.pre, ptr %first, align 16, !tbaa !5
%sub = add nsw i32 %4, -1
%idxprom4 = sext i32 %sub to i64
%arrayidx5 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom4
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%arrayidx8 = getelementptr inbounds [100001 x i32], ptr %second, i64 0, i64 %idxprom4
store i32 %2, ptr %arrayidx8, align 4, !tbaa !5
%cmp11130 = icmp sgt i32 %4, 1
br i1 %cmp11130, label %for.body13.preheader, label %for.cond.cleanup12.thread
for.body13.preheader: ; preds = %for.cond.cleanup
%3 = zext i32 %4 to i64
%wide.trip.count = zext i32 %4 to i64
br label %for.body13
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 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
%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.cond.cleanup, !llvm.loop !12
for.cond.cleanup12.thread: ; preds = %for.cond.cleanup.thread, %for.cond.cleanup
%.lcssa155.ph = phi i32 [ %4, %for.cond.cleanup ], [ %0, %for.cond.cleanup.thread ]
%arrayidx38159 = getelementptr inbounds [100001 x i32], ptr %second, i64 0, i64 1
%6 = load i32, ptr %arrayidx38159, align 4, !tbaa !5
br label %for.cond.cleanup44
for.cond.cleanup12: ; preds = %Gcd.exit106
%arrayidx38 = getelementptr inbounds [100001 x i32], ptr %second, i64 0, i64 1
%7 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%cmp42132 = icmp sgt i32 %4, 2
br i1 %cmp42132, label %for.body45.preheader, label %for.cond.cleanup44
for.body45.preheader: ; preds = %for.cond.cleanup12
%wide.trip.count147 = zext i32 %sub to i64
br label %for.body45
for.body13: ; preds = %for.body13.preheader, %Gcd.exit106
%8 = phi i32 [ %.pre, %for.body13.preheader ], [ %x.tr.lcssa.i, %Gcd.exit106 ]
%indvars.iv138 = phi i64 [ 1, %for.body13.preheader ], [ %indvars.iv.next139, %Gcd.exit106 ]
%arrayidx18 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %indvars.iv138
%9 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%cmp4.i = icmp eq i32 %9, 0
br i1 %cmp4.i, label %Gcd.exit, label %if.else.i
if.else.i: ; preds = %for.body13, %if.else.i
%y.tr6.i = phi i32 [ %rem.i, %if.else.i ], [ %9, %for.body13 ]
%x.tr5.i = phi i32 [ %y.tr6.i, %if.else.i ], [ %8, %for.body13 ]
%rem.i = srem i32 %x.tr5.i, %y.tr6.i
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %Gcd.exit, label %if.else.i
Gcd.exit: ; preds = %if.else.i, %for.body13
%x.tr.lcssa.i = phi i32 [ %8, %for.body13 ], [ %y.tr6.i, %if.else.i ]
%arrayidx21 = getelementptr inbounds [100001 x i32], ptr %first, i64 0, i64 %indvars.iv138
store i32 %x.tr.lcssa.i, ptr %arrayidx21, align 4, !tbaa !5
%10 = sub nsw i64 %3, %indvars.iv138
%arrayidx24 = getelementptr inbounds [100001 x i32], ptr %second, i64 0, i64 %10
%11 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%12 = trunc i64 %indvars.iv138 to i32
%13 = xor i32 %12, -1
%sub26 = add i32 %4, %13
%idxprom27 = sext i32 %sub26 to i64
%arrayidx28 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom27
%14 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp4.i98 = icmp eq i32 %14, 0
br i1 %cmp4.i98, label %Gcd.exit106, label %if.else.i99
if.else.i99: ; preds = %Gcd.exit, %if.else.i99
%y.tr6.i100 = phi i32 [ %rem.i102, %if.else.i99 ], [ %14, %Gcd.exit ]
%x.tr5.i101 = phi i32 [ %y.tr6.i100, %if.else.i99 ], [ %11, %Gcd.exit ]
%rem.i102 = srem i32 %x.tr5.i101, %y.tr6.i100
%cmp.i103 = icmp eq i32 %rem.i102, 0
br i1 %cmp.i103, label %Gcd.exit106, label %if.else.i99
Gcd.exit106: ; preds = %if.else.i99, %Gcd.exit
%x.tr.lcssa.i104 = phi i32 [ %11, %Gcd.exit ], [ %y.tr6.i100, %if.else.i99 ]
%arrayidx34 = getelementptr inbounds [100001 x i32], ptr %second, i64 0, i64 %idxprom27
store i32 %x.tr.lcssa.i104, ptr %arrayidx34, align 4, !tbaa !5
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%exitcond.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup12, label %for.body13, !llvm.loop !14
for.cond.cleanup44: ; preds = %cond.end, %for.cond.cleanup12.thread, %for.cond.cleanup12
%.lcssa155161 = phi i32 [ %4, %for.cond.cleanup12 ], [ %.lcssa155.ph, %for.cond.cleanup12.thread ], [ %4, %cond.end ]
%max.0.lcssa = phi i32 [ %7, %for.cond.cleanup12 ], [ %6, %for.cond.cleanup12.thread ], [ %cond.in, %cond.end ]
%sub67 = add nsw i32 %.lcssa155161, -2
%idxprom68 = sext i32 %sub67 to i64
%arrayidx69 = getelementptr inbounds [100001 x i32], ptr %first, i64 0, i64 %idxprom68
%15 = load i32, ptr %arrayidx69, align 4, !tbaa !5
%max.0. = call i32 @llvm.smax.i32(i32 %max.0.lcssa, i32 %15)
%call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.)
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %second) #9
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %first) #9
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %a) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
for.body45: ; preds = %for.body45.preheader, %cond.end
%indvars.iv143 = phi i64 [ 1, %for.body45.preheader ], [ %indvars.iv.next144, %cond.end ]
%max.0133 = phi i32 [ %7, %for.body45.preheader ], [ %cond.in, %cond.end ]
%16 = add nsw i64 %indvars.iv143, -1
%arrayidx49 = getelementptr inbounds [100001 x i32], ptr %first, i64 0, i64 %16
%17 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%arrayidx51 = getelementptr inbounds [100001 x i32], ptr %second, i64 0, i64 %indvars.iv.next144
%18 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%cmp4.i107 = icmp eq i32 %18, 0
br i1 %cmp4.i107, label %Gcd.exit115.thread, label %if.else.i108
if.else.i108: ; preds = %for.body45, %if.else.i108
%y.tr6.i109 = phi i32 [ %rem.i111, %if.else.i108 ], [ %18, %for.body45 ]
%x.tr5.i110 = phi i32 [ %y.tr6.i109, %if.else.i108 ], [ %17, %for.body45 ]
%rem.i111 = srem i32 %x.tr5.i110, %y.tr6.i109
%cmp.i112 = icmp eq i32 %rem.i111, 0
br i1 %cmp.i112, label %Gcd.exit115, label %if.else.i108
Gcd.exit115: ; preds = %if.else.i108
%cmp53 = icmp slt i32 %y.tr6.i109, %max.0133
br i1 %cmp53, label %cond.end, label %if.else.i117
Gcd.exit115.thread: ; preds = %for.body45
%cmp53127 = icmp slt i32 %17, %max.0133
br i1 %cmp53127, label %cond.end, label %Gcd.exit124
if.else.i117: ; preds = %Gcd.exit115, %if.else.i117
%y.tr6.i118 = phi i32 [ %rem.i120, %if.else.i117 ], [ %18, %Gcd.exit115 ]
%x.tr5.i119 = phi i32 [ %y.tr6.i118, %if.else.i117 ], [ %17, %Gcd.exit115 ]
%rem.i120 = srem i32 %x.tr5.i119, %y.tr6.i118
%cmp.i121 = icmp eq i32 %rem.i120, 0
br i1 %cmp.i121, label %Gcd.exit124, label %if.else.i117
Gcd.exit124: ; preds = %if.else.i117, %Gcd.exit115.thread
%x.tr.lcssa.i122 = phi i32 [ %17, %Gcd.exit115.thread ], [ %y.tr6.i118, %if.else.i117 ]
br label %cond.end
cond.end: ; preds = %Gcd.exit115.thread, %Gcd.exit115, %Gcd.exit124
%cond.in = phi i32 [ %x.tr.lcssa.i122, %Gcd.exit124 ], [ %max.0133, %Gcd.exit115 ], [ %max.0133, %Gcd.exit115.thread ]
%exitcond148.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count147
br i1 %exitcond148.not, label %for.cond.cleanup44, label %for.body45, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
|
#include <stdio.h>
typedef long long ll;
int gcd(int x, int y) {
if (x < y) {
int temp = x;
x = y;
y = temp;
}
while (1) {
if (x % y == 0)
break;
else {
int temp = x % y;
x = y;
y = temp;
}
}
return y;
}
int main(void)
{
int n, i;
scanf("%d", &n);
int a[100005];
int l[100000];
int r[100000];
int ans = 0;
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
if (i == 0)
l[i] = a[i];
else
l[i] = gcd(a[i], l[i-1]);
}
for (i = n-1; i >= 0; i--) {
if (i == n-1)
r[i] = a[n-1];
else
r[i] = gcd(a[i], r[i+1]);
}
for (i = 0; i < n-2; i++) {
if (ans < gcd(l[i], r[i+2]))
ans = gcd(l[i], r[i+2]);
}
if (ans < l[n-2])
ans = l[n-2];
if (ans < r[1])
ans = r[1];
printf("%d\n", ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164545/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164545/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
%spec.select14 = tail call i32 @llvm.smax.i32(i32 %x, i32 %y)
br label %while.body
while.body: ; preds = %while.body, %entry
%y.addr.1 = phi i32 [ %spec.select, %entry ], [ %rem, %while.body ]
%x.addr.1 = phi i32 [ %spec.select14, %entry ], [ %y.addr.1, %while.body ]
%rem = srem i32 %x.addr.1, %y.addr.1
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %while.end, label %while.body
while.end: ; preds = %while.body
ret i32 %y.addr.1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%a = alloca [100005 x i32], align 16
%l = alloca [100000 x i32], align 16
%r = alloca [100000 x i32], align 16
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)
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %r) #5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp124 = icmp sgt i32 %0, 0
br i1 %cmp124, label %for.body, label %for.cond37.preheader.thread
for.cond15.preheader: ; preds = %for.inc
%cmp16127 = icmp sgt i32 %5, 0
br i1 %cmp16127, label %for.body17.lr.ph, label %for.cond37.preheader.thread
for.body17.lr.ph: ; preds = %for.cond15.preheader
%sub18 = add nsw i32 %5, -1
%idxprom22 = zext i32 %sub18 to i64
%arrayidx23 = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %idxprom22
%1 = zext i32 %5 to i64
br label %for.body17
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%cmp2 = icmp eq i64 %indvars.iv, 0
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
store i32 %2, ptr %l, align 16, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%3 = add nsw i64 %indvars.iv, -1
%arrayidx10 = getelementptr inbounds [100000 x i32], ptr %l, i64 0, i64 %3
%4 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%spec.select.i = call i32 @llvm.smin.i32(i32 %2, i32 %4)
%spec.select14.i = call i32 @llvm.smax.i32(i32 %2, i32 %4)
br label %while.body.i
while.body.i: ; preds = %while.body.i, %if.else
%y.addr.1.i = phi i32 [ %spec.select.i, %if.else ], [ %rem.i, %while.body.i ]
%x.addr.1.i = phi i32 [ %spec.select14.i, %if.else ], [ %y.addr.1.i, %while.body.i ]
%rem.i = srem i32 %x.addr.1.i, %y.addr.1.i
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %gcd.exit, label %while.body.i
gcd.exit: ; preds = %while.body.i
%arrayidx13 = getelementptr inbounds [100000 x i32], ptr %l, i64 0, i64 %indvars.iv
store i32 %y.addr.1.i, ptr %arrayidx13, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then, %gcd.exit
%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.cond15.preheader, !llvm.loop !9
for.cond37.preheader.thread: ; preds = %for.cond15.preheader, %entry
%.lcssa148.ph = phi i32 [ %5, %for.cond15.preheader ], [ %0, %entry ]
%sub38150 = add i32 %.lcssa148.ph, -2
br label %for.end58
for.cond37.preheader: ; preds = %for.inc35
%sub38 = add i32 %5, -2
%cmp39130 = icmp sgt i32 %5, 2
br i1 %cmp39130, label %for.body40.preheader, label %for.end58
for.body40.preheader: ; preds = %for.cond37.preheader
%wide.trip.count = zext i32 %sub38 to i64
br label %for.body40
for.body17: ; preds = %for.body17.lr.ph, %for.inc35
%indvars.iv138 = phi i64 [ %1, %for.body17.lr.ph ], [ %indvars.iv.next139, %for.inc35 ]
%indvars.iv.next139 = add nsw i64 %indvars.iv138, -1
%cmp19 = icmp eq i64 %indvars.iv138, %1
br i1 %cmp19, label %if.then20, label %if.else26
if.then20: ; preds = %for.body17
%7 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = and i64 %indvars.iv.next139, 4294967295
br label %for.inc35
if.else26: ; preds = %for.body17
%idxprom27 = and i64 %indvars.iv.next139, 4294967295
%arrayidx28 = getelementptr inbounds [100005 x i32], ptr %a, i64 0, i64 %idxprom27
%8 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%arrayidx30 = getelementptr inbounds [100000 x i32], ptr %r, i64 0, i64 %indvars.iv138
%9 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%spec.select.i100 = call i32 @llvm.smin.i32(i32 %8, i32 %9)
%spec.select14.i101 = call i32 @llvm.smax.i32(i32 %8, i32 %9)
br label %while.body.i102
while.body.i102: ; preds = %while.body.i102, %if.else26
%y.addr.1.i103 = phi i32 [ %spec.select.i100, %if.else26 ], [ %rem.i105, %while.body.i102 ]
%x.addr.1.i104 = phi i32 [ %spec.select14.i101, %if.else26 ], [ %y.addr.1.i103, %while.body.i102 ]
%rem.i105 = srem i32 %x.addr.1.i104, %y.addr.1.i103
%cmp1.i106 = icmp eq i32 %rem.i105, 0
br i1 %cmp1.i106, label %for.inc35, label %while.body.i102
for.inc35: ; preds = %while.body.i102, %if.then20
%idxprom24.sink = phi i64 [ %idxprom24, %if.then20 ], [ %idxprom27, %while.body.i102 ]
%.sink = phi i32 [ %7, %if.then20 ], [ %y.addr.1.i103, %while.body.i102 ]
%arrayidx25 = getelementptr inbounds [100000 x i32], ptr %r, i64 0, i64 %idxprom24.sink
store i32 %.sink, ptr %arrayidx25, align 4, !tbaa !5
%cmp16 = icmp sgt i64 %indvars.iv138, 1
br i1 %cmp16, label %for.body17, label %for.cond37.preheader, !llvm.loop !11
for.body40: ; preds = %for.body40.preheader, %for.inc56
%indvars.iv141 = phi i64 [ 0, %for.body40.preheader ], [ %indvars.iv.next142, %for.inc56 ]
%ans.0132 = phi i32 [ 0, %for.body40.preheader ], [ %ans.1, %for.inc56 ]
%arrayidx42 = getelementptr inbounds [100000 x i32], ptr %l, i64 0, i64 %indvars.iv141
%10 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%11 = add nuw nsw i64 %indvars.iv141, 2
%arrayidx45 = getelementptr inbounds [100000 x i32], ptr %r, i64 0, i64 %11
%12 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%spec.select.i108 = call i32 @llvm.smin.i32(i32 %10, i32 %12)
%spec.select14.i109 = call i32 @llvm.smax.i32(i32 %10, i32 %12)
br label %while.body.i110
while.body.i110: ; preds = %while.body.i110, %for.body40
%y.addr.1.i111 = phi i32 [ %spec.select.i108, %for.body40 ], [ %rem.i113, %while.body.i110 ]
%x.addr.1.i112 = phi i32 [ %spec.select14.i109, %for.body40 ], [ %y.addr.1.i111, %while.body.i110 ]
%rem.i113 = srem i32 %x.addr.1.i112, %y.addr.1.i111
%cmp1.i114 = icmp eq i32 %rem.i113, 0
br i1 %cmp1.i114, label %gcd.exit115, label %while.body.i110
gcd.exit115: ; preds = %while.body.i110
%cmp47 = icmp slt i32 %ans.0132, %y.addr.1.i111
br i1 %cmp47, label %while.body.i118, label %for.inc56
while.body.i118: ; preds = %gcd.exit115, %while.body.i118
%y.addr.1.i119 = phi i32 [ %rem.i121, %while.body.i118 ], [ %spec.select.i108, %gcd.exit115 ]
%x.addr.1.i120 = phi i32 [ %y.addr.1.i119, %while.body.i118 ], [ %spec.select14.i109, %gcd.exit115 ]
%rem.i121 = srem i32 %x.addr.1.i120, %y.addr.1.i119
%cmp1.i122 = icmp eq i32 %rem.i121, 0
br i1 %cmp1.i122, label %for.inc56, label %while.body.i118
for.inc56: ; preds = %while.body.i118, %gcd.exit115
%ans.1 = phi i32 [ %ans.0132, %gcd.exit115 ], [ %y.addr.1.i119, %while.body.i118 ]
%indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
%exitcond.not = icmp eq i64 %indvars.iv.next142, %wide.trip.count
br i1 %exitcond.not, label %for.end58, label %for.body40, !llvm.loop !12
for.end58: ; preds = %for.inc56, %for.cond37.preheader.thread, %for.cond37.preheader
%sub38152 = phi i32 [ %sub38, %for.cond37.preheader ], [ %sub38150, %for.cond37.preheader.thread ], [ %sub38, %for.inc56 ]
%ans.0.lcssa = phi i32 [ 0, %for.cond37.preheader ], [ 0, %for.cond37.preheader.thread ], [ %ans.1, %for.inc56 ]
%idxprom60 = sext i32 %sub38152 to i64
%arrayidx61 = getelementptr inbounds [100000 x i32], ptr %l, i64 0, i64 %idxprom60
%13 = load i32, ptr %arrayidx61, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %ans.0.lcssa, i32 %13)
%arrayidx68 = getelementptr inbounds [100000 x i32], ptr %r, i64 0, i64 1
%14 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%ans.3 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %14)
%call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.3)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %l) #5
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %a) #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 speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g;}E;
typedef struct graph{
ll vcnt,ecnt;
E e[400010];//適宜変える
ll id[200010];//適宜変える
}G;
int esort(const void*a,const void*b){
E*p=(E*)a,*q=(E*)b;
if((*p).s<(*q).s)return -1;
if((*p).s>(*q).s)return 1;
if((*p).g<(*q).g)return -1;
return 1;
}
G g;
void readgraph(){
//適宜変える
ll n;
scanf("%lld",&n);
rep(i,0,n-1){
ll x,y;
scanf("%lld%lld",&x,&y);
x--,y--;
g.e[2*i].s=x;
g.e[2*i].g=y;
g.e[2*i+1].s=y;
g.e[2*i+1].g=x;
}
g.vcnt=n;
g.ecnt=2*n-2;
qsort(g.e,g.ecnt,sizeof(E),esort);
int p=0;
rep(i,0,g.vcnt){
while(p<g.ecnt&&g.e[p].s<i)p++;
g.id[i]=p;
}
g.id[g.vcnt]=g.ecnt;//一応番兵
}
ll temp[200010];
ll dfs(ll s){
for(int i=g.id[s];i<g.id[s+1];i++){
if(temp[g.e[i].g]==0){
temp[g.e[i].g]=temp[s]+1;
dfs(g.e[i].g);
}
}
}
int main(){
readgraph();
temp[0]=1;
dfs(0);
ll M=0,Mi;
rep(i,0,g.vcnt){
if(temp[i]>M){
M=temp[i];
Mi=i;
}
}
rep(i,0,g.vcnt)temp[i]=0;
temp[Mi]=1;
dfs(Mi);
rep(i,0,g.vcnt)if(temp[i]>M){
M=temp[i];
Mi=i;
}
// printf("%d ",M);
puts(M%3==2?"Second":"First");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164596/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164596/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.graph = type { i64, i64, [400010 x %struct.edge], [200010 x i64] }
%struct.edge = type { i64, i64 }
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@g = dso_local global %struct.graph zeroinitializer, align 8
@temp = dso_local local_unnamed_addr global [200010 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [7 x i8] c"Second\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"First\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%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 void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #9
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #9
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @pom(i64 noundef %a, i64 noundef %n, i32 noundef %m) local_unnamed_addr #3 {
entry:
%conv = sext i32 %m to i64
%tobool.not16 = icmp eq i64 %n, 0
br i1 %tobool.not16, label %for.end, label %for.body
for.body: ; preds = %entry, %cond.end
%mul4.pn = phi i64 [ %mul4, %cond.end ], [ %a, %entry ]
%x.018 = phi i64 [ %x.1, %cond.end ], [ 1, %entry ]
%n.addr.017 = phi i64 [ %div, %cond.end ], [ %n, %entry ]
%a.addr.019 = srem i64 %mul4.pn, %conv
%and = and i64 %n.addr.017, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %cond.end, label %cond.true
cond.true: ; preds = %for.body
%mul = mul nsw i64 %a.addr.019, %x.018
%rem3 = srem i64 %mul, %conv
br label %cond.end
cond.end: ; preds = %for.body, %cond.true
%x.1 = phi i64 [ %rem3, %cond.true ], [ %x.018, %for.body ]
%mul4 = mul nsw i64 %a.addr.019, %a.addr.019
%div = sdiv i64 %n.addr.017, 2
%n.addr.017.off = add i64 %n.addr.017, 1
%tobool.not = icmp ult i64 %n.addr.017.off, 3
br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %cond.end, %entry
%x.0.lcssa = phi i64 [ 1, %entry ], [ %x.1, %cond.end ]
ret i64 %x.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @esort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !11
%1 = load i64, ptr %b, align 8, !tbaa !11
%cmp = icmp slt i64 %0, %1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %0, %1
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%g = getelementptr inbounds %struct.edge, ptr %a, i64 0, i32 1
%2 = load i64, ptr %g, align 8, !tbaa !13
%g7 = getelementptr inbounds %struct.edge, ptr %b, i64 0, i32 1
%3 = load i64, ptr %g7, align 8, !tbaa !13
%cmp8 = icmp slt i64 %2, %3
%. = select i1 %cmp8, i32 -1, i32 1
br label %cleanup
cleanup: ; preds = %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ %., %if.end6 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @readgraph() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp45 = icmp sgt i64 %0, 1
br i1 %cmp45, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa43 = phi i64 [ %0, %entry ], [ %4, %for.body ]
store i64 %.lcssa43, ptr @g, align 8, !tbaa !14
%mul12 = shl nsw i64 %.lcssa43, 1
%sub13 = add nsw i64 %mul12, -2
store i64 %sub13, ptr getelementptr inbounds (%struct.graph, ptr @g, i64 0, i32 1), align 8, !tbaa !16
call void @qsort(ptr noundef nonnull getelementptr inbounds (%struct.graph, ptr @g, i64 0, i32 2), i64 noundef %sub13, i64 noundef 16, ptr noundef nonnull @esort) #9
%1 = load i64, ptr @g, align 8, !tbaa !14
%cmp1655 = icmp sgt i64 %1, 0
%.pre = load i64, ptr getelementptr inbounds (%struct.graph, ptr @g, i64 0, i32 1), align 8, !tbaa !16
br i1 %cmp1655, label %while.cond.preheader, label %for.cond.cleanup17
for.body: ; preds = %entry, %for.body
%i.046 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #9
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #9
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%2 = load i64, ptr %x, align 8, !tbaa !5
%dec = add nsw i64 %2, -1
%3 = load i64, ptr %y, align 8, !tbaa !5
%dec2 = add nsw i64 %3, -1
%mul = shl nuw nsw i64 %i.046, 1
%arrayidx = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 2, i64 %mul
store i64 %dec, ptr %arrayidx, align 8, !tbaa !11
%g = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 2, i64 %mul, i32 1
store i64 %dec2, ptr %g, align 8, !tbaa !13
%add = or i64 %mul, 1
%arrayidx6 = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 2, i64 %add
store i64 %dec2, ptr %arrayidx6, align 8, !tbaa !11
%g11 = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 2, i64 %add, i32 1
store i64 %dec, ptr %g11, align 8, !tbaa !13
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #9
%inc = add nuw nsw i64 %i.046, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%sub = add nsw i64 %4, -1
%cmp = icmp slt i64 %inc, %sub
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !17
while.cond.preheader: ; preds = %for.cond.cleanup, %while.end
%i14.057 = phi i64 [ %inc29, %while.end ], [ 0, %for.cond.cleanup ]
%p.056 = phi i32 [ %p.1.lcssa, %while.end ], [ 0, %for.cond.cleanup ]
%conv47 = sext i32 %p.056 to i64
%cmp1948 = icmp sgt i64 %.pre, %conv47
br i1 %cmp1948, label %land.rhs, label %while.end
for.cond.cleanup17: ; preds = %while.end, %for.cond.cleanup
%arrayidx31 = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 3, i64 %1
store i64 %.pre, ptr %arrayidx31, align 8, !tbaa !5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #9
ret void
land.rhs: ; preds = %while.cond.preheader, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ %conv47, %while.cond.preheader ]
%arrayidx21 = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 2, i64 %indvars.iv
%5 = load i64, ptr %arrayidx21, align 8, !tbaa !11
%cmp23 = icmp slt i64 %5, %i14.057
br i1 %cmp23, label %while.body, label %while.end.loopexit
while.body: ; preds = %land.rhs
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%cmp19 = icmp sgt i64 %.pre, %indvars.iv.next
br i1 %cmp19, label %land.rhs, label %while.end.loopexit, !llvm.loop !18
while.end.loopexit: ; preds = %while.body, %land.rhs
%conv.lcssa.ph = phi i64 [ %indvars.iv, %land.rhs ], [ %indvars.iv.next, %while.body ]
%p.1.lcssa.ph = trunc i64 %conv.lcssa.ph to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %while.cond.preheader
%p.1.lcssa = phi i32 [ %p.056, %while.cond.preheader ], [ %p.1.lcssa.ph, %while.end.loopexit ]
%conv.lcssa = phi i64 [ %conv47, %while.cond.preheader ], [ %conv.lcssa.ph, %while.end.loopexit ]
%arrayidx27 = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 3, i64 %i14.057
store i64 %conv.lcssa, ptr %arrayidx27, align 8, !tbaa !5
%inc29 = add nuw nsw i64 %i14.057, 1
%exitcond.not = icmp eq i64 %inc29, %1
br i1 %exitcond.not, label %for.cond.cleanup17, label %while.cond.preheader, !llvm.loop !19
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @dfs(i64 noundef %s) local_unnamed_addr #6 {
entry:
%arrayidx = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 3, i64 %s
%0 = load i64, ptr %arrayidx, align 8, !tbaa !5
%add = add nsw i64 %s, 1
%arrayidx2 = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 3, i64 %add
%sext = shl i64 %0, 32
%conv123 = ashr exact i64 %sext, 32
%1 = load i64, ptr %arrayidx2, align 8, !tbaa !5
%cmp24 = icmp sgt i64 %1, %conv123
br i1 %cmp24, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%arrayidx8 = getelementptr inbounds [200010 x i64], ptr @temp, i64 0, i64 %s
br label %for.body
for.cond.cleanup: ; preds = %for.inc, %entry
ret i64 undef
for.body: ; preds = %for.body.lr.ph, %for.inc
%2 = phi i64 [ %1, %for.body.lr.ph ], [ %6, %for.inc ]
%indvars.iv = phi i64 [ %conv123, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%g = getelementptr inbounds %struct.graph, ptr @g, i64 0, i32 2, i64 %indvars.iv, i32 1
%3 = load i64, ptr %g, align 8, !tbaa !13
%arrayidx5 = getelementptr inbounds [200010 x i64], ptr @temp, i64 0, i64 %3
%4 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%cmp6 = icmp eq i64 %4, 0
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.body
%5 = load i64, ptr %arrayidx8, align 8, !tbaa !5
%add9 = add nsw i64 %5, 1
store i64 %add9, ptr %arrayidx5, align 8, !tbaa !5
%call = tail call i64 @dfs(i64 noundef %3)
%.pre = load i64, ptr %arrayidx2, align 8, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%6 = phi i64 [ %2, %for.body ], [ %.pre, %if.then ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%cmp = icmp sgt i64 %6, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !20
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
tail call void @readgraph()
store i64 1, ptr @temp, align 16, !tbaa !5
%call = tail call i64 @dfs(i64 noundef 0)
%0 = load i64, ptr @g, align 8, !tbaa !14
%cmp45 = icmp sgt i64 %0, 0
br i1 %cmp45, label %for.body.preheader, label %for.cond.cleanup6
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %0, 1
%1 = icmp eq i64 %0, 1
br i1 %1, label %for.cond4.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %0, -2
br label %for.body
for.cond4.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%spec.select.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %spec.select.1, %for.body ]
%i.048.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.1, %for.body ]
%Mi.047.unr = phi i64 [ undef, %for.body.preheader ], [ %spec.select43.1, %for.body ]
%M.046.unr = phi i64 [ 0, %for.body.preheader ], [ %spec.select.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond4.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond4.preheader.unr-lcssa
%arrayidx.epil = getelementptr inbounds [200010 x i64], ptr @temp, i64 0, i64 %i.048.unr
%2 = load i64, ptr %arrayidx.epil, align 8, !tbaa !5
%cmp1.epil = icmp sgt i64 %2, %M.046.unr
%spec.select.epil = tail call i64 @llvm.smax.i64(i64 %2, i64 %M.046.unr)
%spec.select43.epil = select i1 %cmp1.epil, i64 %i.048.unr, i64 %Mi.047.unr
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.unr-lcssa, %for.body.epil
%spec.select.lcssa = phi i64 [ %spec.select.lcssa.ph, %for.cond4.preheader.unr-lcssa ], [ %spec.select.epil, %for.body.epil ]
%spec.select43.lcssa = phi i64 [ %Mi.047.unr, %for.cond4.preheader.unr-lcssa ], [ %spec.select43.epil, %for.body.epil ]
br i1 %cmp45, label %for.body7.preheader, label %for.cond.cleanup6
for.body7.preheader: ; preds = %for.cond4.preheader
%3 = shl nuw i64 %0, 3
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @temp, i8 0, i64 %3, i1 false), !tbaa !5
br label %for.cond.cleanup6
for.body: ; preds = %for.body, %for.body.preheader.new
%i.048 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %for.body ]
%Mi.047 = phi i64 [ undef, %for.body.preheader.new ], [ %spec.select43.1, %for.body ]
%M.046 = phi i64 [ 0, %for.body.preheader.new ], [ %spec.select.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds [200010 x i64], ptr @temp, i64 0, i64 %i.048
%4 = load i64, ptr %arrayidx, align 16, !tbaa !5
%cmp1 = icmp sgt i64 %4, %M.046
%spec.select = tail call i64 @llvm.smax.i64(i64 %4, i64 %M.046)
%spec.select43 = select i1 %cmp1, i64 %i.048, i64 %Mi.047
%inc = or i64 %i.048, 1
%arrayidx.1 = getelementptr inbounds [200010 x i64], ptr @temp, i64 0, i64 %inc
%5 = load i64, ptr %arrayidx.1, align 8, !tbaa !5
%cmp1.1 = icmp sgt i64 %5, %spec.select
%spec.select.1 = tail call i64 @llvm.smax.i64(i64 %5, i64 %spec.select)
%spec.select43.1 = select i1 %cmp1.1, i64 %inc, i64 %spec.select43
%inc.1 = add nuw nsw i64 %i.048, 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.cond4.preheader.unr-lcssa, label %for.body, !llvm.loop !21
for.cond.cleanup6: ; preds = %entry, %for.body7.preheader, %for.cond4.preheader
%Mi.0.lcssa61 = phi i64 [ %spec.select43.lcssa, %for.body7.preheader ], [ %spec.select43.lcssa, %for.cond4.preheader ], [ undef, %entry ]
%M.0.lcssa60 = phi i64 [ %spec.select.lcssa, %for.body7.preheader ], [ %spec.select.lcssa, %for.cond4.preheader ], [ 0, %entry ]
%arrayidx12 = getelementptr inbounds [200010 x i64], ptr @temp, i64 0, i64 %Mi.0.lcssa61
store i64 1, ptr %arrayidx12, align 8, !tbaa !5
%call13 = tail call i64 @dfs(i64 noundef %Mi.0.lcssa61)
%6 = load i64, ptr @g, align 8, !tbaa !14
%cmp1653 = icmp sgt i64 %6, 0
br i1 %cmp1653, label %for.body18.preheader, label %for.cond.cleanup17
for.body18.preheader: ; preds = %for.cond.cleanup6
%min.iters.check = icmp ult i64 %6, 4
br i1 %min.iters.check, label %for.body18.preheader64, label %vector.ph
vector.ph: ; preds = %for.body18.preheader
%n.vec = and i64 %6, -4
%minmax.ident.splatinsert = insertelement <2 x i64> poison, i64 %M.0.lcssa60, i64 0
%minmax.ident.splat = shufflevector <2 x i64> %minmax.ident.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %9, %vector.body ]
%vec.phi62 = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %10, %vector.body ]
%7 = getelementptr inbounds [200010 x i64], ptr @temp, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i64, ptr %7, i64 2
%wide.load63 = load <2 x i64>, ptr %8, align 16, !tbaa !5
%9 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %wide.load, <2 x i64> %vec.phi)
%10 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %wide.load63, <2 x i64> %vec.phi62)
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %9, <2 x i64> %10)
%12 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.cond.cleanup17, label %for.body18.preheader64
for.body18.preheader64: ; preds = %for.body18.preheader, %middle.block
%i14.055.ph = phi i64 [ 0, %for.body18.preheader ], [ %n.vec, %middle.block ]
%M.254.ph = phi i64 [ %M.0.lcssa60, %for.body18.preheader ], [ %12, %middle.block ]
br label %for.body18
for.cond.cleanup17: ; preds = %for.body18, %middle.block, %for.cond.cleanup6
%M.2.lcssa = phi i64 [ %M.0.lcssa60, %for.cond.cleanup6 ], [ %12, %middle.block ], [ %spec.select44, %for.body18 ]
%rem = urem i64 %M.2.lcssa, 3
%cmp27 = icmp eq i64 %rem, 2
%cond = select i1 %cmp27, ptr @.str.2, ptr @.str.3
%call28 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
ret i32 0
for.body18: ; preds = %for.body18.preheader64, %for.body18
%i14.055 = phi i64 [ %inc25, %for.body18 ], [ %i14.055.ph, %for.body18.preheader64 ]
%M.254 = phi i64 [ %spec.select44, %for.body18 ], [ %M.254.ph, %for.body18.preheader64 ]
%arrayidx19 = getelementptr inbounds [200010 x i64], ptr @temp, i64 0, i64 %i14.055
%13 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%spec.select44 = tail call i64 @llvm.smax.i64(i64 %13, i64 %M.254)
%inc25 = add nuw nsw i64 %i14.055, 1
%exitcond57.not = icmp eq i64 %inc25, %6
br i1 %exitcond57.not, label %for.cond.cleanup17, label %for.body18, !llvm.loop !25
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #7
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 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"edge", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !6, i64 0}
!15 = !{!"graph", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 6400176}
!16 = !{!15, !6, i64 8}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !23, !24}
!23 = !{!"llvm.loop.isvectorized", i32 1}
!24 = !{!"llvm.loop.unroll.runtime.disable"}
!25 = distinct !{!25, !10, !24, !23}
|
#include <stdio.h>
int main(void){
int n;
long long ans=0;
scanf("%d",&n);
long long a[n],b[n];
for (int i=0; i<n; i++){
scanf("%lld%lld",&a[i],&b[i]);
}
for (int i=n-1; i>=0; i--){
a[i]+=ans;
if (a[i]%b[i]!=0){
ans+=b[i]-(a[i]%b[i]);
}
}
printf("%lld\n",ans);
return 0 ;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164646/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164646/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i64, i64 %4, align 16
%cmp41 = icmp sgt i32 %3, 0
br i1 %cmp41, label %for.body, label %for.cond.cleanup8
for.cond6.preheader: ; preds = %for.body
%cmp743 = icmp sgt i32 %6, 0
br i1 %cmp743, label %for.body9.preheader, label %for.cond.cleanup8
for.body9.preheader: ; preds = %for.cond6.preheader
%5 = zext i32 %6 to i64
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds i64, ptr %vla1, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.cond6.preheader, !llvm.loop !9
for.cond.cleanup8: ; preds = %for.body9, %entry, %for.cond6.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %ans.1, %for.body9 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body9: ; preds = %for.body9.preheader, %for.body9
%indvars.iv49 = phi i64 [ %5, %for.body9.preheader ], [ %indvars.iv.next50, %for.body9 ]
%ans.044 = phi i64 [ 0, %for.body9.preheader ], [ %ans.1, %for.body9 ]
%indvars.iv.next50 = add nsw i64 %indvars.iv49, -1
%idxprom10 = and i64 %indvars.iv.next50, 4294967295
%arrayidx11 = getelementptr inbounds i64, ptr %vla, i64 %idxprom10
%8 = load i64, ptr %arrayidx11, align 8, !tbaa !11
%add = add nsw i64 %8, %ans.044
store i64 %add, ptr %arrayidx11, align 8, !tbaa !11
%arrayidx15 = getelementptr inbounds i64, ptr %vla1, i64 %idxprom10
%9 = load i64, ptr %arrayidx15, align 8, !tbaa !11
%rem = srem i64 %add, %9
%cmp16.not = icmp eq i64 %rem, 0
%sub24 = sub nsw i64 %9, %rem
%add25 = select i1 %cmp16.not, i64 0, i64 %sub24
%ans.1 = add nsw i64 %add25, %ans.044
%cmp7 = icmp ugt i64 %indvars.iv49, 1
br i1 %cmp7, label %for.body9, label %for.cond.cleanup8, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <math.h>
#define N 4
int search(int board[N][N], int min, int limit, int r_0, int c_0, char mv);
int search(int board[N][N], int min, int limit, int r_0, int c_0, char mv)
{
int md_c[4];
int op[4], num[4];
int res[4];
int i;
char dir[5] = "nswe";
if (min == 0) return 0;
for (i = 0; i < 4; i++) {
md_c[i] = min;
res[i] = -1;
}
op[0] = r_0-1;
op[1] = r_0+1;
op[2] = c_0-1;
op[3] = c_0+1;
if (op[0] >= 0) {
if (mv != 's') {
num[0] = board[op[0]][c_0];
md_c[0] -= (int)fabs((num[0]-1)/N - op[0]);
md_c[0] += (int)fabs((num[0]-1)/N - r_0);
}
}
if (op[1] <= N-1) {
if (mv != 'n') {
num[1] = board[op[1]][c_0];
md_c[1] -= (int)fabs((num[1]-1)/N - op[1]);
md_c[1] += (int)fabs((num[1]-1)/N - r_0);
}
}
if (op[2] >= 0) {
if (mv != 'e') {
num[2] = board[r_0][op[2]];
md_c[2] -= (int)fabs((num[2]-1)%N - op[2]);
md_c[2] += (int)fabs((num[2]-1)%N - c_0);
}
}
if (op[3] <= N-1) {
if (mv != 'w') {
num[3] = board[r_0][op[3]];
md_c[3] -= (int)fabs((num[3]-1)%N - op[3]);
md_c[3] += (int)fabs((num[3]-1)%N - c_0);
}
}
for (i = 0; i < 4; i++) {
if (md_c[i] - min == -1) {
if (i / 2 == 0) {
board[op[i]][c_0] = 0;
board[r_0][c_0] = num[i];
res[i] = search(board, md_c[i], limit-1, op[i], c_0, dir[i]);
if (res[i] == -1) {
board[op[i]][c_0] = num[i];
board[r_0][c_0] = 0;
} else res[i]++;
} else {
board[r_0][op[i]] = 0;
board[r_0][c_0] = num[i];
res[i] = search(board, md_c[i], limit-1, r_0, op[i], dir[i]);
if (res[i] == -1) {
board[r_0][op[i]] = num[i];
board[r_0][c_0] = 0;
} else res[i]++;
}
}
if (res[i] != -1) break;
}
for (i = 0; i < 4; i++) {
if (md_c[i] - min == 1) {
if (md_c[i] <= limit - 1) {
if (i / 2 == 0) {
board[op[i]][c_0] = 0;
board[r_0][c_0] = num[i];
res[i] = search(board, md_c[i], limit-1, op[i], c_0, dir[i]);
if (res[i] == -1) {
board[op[i]][c_0] = num[i];
board[r_0][c_0] = 0;
} else res[i]++;
} else {
board[r_0][op[i]] = 0;
board[r_0][c_0] = num[i];
res[i] = search(board, md_c[i], limit-1, r_0, op[i], dir[i]);
if (res[i] == -1) {
board[r_0][op[i]] = num[i];
board[r_0][c_0] = 0;
} else res[i]++;
}
} else res[i] = -1;
}
}
if (res[0] == -1 && res[1] == -1 && res[2] == -1 && res[3] == -1) return -1;
else if (res[0] != -1) return res[0];
else if (res[1] != -1) return res[1];
else if (res[2] != -1) return res[2];
else return res[3];
}
int main(int argc, char *argv[])
{
int board[N][N];
int md;
int i, j, r, c, r_0, c_0, found;
int res;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) scanf("%d", &board[i][j]);
}
md = 0;
for (i = 0; i < N * N; i++) {
found = 0;
for (r = 0; r < N; r++) {
for (c = 0; c < N; c++) {
if (board[r][c] == i) {
if (i == 0) {
r_0 = r;
c_0 = c;
} else md += (int)fabs((i-1)/N - r) + (int)fabs((i-1)%N - c);
found = 1;
break;
}
}
if (found == 1) break;
}
}
for (i = 0; ; i += 2) {
if ((r_0 + c_0) % 2 == 0) {
if (md % 2 == 0) res = search(board, md, md+i, r_0, c_0, 'c');
else res = search(board, md, md+i+1, r_0, c_0, 'c');
} else {
if (md % 2 == 0) res = search(board, md, md+i+1, r_0, c_0, 'c');
else res = search(board, md, md+i, r_0, c_0, 'c');
}
if (res != -1) break;
}
printf("%d\n", res);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164697/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164697/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @search(ptr noundef %board, i32 noundef %min, i32 noundef %limit, i32 noundef %r_0, i32 noundef %c_0, i8 noundef signext %mv) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %min, 0
br i1 %cmp, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %r_0, -1
%add = add nsw i32 %r_0, 1
%sub6 = add nsw i32 %c_0, -1
%add8 = add nsw i32 %c_0, 1
%cmp11 = icmp sgt i32 %r_0, 0
%cmp13 = icmp ne i8 %mv, 115
%or.cond410 = and i1 %cmp11, %cmp13
br i1 %or.cond410, label %if.then15, label %if.end39
if.then15: ; preds = %for.body.preheader
%idxprom17 = zext i32 %sub to i64
%idxprom19 = sext i32 %c_0 to i64
%arrayidx20 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom17, i64 %idxprom19
%0 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%sub23 = add nsw i32 %0, -1
%div = sdiv i32 %sub23, 4
%sub25 = sub nsw i32 %div, %sub
%conv26 = sitofp i32 %sub25 to double
%1 = tail call double @llvm.fabs.f64(double %conv26)
%conv27 = fptosi double %1 to i32
%sub29 = sub i32 %min, %conv27
%sub33 = sub nsw i32 %div, %r_0
%conv34 = sitofp i32 %sub33 to double
%2 = tail call double @llvm.fabs.f64(double %conv34)
%conv35 = fptosi double %2 to i32
%add37 = add nsw i32 %sub29, %conv35
br label %if.end39
if.end39: ; preds = %if.then15, %for.body.preheader
%md_c.sroa.0.0 = phi i32 [ %add37, %if.then15 ], [ %min, %for.body.preheader ]
%num.sroa.0.0 = phi i32 [ %0, %if.then15 ], [ undef, %for.body.preheader ]
%cmp41 = icmp slt i32 %r_0, 3
%cmp45 = icmp ne i8 %mv, 110
%or.cond411 = and i1 %cmp41, %cmp45
br i1 %or.cond411, label %if.then47, label %if.end72
if.then47: ; preds = %if.end39
%idxprom49 = sext i32 %add to i64
%idxprom51 = sext i32 %c_0 to i64
%arrayidx52 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom49, i64 %idxprom51
%3 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%sub55 = add nsw i32 %3, -1
%div56 = sdiv i32 %sub55, 4
%sub58 = sub nsw i32 %div56, %add
%conv59 = sitofp i32 %sub58 to double
%4 = tail call double @llvm.fabs.f64(double %conv59)
%conv60 = fptosi double %4 to i32
%sub62 = sub i32 %min, %conv60
%sub66 = sub nsw i32 %div56, %r_0
%conv67 = sitofp i32 %sub66 to double
%5 = tail call double @llvm.fabs.f64(double %conv67)
%conv68 = fptosi double %5 to i32
%add70 = add nsw i32 %sub62, %conv68
br label %if.end72
if.end72: ; preds = %if.then47, %if.end39
%md_c.sroa.7.0 = phi i32 [ %add70, %if.then47 ], [ %min, %if.end39 ]
%num.sroa.7.0 = phi i32 [ %3, %if.then47 ], [ undef, %if.end39 ]
%cmp74 = icmp sgt i32 %c_0, 0
%cmp78 = icmp ne i8 %mv, 101
%or.cond412 = and i1 %cmp74, %cmp78
br i1 %or.cond412, label %if.then80, label %if.end104
if.then80: ; preds = %if.end72
%idxprom81 = sext i32 %r_0 to i64
%idxprom84 = zext i32 %sub6 to i64
%arrayidx85 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom81, i64 %idxprom84
%6 = load i32, ptr %arrayidx85, align 4, !tbaa !5
%sub88 = add nsw i32 %6, -1
%rem = srem i32 %sub88, 4
%sub90 = sub nsw i32 %rem, %sub6
%conv91 = sitofp i32 %sub90 to double
%7 = tail call double @llvm.fabs.f64(double %conv91)
%conv92 = fptosi double %7 to i32
%sub94 = sub i32 %min, %conv92
%sub98 = sub nsw i32 %rem, %c_0
%conv99 = sitofp i32 %sub98 to double
%8 = tail call double @llvm.fabs.f64(double %conv99)
%conv100 = fptosi double %8 to i32
%add102 = add nsw i32 %sub94, %conv100
br label %if.end104
if.end104: ; preds = %if.then80, %if.end72
%md_c.sroa.12.0 = phi i32 [ %add102, %if.then80 ], [ %min, %if.end72 ]
%num.sroa.12.0 = phi i32 [ %6, %if.then80 ], [ undef, %if.end72 ]
%cmp106 = icmp slt i32 %c_0, 3
%cmp110 = icmp ne i8 %mv, 119
%or.cond413 = and i1 %cmp106, %cmp110
%idxprom113 = sext i32 %r_0 to i64
br i1 %or.cond413, label %if.then112, label %if.end137
if.then112: ; preds = %if.end104
%idxprom116 = sext i32 %add8 to i64
%arrayidx117 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom113, i64 %idxprom116
%9 = load i32, ptr %arrayidx117, align 4, !tbaa !5
%sub120 = add nsw i32 %9, -1
%rem121 = srem i32 %sub120, 4
%sub123 = sub nsw i32 %rem121, %add8
%conv124 = sitofp i32 %sub123 to double
%10 = tail call double @llvm.fabs.f64(double %conv124)
%conv125 = fptosi double %10 to i32
%sub127 = sub i32 %min, %conv125
%sub131 = sub nsw i32 %rem121, %c_0
%conv132 = sitofp i32 %sub131 to double
%11 = tail call double @llvm.fabs.f64(double %conv132)
%conv133 = fptosi double %11 to i32
%add135 = add nsw i32 %sub127, %conv133
br label %if.end137
if.end137: ; preds = %if.end104, %if.then112
%md_c.sroa.17.0 = phi i32 [ %add135, %if.then112 ], [ %min, %if.end104 ]
%num.sroa.17.0 = phi i32 [ %9, %if.then112 ], [ undef, %if.end104 ]
%idxprom205 = sext i32 %c_0 to i64
%arrayidx206 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom113, i64 %idxprom205
%sub209 = add nsw i32 %limit, -1
%sub144 = sub nsw i32 %md_c.sroa.0.0, %min
%cmp145 = icmp eq i32 %sub144, -1
br i1 %cmp145, label %if.then151, label %for.cond138
for.cond138: ; preds = %if.end137, %if.then177, %if.end240
%sub144.1 = sub nsw i32 %md_c.sroa.7.0, %min
%cmp145.1 = icmp eq i32 %sub144.1, -1
br i1 %cmp145.1, label %if.then151.1, label %for.cond138.1
if.then151.1: ; preds = %for.cond138
%idxprom154.1 = sext i32 %add to i64
%arrayidx157.1 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom154.1, i64 %idxprom205
store i32 0, ptr %arrayidx157.1, align 4, !tbaa !5
store i32 %num.sroa.7.0, ptr %arrayidx206, align 4, !tbaa !5
%call.1 = tail call i32 @search(ptr noundef %board, i32 noundef %md_c.sroa.7.0, i32 noundef %sub209, i32 noundef %add, i32 noundef %c_0, i8 noundef signext 115)
%cmp175.1 = icmp eq i32 %call.1, -1
br i1 %cmp175.1, label %if.then177.1, label %if.end240.1
if.then177.1: ; preds = %if.then151.1
store i32 %num.sroa.7.0, ptr %arrayidx157.1, align 4, !tbaa !5
store i32 0, ptr %arrayidx206, align 4, !tbaa !5
br label %for.cond138.1
if.end240.1: ; preds = %if.then151.1
%inc192.1 = add nuw nsw i32 %call.1, 1
%cmp243.not.1 = icmp eq i32 %inc192.1, -1
br i1 %cmp243.not.1, label %for.cond138.1, label %for.end249
for.cond138.1: ; preds = %for.cond138, %if.then177.1, %if.end240.1
%sub144.2 = sub nsw i32 %md_c.sroa.12.0, %min
%cmp145.2 = icmp eq i32 %sub144.2, -1
br i1 %cmp145.2, label %if.else194.2, label %for.cond138.2
if.else194.2: ; preds = %for.cond138.1
%idxprom199.2 = sext i32 %sub6 to i64
%arrayidx200.2 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom113, i64 %idxprom199.2
store i32 0, ptr %arrayidx200.2, align 4, !tbaa !5
store i32 %num.sroa.12.0, ptr %arrayidx206, align 4, !tbaa !5
%call214.2 = tail call i32 @search(ptr noundef %board, i32 noundef %md_c.sroa.12.0, i32 noundef %sub209, i32 noundef %r_0, i32 noundef %sub6, i8 noundef signext 119)
%cmp219.2 = icmp eq i32 %call214.2, -1
br i1 %cmp219.2, label %if.then221.2, label %if.end240.2
if.then221.2: ; preds = %if.else194.2
store i32 %num.sroa.12.0, ptr %arrayidx200.2, align 4, !tbaa !5
store i32 0, ptr %arrayidx206, align 4, !tbaa !5
br label %for.cond138.2
if.end240.2: ; preds = %if.else194.2
%inc237.2 = add nuw nsw i32 %call214.2, 1
%cmp243.not.2 = icmp eq i32 %inc237.2, -1
br i1 %cmp243.not.2, label %for.cond138.2, label %for.end249
for.cond138.2: ; preds = %for.cond138.1, %if.then221.2, %if.end240.2
%sub144.3 = sub nsw i32 %md_c.sroa.17.0, %min
%cmp145.3 = icmp eq i32 %sub144.3, -1
br i1 %cmp145.3, label %if.else194.3, label %for.cond138.3
if.else194.3: ; preds = %for.cond138.2
%idxprom199.3 = sext i32 %add8 to i64
%arrayidx200.3 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom113, i64 %idxprom199.3
store i32 0, ptr %arrayidx200.3, align 4, !tbaa !5
store i32 %num.sroa.17.0, ptr %arrayidx206, align 4, !tbaa !5
%call214.3 = tail call i32 @search(ptr noundef %board, i32 noundef %md_c.sroa.17.0, i32 noundef %sub209, i32 noundef %r_0, i32 noundef %add8, i8 noundef signext 101)
%cmp219.3 = icmp eq i32 %call214.3, -1
br i1 %cmp219.3, label %if.then221.3, label %if.end240.3
if.then221.3: ; preds = %if.else194.3
store i32 %num.sroa.17.0, ptr %arrayidx200.3, align 4, !tbaa !5
store i32 0, ptr %arrayidx206, align 4, !tbaa !5
br label %for.cond138.3
if.end240.3: ; preds = %if.else194.3
%inc237.3 = add nuw nsw i32 %call214.3, 1
%cmp243.not.3 = icmp eq i32 %inc237.3, -1
br i1 %cmp243.not.3, label %for.cond138.3, label %for.end249
for.cond138.3: ; preds = %for.cond138.2, %if.then221.3, %if.end240.3
br label %for.end249
if.then151: ; preds = %if.end137
%idxprom154 = sext i32 %sub to i64
%arrayidx157 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom154, i64 %idxprom205
store i32 0, ptr %arrayidx157, align 4, !tbaa !5
store i32 %num.sroa.0.0, ptr %arrayidx206, align 4, !tbaa !5
%call = tail call i32 @search(ptr noundef %board, i32 noundef %md_c.sroa.0.0, i32 noundef %sub209, i32 noundef %sub, i32 noundef %c_0, i8 noundef signext 110)
%cmp175 = icmp eq i32 %call, -1
br i1 %cmp175, label %if.then177, label %if.end240
if.then177: ; preds = %if.then151
store i32 %num.sroa.0.0, ptr %arrayidx157, align 4, !tbaa !5
store i32 0, ptr %arrayidx206, align 4, !tbaa !5
br label %for.cond138
if.end240: ; preds = %if.then151
%inc192 = add nuw nsw i32 %call, 1
%cmp243.not = icmp eq i32 %inc192, -1
br i1 %cmp243.not, label %for.cond138, label %for.inc365
for.end249: ; preds = %for.cond138.3, %if.end240.3, %if.end240.2, %if.end240.1
%res.sroa.14.1 = phi i32 [ -1, %for.cond138.3 ], [ -1, %if.end240.3 ], [ -1, %if.end240.2 ], [ %inc192.1, %if.end240.1 ]
%res.sroa.25.1 = phi i32 [ -1, %for.cond138.3 ], [ -1, %if.end240.3 ], [ %inc237.2, %if.end240.2 ], [ -1, %if.end240.1 ]
%res.sroa.36.1 = phi i32 [ -1, %for.cond138.3 ], [ %inc237.3, %if.end240.3 ], [ -1, %if.end240.2 ], [ -1, %if.end240.1 ]
%cmp257 = icmp eq i32 %sub144, 1
%cmp263.not.not = icmp slt i32 %md_c.sroa.0.0, %limit
%or.cond610 = and i1 %cmp257, %cmp263.not.not
br i1 %or.cond610, label %if.then269, label %for.inc365
if.then269: ; preds = %for.end249
%idxprom272 = sext i32 %sub to i64
%arrayidx275 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom272, i64 %idxprom205
store i32 0, ptr %arrayidx275, align 4, !tbaa !5
store i32 %num.sroa.0.0, ptr %arrayidx206, align 4, !tbaa !5
%call289 = tail call i32 @search(ptr noundef %board, i32 noundef %md_c.sroa.0.0, i32 noundef %sub209, i32 noundef %sub, i32 noundef %c_0, i8 noundef signext 110)
%cmp294 = icmp eq i32 %call289, -1
br i1 %cmp294, label %if.then296, label %if.else309
if.then296: ; preds = %if.then269
store i32 %num.sroa.0.0, ptr %arrayidx275, align 4, !tbaa !5
store i32 0, ptr %arrayidx206, align 4, !tbaa !5
br label %for.inc365
if.else309: ; preds = %if.then269
%inc312 = add nuw nsw i32 %call289, 1
br label %for.inc365
for.inc365: ; preds = %if.end240, %for.end249, %if.else309, %if.then296
%res.sroa.36.1609 = phi i32 [ %res.sroa.36.1, %if.then296 ], [ %res.sroa.36.1, %if.else309 ], [ %res.sroa.36.1, %for.end249 ], [ -1, %if.end240 ]
%res.sroa.25.1608 = phi i32 [ %res.sroa.25.1, %if.then296 ], [ %res.sroa.25.1, %if.else309 ], [ %res.sroa.25.1, %for.end249 ], [ -1, %if.end240 ]
%res.sroa.14.1607 = phi i32 [ %res.sroa.14.1, %if.then296 ], [ %res.sroa.14.1, %if.else309 ], [ %res.sroa.14.1, %for.end249 ], [ -1, %if.end240 ]
%res.sroa.0.1 = phi i32 [ -1, %if.then296 ], [ %inc312, %if.else309 ], [ -1, %for.end249 ], [ %inc192, %if.end240 ]
%sub256.1 = sub nsw i32 %md_c.sroa.7.0, %min
%cmp257.1 = icmp eq i32 %sub256.1, 1
br i1 %cmp257.1, label %if.then259.1, label %for.inc365.1
if.then259.1: ; preds = %for.inc365
%cmp263.not.not.1 = icmp slt i32 %md_c.sroa.7.0, %limit
br i1 %cmp263.not.not.1, label %if.then269.1, label %for.inc365.1
if.then269.1: ; preds = %if.then259.1
%idxprom272.1 = sext i32 %add to i64
%arrayidx275.1 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom272.1, i64 %idxprom205
store i32 0, ptr %arrayidx275.1, align 4, !tbaa !5
store i32 %num.sroa.7.0, ptr %arrayidx206, align 4, !tbaa !5
%call289.1 = tail call i32 @search(ptr noundef %board, i32 noundef %md_c.sroa.7.0, i32 noundef %sub209, i32 noundef %add, i32 noundef %c_0, i8 noundef signext 115)
%cmp294.1 = icmp eq i32 %call289.1, -1
br i1 %cmp294.1, label %if.then296.1, label %if.else309.1
if.else309.1: ; preds = %if.then269.1
%inc312.1 = add nuw nsw i32 %call289.1, 1
br label %for.inc365.1
if.then296.1: ; preds = %if.then269.1
store i32 %num.sroa.7.0, ptr %arrayidx275.1, align 4, !tbaa !5
store i32 0, ptr %arrayidx206, align 4, !tbaa !5
br label %for.inc365.1
for.inc365.1: ; preds = %if.then259.1, %if.then296.1, %if.else309.1, %for.inc365
%res.sroa.14.2 = phi i32 [ -1, %if.then296.1 ], [ %inc312.1, %if.else309.1 ], [ %res.sroa.14.1607, %for.inc365 ], [ -1, %if.then259.1 ]
%sub256.2 = sub nsw i32 %md_c.sroa.12.0, %min
%cmp257.2 = icmp eq i32 %sub256.2, 1
br i1 %cmp257.2, label %if.then259.2, label %for.inc365.2
if.then259.2: ; preds = %for.inc365.1
%cmp263.not.not.2 = icmp slt i32 %md_c.sroa.12.0, %limit
br i1 %cmp263.not.not.2, label %if.else314.2, label %for.inc365.2
if.else314.2: ; preds = %if.then259.2
%idxprom319.2 = sext i32 %sub6 to i64
%arrayidx320.2 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom113, i64 %idxprom319.2
store i32 0, ptr %arrayidx320.2, align 4, !tbaa !5
store i32 %num.sroa.12.0, ptr %arrayidx206, align 4, !tbaa !5
%call334.2 = tail call i32 @search(ptr noundef %board, i32 noundef %md_c.sroa.12.0, i32 noundef %sub209, i32 noundef %r_0, i32 noundef %sub6, i8 noundef signext 119)
%cmp339.2 = icmp eq i32 %call334.2, -1
br i1 %cmp339.2, label %if.then341.2, label %if.else354.2
if.else354.2: ; preds = %if.else314.2
%inc357.2 = add nuw nsw i32 %call334.2, 1
br label %for.inc365.2
if.then341.2: ; preds = %if.else314.2
store i32 %num.sroa.12.0, ptr %arrayidx320.2, align 4, !tbaa !5
store i32 0, ptr %arrayidx206, align 4, !tbaa !5
br label %for.inc365.2
for.inc365.2: ; preds = %if.then259.2, %if.then341.2, %if.else354.2, %for.inc365.1
%res.sroa.25.2 = phi i32 [ -1, %if.then341.2 ], [ %inc357.2, %if.else354.2 ], [ %res.sroa.25.1608, %for.inc365.1 ], [ -1, %if.then259.2 ]
%sub256.3 = sub nsw i32 %md_c.sroa.17.0, %min
%cmp257.3 = icmp eq i32 %sub256.3, 1
br i1 %cmp257.3, label %if.then259.3, label %for.inc365.3
if.then259.3: ; preds = %for.inc365.2
%cmp263.not.not.3 = icmp slt i32 %md_c.sroa.17.0, %limit
br i1 %cmp263.not.not.3, label %if.else314.3, label %for.inc365.3
if.else314.3: ; preds = %if.then259.3
%idxprom319.3 = sext i32 %add8 to i64
%arrayidx320.3 = getelementptr inbounds [4 x i32], ptr %board, i64 %idxprom113, i64 %idxprom319.3
store i32 0, ptr %arrayidx320.3, align 4, !tbaa !5
store i32 %num.sroa.17.0, ptr %arrayidx206, align 4, !tbaa !5
%call334.3 = tail call i32 @search(ptr noundef %board, i32 noundef %md_c.sroa.17.0, i32 noundef %sub209, i32 noundef %r_0, i32 noundef %add8, i8 noundef signext 101)
%cmp339.3 = icmp eq i32 %call334.3, -1
br i1 %cmp339.3, label %if.then341.3, label %if.else354.3
if.else354.3: ; preds = %if.else314.3
%inc357.3 = add nuw nsw i32 %call334.3, 1
br label %for.inc365.3
if.then341.3: ; preds = %if.else314.3
store i32 %num.sroa.17.0, ptr %arrayidx320.3, align 4, !tbaa !5
store i32 0, ptr %arrayidx206, align 4, !tbaa !5
br label %for.inc365.3
for.inc365.3: ; preds = %if.then259.3, %if.then341.3, %if.else354.3, %for.inc365.2
%res.sroa.36.2 = phi i32 [ -1, %if.then341.3 ], [ %inc357.3, %if.else354.3 ], [ %res.sroa.36.1609, %for.inc365.2 ], [ -1, %if.then259.3 ]
%cmp369 = icmp eq i32 %res.sroa.0.1, -1
%cmp372 = icmp eq i32 %res.sroa.14.2, -1
%or.cond = select i1 %cmp369, i1 %cmp372, i1 false
%cmp376 = icmp eq i32 %res.sroa.25.2, -1
%or.cond408 = select i1 %or.cond, i1 %cmp376, i1 false
%cmp380 = icmp eq i32 %res.sroa.36.2, -1
%or.cond409 = select i1 %or.cond408, i1 %cmp380, i1 false
%cmp369.not = xor i1 %cmp369, true
%brmerge = or i1 %or.cond409, %cmp369.not
%.mux = select i1 %or.cond409, i32 -1, i32 %res.sroa.0.1
br i1 %brmerge, label %cleanup, label %if.else389
if.else389: ; preds = %for.inc365.3
%. = select i1 %cmp376, i32 %res.sroa.36.2, i32 %res.sroa.25.2
%spec.select = select i1 %cmp372, i32 %., i32 %res.sroa.14.2
br label %cleanup
cleanup: ; preds = %if.else389, %for.inc365.3, %entry
%retval.0 = phi i32 [ 0, %entry ], [ %.mux, %for.inc365.3 ], [ %spec.select, %if.else389 ]
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 speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #3 {
entry:
%board = alloca [4 x [4 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %board) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %board)
%arrayidx5.1 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%arrayidx5.2 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2)
%arrayidx5.3 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3)
%arrayidx5.1159 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 1, i64 0
%call.1160 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1159)
%arrayidx5.1.1 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 1, i64 1
%call.1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1.1)
%arrayidx5.2.1 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 1, i64 2
%call.2.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2.1)
%arrayidx5.3.1 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 1, i64 3
%call.3.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3.1)
%arrayidx5.2161 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 2, i64 0
%call.2162 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2161)
%arrayidx5.1.2 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 2, i64 1
%call.1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1.2)
%arrayidx5.2.2 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 2, i64 2
%call.2.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2.2)
%arrayidx5.3.2 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 2, i64 3
%call.3.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3.2)
%arrayidx5.3163 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 3, i64 0
%call.3164 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3163)
%arrayidx5.1.3 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 3, i64 1
%call.1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1.3)
%arrayidx5.2.3 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 3, i64 2
%call.2.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2.3)
%arrayidx5.3.3 = getelementptr inbounds [4 x [4 x i32]], ptr %board, i64 0, i64 3, i64 3
%call.3.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3.3)
%0 = load i32, ptr %board, align 16, !tbaa !5
%cmp22.peel = icmp eq i32 %0, 0
br i1 %cmp22.peel, label %for.cond12.preheader.peel.next, label %for.inc33.peel
for.inc33.peel: ; preds = %entry
%1 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%cmp22.1.peel = icmp eq i32 %1, 0
br i1 %cmp22.1.peel, label %for.cond12.preheader.peel.next, label %for.inc33.1.peel
for.inc33.1.peel: ; preds = %for.inc33.peel
%2 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%cmp22.2.peel = icmp eq i32 %2, 0
br i1 %cmp22.2.peel, label %for.cond12.preheader.peel.next, label %for.inc33.2.peel
for.inc33.2.peel: ; preds = %for.inc33.1.peel
%3 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%cmp22.3.peel = icmp eq i32 %3, 0
br i1 %cmp22.3.peel, label %for.cond12.preheader.peel.next, label %for.inc33.3.peel
for.inc33.3.peel: ; preds = %for.inc33.2.peel
%4 = load i32, ptr %arrayidx5.1159, align 16, !tbaa !5
%cmp22.1168.peel = icmp eq i32 %4, 0
br i1 %cmp22.1168.peel, label %for.cond12.preheader.peel.next, label %for.inc33.1169.peel
for.inc33.1169.peel: ; preds = %for.inc33.3.peel
%5 = load i32, ptr %arrayidx5.1.1, align 4, !tbaa !5
%cmp22.1.1.peel = icmp eq i32 %5, 0
br i1 %cmp22.1.1.peel, label %for.cond12.preheader.peel.next, label %for.inc33.1.1.peel
for.inc33.1.1.peel: ; preds = %for.inc33.1169.peel
%6 = load i32, ptr %arrayidx5.2.1, align 8, !tbaa !5
%cmp22.2.1.peel = icmp eq i32 %6, 0
br i1 %cmp22.2.1.peel, label %for.cond12.preheader.peel.next, label %for.inc33.2.1.peel
for.inc33.2.1.peel: ; preds = %for.inc33.1.1.peel
%7 = load i32, ptr %arrayidx5.3.1, align 4, !tbaa !5
%cmp22.3.1.peel = icmp eq i32 %7, 0
br i1 %cmp22.3.1.peel, label %for.cond12.preheader.peel.next, label %for.inc33.3.1.peel
for.inc33.3.1.peel: ; preds = %for.inc33.2.1.peel
%8 = load i32, ptr %arrayidx5.2161, align 16, !tbaa !5
%cmp22.2171.peel = icmp eq i32 %8, 0
br i1 %cmp22.2171.peel, label %for.cond12.preheader.peel.next, label %for.inc33.2172.peel
for.inc33.2172.peel: ; preds = %for.inc33.3.1.peel
%9 = load i32, ptr %arrayidx5.1.2, align 4, !tbaa !5
%cmp22.1.2.peel = icmp eq i32 %9, 0
br i1 %cmp22.1.2.peel, label %for.cond12.preheader.peel.next, label %for.inc33.1.2.peel
for.inc33.1.2.peel: ; preds = %for.inc33.2172.peel
%10 = load i32, ptr %arrayidx5.2.2, align 8, !tbaa !5
%cmp22.2.2.peel = icmp eq i32 %10, 0
br i1 %cmp22.2.2.peel, label %for.cond12.preheader.peel.next, label %for.inc33.2.2.peel
for.inc33.2.2.peel: ; preds = %for.inc33.1.2.peel
%11 = load i32, ptr %arrayidx5.3.2, align 4, !tbaa !5
%cmp22.3.2.peel = icmp eq i32 %11, 0
br i1 %cmp22.3.2.peel, label %for.cond12.preheader.peel.next, label %for.inc33.3.2.peel
for.inc33.3.2.peel: ; preds = %for.inc33.2.2.peel
%12 = load i32, ptr %arrayidx5.3163, align 16, !tbaa !5
%cmp22.3174.peel = icmp eq i32 %12, 0
br i1 %cmp22.3174.peel, label %for.cond12.preheader.peel.next, label %for.inc33.3175.peel
for.inc33.3175.peel: ; preds = %for.inc33.3.2.peel
%13 = load i32, ptr %arrayidx5.1.3, align 4, !tbaa !5
%cmp22.1.3.peel = icmp eq i32 %13, 0
br i1 %cmp22.1.3.peel, label %for.cond12.preheader.peel.next, label %for.inc33.1.3.peel
for.inc33.1.3.peel: ; preds = %for.inc33.3175.peel
%14 = load i32, ptr %arrayidx5.2.3, align 8, !tbaa !5
%cmp22.2.3.peel = icmp eq i32 %14, 0
%spec.select = select i1 %cmp22.2.3.peel, i32 2, i32 3
br label %for.cond12.preheader.peel.next
for.cond12.preheader.peel.next: ; preds = %for.inc33.1.3.peel, %for.inc33.3175.peel, %for.inc33.3.2.peel, %for.inc33.2.2.peel, %for.inc33.1.2.peel, %for.inc33.2172.peel, %for.inc33.3.1.peel, %for.inc33.2.1.peel, %for.inc33.1.1.peel, %for.inc33.1169.peel, %for.inc33.3.peel, %for.inc33.2.peel, %for.inc33.1.peel, %for.inc33.peel, %entry
%r_0.4.peel = phi i32 [ 0, %entry ], [ 0, %for.inc33.peel ], [ 0, %for.inc33.1.peel ], [ 0, %for.inc33.2.peel ], [ 1, %for.inc33.3.peel ], [ 1, %for.inc33.1169.peel ], [ 1, %for.inc33.1.1.peel ], [ 1, %for.inc33.2.1.peel ], [ 2, %for.inc33.3.1.peel ], [ 2, %for.inc33.2172.peel ], [ 2, %for.inc33.1.2.peel ], [ 2, %for.inc33.2.2.peel ], [ 3, %for.inc33.3.2.peel ], [ 3, %for.inc33.3175.peel ], [ 3, %for.inc33.1.3.peel ]
%c_0.4.peel = phi i32 [ 0, %entry ], [ 1, %for.inc33.peel ], [ 2, %for.inc33.1.peel ], [ 3, %for.inc33.2.peel ], [ 0, %for.inc33.3.peel ], [ 1, %for.inc33.1169.peel ], [ 2, %for.inc33.1.1.peel ], [ 3, %for.inc33.2.1.peel ], [ 0, %for.inc33.3.1.peel ], [ 1, %for.inc33.2172.peel ], [ 2, %for.inc33.1.2.peel ], [ 3, %for.inc33.2.2.peel ], [ 0, %for.inc33.3.2.peel ], [ 1, %for.inc33.3175.peel ], [ %spec.select, %for.inc33.1.3.peel ]
%15 = load i32, ptr %arrayidx5.1, align 4
%16 = load i32, ptr %arrayidx5.2, align 8
%17 = load i32, ptr %arrayidx5.3, align 4
%18 = load i32, ptr %arrayidx5.1159, align 16
%19 = load i32, ptr %arrayidx5.1.1, align 4
%20 = load i32, ptr %arrayidx5.2.1, align 8
%21 = load i32, ptr %arrayidx5.3.1, align 4
%22 = load i32, ptr %arrayidx5.2161, align 16
%23 = load i32, ptr %arrayidx5.1.2, align 4
%24 = load i32, ptr %arrayidx5.2.2, align 8
%25 = load i32, ptr %arrayidx5.3.2, align 4
%26 = load i32, ptr %arrayidx5.3163, align 16
%27 = load i32, ptr %arrayidx5.1.3, align 4
%28 = load i32, ptr %arrayidx5.2.3, align 8
%29 = load i32, ptr %arrayidx5.3.3, align 4
br label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.cond12.preheader.peel.next, %for.inc43
%i.1139 = phi i32 [ %inc44, %for.inc43 ], [ 1, %for.cond12.preheader.peel.next ]
%md.0138 = phi i32 [ %md.4, %for.inc43 ], [ 0, %for.cond12.preheader.peel.next ]
%cmp22 = icmp eq i32 %0, %i.1139
br i1 %cmp22, label %if.else, label %for.inc33
for.cond46.preheader: ; preds = %for.inc43
%add47 = add nuw nsw i32 %c_0.4.peel, %r_0.4.peel
%30 = and i32 %add47, 1
%cmp49 = icmp eq i32 %30, 0
%add70 = add i32 %md.4, 1
%31 = and i32 %md.4, 1
%cmp53 = icmp eq i32 %31, 0
br i1 %cmp49, label %for.cond46.preheader.split.us, label %for.cond46.preheader.split
for.cond46.preheader.split.us: ; preds = %for.cond46.preheader
br i1 %cmp53, label %for.cond46.us.us, label %for.cond46.us
for.cond46.us.us: ; preds = %for.cond46.preheader.split.us, %for.cond46.us.us
%i.2.us.us = phi i32 [ %add84.us.us, %for.cond46.us.us ], [ 0, %for.cond46.preheader.split.us ]
%add56.us.us = add nsw i32 %i.2.us.us, %md.4
%call57.us.us = call i32 @search(ptr noundef nonnull %board, i32 noundef %md.4, i32 noundef %add56.us.us, i32 noundef %r_0.4.peel, i32 noundef %c_0.4.peel, i8 noundef signext 99)
%cmp79.not.us.us = icmp eq i32 %call57.us.us, -1
%add84.us.us = add nuw nsw i32 %i.2.us.us, 2
br i1 %cmp79.not.us.us, label %for.cond46.us.us, label %for.end85
for.cond46.us: ; preds = %for.cond46.preheader.split.us, %for.cond46.us
%i.2.us = phi i32 [ %add84.us, %for.cond46.us ], [ 0, %for.cond46.preheader.split.us ]
%add61.us = add i32 %add70, %i.2.us
%call62.us = call i32 @search(ptr noundef nonnull %board, i32 noundef %md.4, i32 noundef %add61.us, i32 noundef %r_0.4.peel, i32 noundef %c_0.4.peel, i8 noundef signext 99)
%cmp79.not.us = icmp eq i32 %call62.us, -1
%add84.us = add nuw nsw i32 %i.2.us, 2
br i1 %cmp79.not.us, label %for.cond46.us, label %for.end85
for.cond46.preheader.split: ; preds = %for.cond46.preheader
br i1 %cmp53, label %for.cond46.us142, label %for.cond46
for.cond46.us142: ; preds = %for.cond46.preheader.split, %for.cond46.us142
%i.2.us143 = phi i32 [ %add84.us147, %for.cond46.us142 ], [ 0, %for.cond46.preheader.split ]
%add71.us = add i32 %add70, %i.2.us143
%call72.us = call i32 @search(ptr noundef nonnull %board, i32 noundef %md.4, i32 noundef %add71.us, i32 noundef %r_0.4.peel, i32 noundef %c_0.4.peel, i8 noundef signext 99)
%cmp79.not.us146 = icmp eq i32 %call72.us, -1
%add84.us147 = add nuw nsw i32 %i.2.us143, 2
br i1 %cmp79.not.us146, label %for.cond46.us142, label %for.end85
if.else: ; preds = %for.cond12.preheader, %for.inc33, %for.inc33.1, %for.inc33.2, %for.inc33.3, %for.inc33.1169, %for.inc33.1.1, %for.inc33.2.1, %for.inc33.3.1, %for.inc33.2172, %for.inc33.1.2, %for.inc33.2.2, %for.inc33.3.2, %for.inc33.3175, %for.inc33.1.3, %for.inc33.2.3
%r.0137.lcssa.neg = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.inc33 ], [ 0, %for.inc33.1 ], [ 0, %for.inc33.2 ], [ -1, %for.inc33.3 ], [ -1, %for.inc33.1169 ], [ -1, %for.inc33.1.1 ], [ -1, %for.inc33.2.1 ], [ -2, %for.inc33.3.1 ], [ -2, %for.inc33.2172 ], [ -2, %for.inc33.1.2 ], [ -2, %for.inc33.2.2 ], [ -3, %for.inc33.3.2 ], [ -3, %for.inc33.3175 ], [ -3, %for.inc33.1.3 ], [ -3, %for.inc33.2.3 ]
%c.0136.lcssa.wide.neg = phi i32 [ 0, %for.cond12.preheader ], [ -1, %for.inc33 ], [ -2, %for.inc33.1 ], [ -3, %for.inc33.2 ], [ 0, %for.inc33.3 ], [ -1, %for.inc33.1169 ], [ -2, %for.inc33.1.1 ], [ -3, %for.inc33.2.1 ], [ 0, %for.inc33.3.1 ], [ -1, %for.inc33.2172 ], [ -2, %for.inc33.1.2 ], [ -3, %for.inc33.2.2 ], [ 0, %for.inc33.3.2 ], [ -1, %for.inc33.3175 ], [ -2, %for.inc33.1.3 ], [ -3, %for.inc33.2.3 ]
%sub = add nsw i32 %i.1139, -1
%div.udiv177 = lshr i32 %sub, 2
%sub25 = add nsw i32 %r.0137.lcssa.neg, %div.udiv177
%conv = sitofp i32 %sub25 to double
%32 = call double @llvm.fabs.f64(double %conv)
%conv26 = fptosi double %32 to i32
%rem.urem = and i32 %sub, 3
%sub28 = add nsw i32 %c.0136.lcssa.wide.neg, %rem.urem
%conv29 = sitofp i32 %sub28 to double
%33 = call double @llvm.fabs.f64(double %conv29)
%conv30 = fptosi double %33 to i32
%add = add i32 %md.0138, %conv26
%add31 = add i32 %add, %conv30
br label %for.inc43
for.inc33: ; preds = %for.cond12.preheader
%cmp22.1 = icmp eq i32 %15, %i.1139
br i1 %cmp22.1, label %if.else, label %for.inc33.1
for.inc33.1: ; preds = %for.inc33
%cmp22.2 = icmp eq i32 %16, %i.1139
br i1 %cmp22.2, label %if.else, label %for.inc33.2
for.inc33.2: ; preds = %for.inc33.1
%cmp22.3 = icmp eq i32 %17, %i.1139
br i1 %cmp22.3, label %if.else, label %for.inc33.3
for.inc33.3: ; preds = %for.inc33.2
%cmp22.1168 = icmp eq i32 %18, %i.1139
br i1 %cmp22.1168, label %if.else, label %for.inc33.1169
for.inc33.1169: ; preds = %for.inc33.3
%cmp22.1.1 = icmp eq i32 %19, %i.1139
br i1 %cmp22.1.1, label %if.else, label %for.inc33.1.1
for.inc33.1.1: ; preds = %for.inc33.1169
%cmp22.2.1 = icmp eq i32 %20, %i.1139
br i1 %cmp22.2.1, label %if.else, label %for.inc33.2.1
for.inc33.2.1: ; preds = %for.inc33.1.1
%cmp22.3.1 = icmp eq i32 %21, %i.1139
br i1 %cmp22.3.1, label %if.else, label %for.inc33.3.1
for.inc33.3.1: ; preds = %for.inc33.2.1
%cmp22.2171 = icmp eq i32 %22, %i.1139
br i1 %cmp22.2171, label %if.else, label %for.inc33.2172
for.inc33.2172: ; preds = %for.inc33.3.1
%cmp22.1.2 = icmp eq i32 %23, %i.1139
br i1 %cmp22.1.2, label %if.else, label %for.inc33.1.2
for.inc33.1.2: ; preds = %for.inc33.2172
%cmp22.2.2 = icmp eq i32 %24, %i.1139
br i1 %cmp22.2.2, label %if.else, label %for.inc33.2.2
for.inc33.2.2: ; preds = %for.inc33.1.2
%cmp22.3.2 = icmp eq i32 %25, %i.1139
br i1 %cmp22.3.2, label %if.else, label %for.inc33.3.2
for.inc33.3.2: ; preds = %for.inc33.2.2
%cmp22.3174 = icmp eq i32 %26, %i.1139
br i1 %cmp22.3174, label %if.else, label %for.inc33.3175
for.inc33.3175: ; preds = %for.inc33.3.2
%cmp22.1.3 = icmp eq i32 %27, %i.1139
br i1 %cmp22.1.3, label %if.else, label %for.inc33.1.3
for.inc33.1.3: ; preds = %for.inc33.3175
%cmp22.2.3 = icmp eq i32 %28, %i.1139
br i1 %cmp22.2.3, label %if.else, label %for.inc33.2.3
for.inc33.2.3: ; preds = %for.inc33.1.3
%cmp22.3.3 = icmp eq i32 %29, %i.1139
br i1 %cmp22.3.3, label %if.else, label %for.inc43
for.inc43: ; preds = %for.inc33.2.3, %if.else
%md.4 = phi i32 [ %add31, %if.else ], [ %md.0138, %for.inc33.2.3 ]
%inc44 = add nuw nsw i32 %i.1139, 1
%exitcond.not = icmp eq i32 %inc44, 16
br i1 %exitcond.not, label %for.cond46.preheader, label %for.cond12.preheader, !llvm.loop !9
for.cond46: ; preds = %for.cond46.preheader.split, %for.cond46
%i.2 = phi i32 [ %add84, %for.cond46 ], [ 0, %for.cond46.preheader.split ]
%add75 = add nsw i32 %i.2, %md.4
%call76 = call i32 @search(ptr noundef nonnull %board, i32 noundef %md.4, i32 noundef %add75, i32 noundef %r_0.4.peel, i32 noundef %c_0.4.peel, i8 noundef signext 99)
%cmp79.not = icmp eq i32 %call76, -1
%add84 = add nuw nsw i32 %i.2, 2
br i1 %cmp79.not, label %for.cond46, label %for.end85
for.end85: ; preds = %for.cond46, %for.cond46.us142, %for.cond46.us, %for.cond46.us.us
%.us-phi = phi i32 [ %call57.us.us, %for.cond46.us.us ], [ %call62.us, %for.cond46.us ], [ %call72.us, %for.cond46.us142 ], [ %call76, %for.cond46 ]
%call86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %board) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
void quicksort(int a[],int f,int l)
{
int p,i,j;
if(f<l)
{
p=f;
i=f;
j=l;
while(i<j)
{
while(a[i]<=a[p]&&i<l)
i++;
while(a[j]>a[p])
j--;
if(i<j)
a[i]=a[i]+a[j]-(a[j]=a[i]);
}
a[j]=a[p]+a[j]-(a[p]=a[j]);
quicksort(a,f,j-1);
quicksort(a,j+1,l);
}
}
int main(){
int n,c=0;
scanf("%d",&n);
int a[n],i;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
quicksort(a,0,n-1);
for(i=0;i<n;i++){
if(a[i]!=a[i+1]&&a[i]!=0)
c++;
}
printf("%d",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16474/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16474/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @quicksort(ptr nocapture noundef %a, i32 noundef %f, i32 noundef %l) local_unnamed_addr #0 {
entry:
%cmp89 = icmp slt i32 %f, %l
br i1 %cmp89, label %while.cond.preheader.preheader, label %if.end43
while.cond.preheader.preheader: ; preds = %entry
%0 = sext i32 %l to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %while.end28
%f.tr90 = phi i32 [ %add42, %while.end28 ], [ %f, %while.cond.preheader.preheader ]
%idxprom3 = sext i32 %f.tr90 to i64
%arrayidx4 = getelementptr inbounds i32, ptr %a, i64 %idxprom3
br label %while.cond2.preheader
while.cond2.preheader: ; preds = %if.end, %while.cond.preheader
%j.088 = phi i32 [ %l, %while.cond.preheader ], [ %8, %if.end ]
%i.087 = phi i32 [ %f.tr90, %while.cond.preheader ], [ %5, %if.end ]
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%2 = sext i32 %i.087 to i64
br label %while.cond2
while.cond2: ; preds = %while.cond2, %while.cond2.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond2 ], [ %2, %while.cond2.preheader ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5 = icmp sle i32 %3, %1
%cmp6 = icmp slt i64 %indvars.iv, %0
%4 = and i1 %cmp6, %cmp5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
br i1 %4, label %while.cond2, label %while.cond8.preheader, !llvm.loop !9
while.cond8.preheader: ; preds = %while.cond2
%arrayidx.le = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%5 = trunc i64 %indvars.iv to i32
%6 = sext i32 %j.088 to i64
br label %while.cond8
while.cond8: ; preds = %while.cond8, %while.cond8.preheader
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %while.cond8 ], [ %6, %while.cond8.preheader ]
%arrayidx10 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv93
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %7, %1
%indvars.iv.next94 = add i64 %indvars.iv93, -1
br i1 %cmp13, label %while.cond8, label %while.end15, !llvm.loop !11
while.end15: ; preds = %while.cond8
%8 = trunc i64 %indvars.iv93 to i32
%cmp16 = icmp slt i32 %5, %8
br i1 %cmp16, label %if.end, label %while.end28
if.end: ; preds = %while.end15
%arrayidx10.le = getelementptr inbounds i32, ptr %a, i64 %indvars.iv93
store i32 %3, ptr %arrayidx10.le, align 4, !tbaa !5
store i32 %7, ptr %arrayidx.le, align 4, !tbaa !5
br label %while.cond2.preheader
while.end28: ; preds = %while.end15
%9 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%sext = shl i64 %indvars.iv93, 32
%idxprom31 = ashr exact i64 %sext, 32
%arrayidx32 = getelementptr inbounds i32, ptr %a, i64 %idxprom31
%10 = load i32, ptr %arrayidx32, align 4, !tbaa !5
store i32 %10, ptr %arrayidx4, align 4, !tbaa !5
store i32 %9, ptr %arrayidx32, align 4, !tbaa !5
%sub41 = add nsw i32 %8, -1
tail call void @quicksort(ptr noundef nonnull %a, i32 noundef %f.tr90, i32 noundef %sub41)
%add42 = add nsw i32 %8, 1
%cmp = icmp slt i32 %add42, %l
br i1 %cmp, label %while.cond.preheader, label %if.end43
if.end43: ; preds = %while.end28, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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
%cmp27 = icmp sgt i32 %3, 0
br i1 %cmp27, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%sub39 = add nsw i32 %3, -1
call void @quicksort(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %sub39)
br label %for.end16
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 !12
for.end: ; preds = %for.body
%sub = add nsw i32 %4, -1
call void @quicksort(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %sub)
%cmp329 = icmp sgt i32 %4, 0
br i1 %cmp329, label %for.body4.preheader, label %for.end16
for.body4.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %4 to i64
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body4.preheader43, label %vector.ph
vector.ph: ; preds = %for.body4.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.load42, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%vec.phi41 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
%6 = or i64 %index, 1
%7 = getelementptr inbounds i32, ptr %vla, i64 %6
%wide.load = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load42 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%10 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load42, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%11 = icmp ne <4 x i32> %9, %wide.load
%12 = icmp ne <4 x i32> %10, %wide.load42
%13 = icmp ne <4 x i32> %9, zeroinitializer
%14 = icmp ne <4 x i32> %10, zeroinitializer
%15 = and <4 x i1> %13, %11
%16 = and <4 x i1> %14, %12
%17 = zext <4 x i1> %15 to <4 x i32>
%18 = zext <4 x i1> %16 to <4 x i32>
%19 = add <4 x i32> %vec.phi, %17
%20 = add <4 x i32> %vec.phi41, %18
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %20, %19
%22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
%vector.recur.extract = extractelement <4 x i32> %wide.load42, i64 3
br i1 %cmp.n, label %for.end16, label %for.body4.preheader43
for.body4.preheader43: ; preds = %for.body4.preheader, %middle.block
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body4.preheader ]
%indvars.iv35.ph = phi i64 [ %n.vec, %middle.block ], [ 0, %for.body4.preheader ]
%c.030.ph = phi i32 [ %22, %middle.block ], [ 0, %for.body4.preheader ]
br label %for.body4
for.body4: ; preds = %for.body4.preheader43, %for.body4
%scalar.recur = phi i32 [ %23, %for.body4 ], [ %scalar.recur.ph, %for.body4.preheader43 ]
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %for.body4 ], [ %indvars.iv35.ph, %for.body4.preheader43 ]
%c.030 = phi i32 [ %c.1, %for.body4 ], [ %c.030.ph, %for.body4.preheader43 ]
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next36
%23 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp ne i32 %scalar.recur, %23
%cmp12.not = icmp ne i32 %scalar.recur, 0
%or.cond.not = and i1 %cmp12.not, %cmp9.not
%inc13 = zext i1 %or.cond.not to i32
%c.1 = add nuw nsw i32 %c.030, %inc13
%exitcond.not = icmp eq i64 %indvars.iv.next36, %wide.trip.count
br i1 %exitcond.not, label %for.end16, label %for.body4, !llvm.loop !16
for.end16: ; preds = %for.body4, %middle.block, %for.end.thread, %for.end
%c.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %for.end.thread ], [ %22, %middle.block ], [ %c.1, %for.body4 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %c.0.lcssa)
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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 4
#define L 46
int result[N][N] = {
{1,2,3,4},
{5,6,7,8},
{9,10,11,12},
{13,14,15,0}};
int x[N*N] = {3,0,1,2,
3,0,1,2,
3,0,1,2,
3,0,1,2};
int y[N*N] = {3,0,0,0,
0,1,1,1,
1,2,2,2,
2,3,3,3};
int min = L;
void dfs(int p1[N][N], int p2[N][N],int n){
int i,j,i1,j1;
int f = 0, d = 0;
int tmp[N][N];
for(i = 0; i<N ; i++){
for(j = 0; j<N; j++){
if(result[i][j] != p1[i][j]){
f++;
}
if(p1[i][j] == 0){
i1 = i;
j1 = j;
}
else {
d += abs(j - x[p1[i][j]]) + abs(i -y[p1[i][j]]);
}
}
}
if(f == 0){
if(min > n){
min = n;
}
return;
}
if(d + n> min){
return;
}
if( i1>0&& i1<N){
memcpy(tmp,p1,sizeof(int) * N *N);
f = tmp[i1][j1];
tmp[i1][j1] = tmp[i1-1][j1];
tmp[i1-1][j1] = f;
if(memcmp( tmp,p2,sizeof(int)*N*N) != 0){
dfs(tmp,p1,n+1);
}
}
if( j1>0&& j1<N){
memcpy(tmp,p1,sizeof(int) * N *N);
f = tmp[i1][j1];
tmp[i1][j1] = tmp[i1][j1-1];
tmp[i1][j1-1] = f;
if(memcmp( tmp,p2,sizeof(int)*N*N) != 0){
dfs(tmp,p1,n+1);
}
}
if( i1>=0&& i1<N-1){
memcpy(tmp,p1,sizeof(int) * N *N);
f = tmp[i1][j1];
tmp[i1][j1] = tmp[i1+1][j1];
tmp[i1+1][j1] = f;
if(memcmp( tmp,p2,sizeof(int)*N*N) != 0){
dfs(tmp,p1,n+1);
}
}
if( j1>=0&& j1<N-1){
memcpy(tmp,p1,sizeof(int) * N *N);
f = tmp[i1][j1];
tmp[i1][j1] = tmp[i1][j1+1];
tmp[i1][j1+1] = f;
if(memcmp( tmp,p2,sizeof(int)*N*N) != 0){
dfs(tmp,p1,n+1);
}
}
}
int main(){
int i,j;
int p[N][N];
for(i = 0;i<N; i++){
for(j = 0;j<N;j++){
scanf("%d",&p[i][j]);
}
}
dfs(p,p,0);
printf("%d\n",min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164783/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164783/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@result = dso_local local_unnamed_addr global [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 5, i32 6, i32 7, i32 8], [4 x i32] [i32 9, i32 10, i32 11, i32 12], [4 x i32] [i32 13, i32 14, i32 15, i32 0]], align 16
@x = dso_local local_unnamed_addr global [16 x i32] [i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2], align 16
@y = dso_local local_unnamed_addr global [16 x i32] [i32 3, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 3, i32 3, i32 3], align 16
@min = dso_local local_unnamed_addr global i32 46, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dfs(ptr nocapture noundef readonly %p1, ptr nocapture noundef readonly %p2, i32 noundef %n) local_unnamed_addr #0 {
entry:
%tmp = alloca [4 x [4 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %tmp) #7
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.3
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.3 ]
%d.0268 = phi i32 [ 0, %entry ], [ %d.2.3, %for.inc.3 ]
%f.0267 = phi i32 [ 0, %entry ], [ %spec.select.3, %for.inc.3 ]
%j1.0266 = phi i32 [ undef, %entry ], [ %j1.2.3, %for.inc.3 ]
%i1.0265 = phi i32 [ undef, %entry ], [ %i1.2.3, %for.inc.3 ]
%arrayidx5 = getelementptr inbounds [4 x [4 x i32]], ptr @result, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%arrayidx9 = getelementptr inbounds [4 x i32], ptr %p1, i64 %indvars.iv, i64 0
%1 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not = icmp ne i32 %0, %1
%inc = zext i1 %cmp10.not to i32
%spec.select = add nsw i32 %f.0267, %inc
%cmp15 = icmp eq i32 %1, 0
%2 = trunc i64 %indvars.iv to i32
br i1 %cmp15, label %for.inc, label %if.else
if.else: ; preds = %for.cond1.preheader
%idxprom21 = sext i32 %1 to i64
%arrayidx22 = getelementptr inbounds [16 x i32], ptr @x, i64 0, i64 %idxprom21
%3 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%4 = tail call i32 @llvm.abs.i32(i32 %3, i1 true)
%arrayidx28 = getelementptr inbounds [16 x i32], ptr @y, i64 0, i64 %idxprom21
%5 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%sub29 = sub nsw i32 %2, %5
%6 = tail call i32 @llvm.abs.i32(i32 %sub29, i1 true)
%add = add i32 %4, %d.0268
%add30 = add i32 %add, %6
br label %for.inc
for.inc: ; preds = %for.cond1.preheader, %if.else
%i1.2 = phi i32 [ %i1.0265, %if.else ], [ %2, %for.cond1.preheader ]
%j1.2 = phi i32 [ %j1.0266, %if.else ], [ 0, %for.cond1.preheader ]
%d.2 = phi i32 [ %add30, %if.else ], [ %d.0268, %for.cond1.preheader ]
%arrayidx5.1 = getelementptr inbounds [4 x [4 x i32]], ptr @result, i64 0, i64 %indvars.iv, i64 1
%7 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%arrayidx9.1 = getelementptr inbounds [4 x i32], ptr %p1, i64 %indvars.iv, i64 1
%8 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%cmp10.not.1 = icmp ne i32 %7, %8
%inc.1 = zext i1 %cmp10.not.1 to i32
%spec.select.1 = add nsw i32 %spec.select, %inc.1
%cmp15.1 = icmp eq i32 %8, 0
br i1 %cmp15.1, label %for.inc.1, label %if.else.1
if.else.1: ; preds = %for.inc
%idxprom21.1 = sext i32 %8 to i64
%arrayidx22.1 = getelementptr inbounds [16 x i32], ptr @x, i64 0, i64 %idxprom21.1
%9 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%sub.1 = sub nsw i32 1, %9
%10 = tail call i32 @llvm.abs.i32(i32 %sub.1, i1 true)
%arrayidx28.1 = getelementptr inbounds [16 x i32], ptr @y, i64 0, i64 %idxprom21.1
%11 = load i32, ptr %arrayidx28.1, align 4, !tbaa !5
%sub29.1 = sub nsw i32 %2, %11
%12 = tail call i32 @llvm.abs.i32(i32 %sub29.1, i1 true)
%add.1 = add i32 %10, %d.2
%add30.1 = add i32 %add.1, %12
br label %for.inc.1
for.inc.1: ; preds = %if.else.1, %for.inc
%i1.2.1 = phi i32 [ %i1.2, %if.else.1 ], [ %2, %for.inc ]
%j1.2.1 = phi i32 [ %j1.2, %if.else.1 ], [ 1, %for.inc ]
%d.2.1 = phi i32 [ %add30.1, %if.else.1 ], [ %d.2, %for.inc ]
%arrayidx5.2 = getelementptr inbounds [4 x [4 x i32]], ptr @result, i64 0, i64 %indvars.iv, i64 2
%13 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%arrayidx9.2 = getelementptr inbounds [4 x i32], ptr %p1, i64 %indvars.iv, i64 2
%14 = load i32, ptr %arrayidx9.2, align 4, !tbaa !5
%cmp10.not.2 = icmp ne i32 %13, %14
%inc.2 = zext i1 %cmp10.not.2 to i32
%spec.select.2 = add nsw i32 %spec.select.1, %inc.2
%cmp15.2 = icmp eq i32 %14, 0
br i1 %cmp15.2, label %for.inc.2, label %if.else.2
if.else.2: ; preds = %for.inc.1
%idxprom21.2 = sext i32 %14 to i64
%arrayidx22.2 = getelementptr inbounds [16 x i32], ptr @x, i64 0, i64 %idxprom21.2
%15 = load i32, ptr %arrayidx22.2, align 4, !tbaa !5
%sub.2 = sub nsw i32 2, %15
%16 = tail call i32 @llvm.abs.i32(i32 %sub.2, i1 true)
%arrayidx28.2 = getelementptr inbounds [16 x i32], ptr @y, i64 0, i64 %idxprom21.2
%17 = load i32, ptr %arrayidx28.2, align 4, !tbaa !5
%sub29.2 = sub nsw i32 %2, %17
%18 = tail call i32 @llvm.abs.i32(i32 %sub29.2, i1 true)
%add.2 = add i32 %16, %d.2.1
%add30.2 = add i32 %add.2, %18
br label %for.inc.2
for.inc.2: ; preds = %if.else.2, %for.inc.1
%i1.2.2 = phi i32 [ %i1.2.1, %if.else.2 ], [ %2, %for.inc.1 ]
%j1.2.2 = phi i32 [ %j1.2.1, %if.else.2 ], [ 2, %for.inc.1 ]
%d.2.2 = phi i32 [ %add30.2, %if.else.2 ], [ %d.2.1, %for.inc.1 ]
%arrayidx5.3 = getelementptr inbounds [4 x [4 x i32]], ptr @result, i64 0, i64 %indvars.iv, i64 3
%19 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%arrayidx9.3 = getelementptr inbounds [4 x i32], ptr %p1, i64 %indvars.iv, i64 3
%20 = load i32, ptr %arrayidx9.3, align 4, !tbaa !5
%cmp10.not.3 = icmp ne i32 %19, %20
%inc.3 = zext i1 %cmp10.not.3 to i32
%spec.select.3 = add nsw i32 %spec.select.2, %inc.3
%cmp15.3 = icmp eq i32 %20, 0
br i1 %cmp15.3, label %for.inc.3, label %if.else.3
if.else.3: ; preds = %for.inc.2
%idxprom21.3 = sext i32 %20 to i64
%arrayidx22.3 = getelementptr inbounds [16 x i32], ptr @x, i64 0, i64 %idxprom21.3
%21 = load i32, ptr %arrayidx22.3, align 4, !tbaa !5
%sub.3 = sub nsw i32 3, %21
%22 = tail call i32 @llvm.abs.i32(i32 %sub.3, i1 true)
%arrayidx28.3 = getelementptr inbounds [16 x i32], ptr @y, i64 0, i64 %idxprom21.3
%23 = load i32, ptr %arrayidx28.3, align 4, !tbaa !5
%sub29.3 = sub nsw i32 %2, %23
%24 = tail call i32 @llvm.abs.i32(i32 %sub29.3, i1 true)
%add.3 = add i32 %22, %d.2.2
%add30.3 = add i32 %add.3, %24
br label %for.inc.3
for.inc.3: ; preds = %if.else.3, %for.inc.2
%i1.2.3 = phi i32 [ %i1.2.2, %if.else.3 ], [ %2, %for.inc.2 ]
%j1.2.3 = phi i32 [ %j1.2.2, %if.else.3 ], [ 3, %for.inc.2 ]
%d.2.3 = phi i32 [ %add30.3, %if.else.3 ], [ %d.2.2, %for.inc.2 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 4
br i1 %exitcond.not, label %for.end35, label %for.cond1.preheader, !llvm.loop !9
for.end35: ; preds = %for.inc.3
%cmp36 = icmp eq i32 %spec.select.3, 0
br i1 %cmp36, label %if.then37, label %if.end41
if.then37: ; preds = %for.end35
%25 = load i32, ptr @min, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %25, %n
br i1 %cmp38, label %if.then39, label %cleanup
if.then39: ; preds = %if.then37
store i32 %n, ptr @min, align 4, !tbaa !5
br label %cleanup
if.end41: ; preds = %for.end35
%add42 = add nsw i32 %d.2.3, %n
%26 = load i32, ptr @min, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %add42, %26
br i1 %cmp43, label %cleanup, label %if.end45
if.end45: ; preds = %if.end41
%27 = add i32 %i1.2.3, -1
%or.cond = icmp ult i32 %27, 3
br i1 %or.cond, label %if.then48, label %if.end73
if.then48: ; preds = %if.end45
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %tmp, ptr noundef nonnull align 4 dereferenceable(64) %p1, i64 64, i1 false)
%idxprom49 = zext i32 %i1.2.3 to i64
%idxprom51 = sext i32 %j1.2.3 to i64
%arrayidx52 = getelementptr inbounds [4 x [4 x i32]], ptr %tmp, i64 0, i64 %idxprom49, i64 %idxprom51
%28 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%idxprom54 = zext i32 %27 to i64
%arrayidx57 = getelementptr inbounds [4 x [4 x i32]], ptr %tmp, i64 0, i64 %idxprom54, i64 %idxprom51
%29 = load i32, ptr %arrayidx57, align 4, !tbaa !5
store i32 %29, ptr %arrayidx52, align 4, !tbaa !5
store i32 %28, ptr %arrayidx57, align 4, !tbaa !5
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(64) %tmp, ptr noundef nonnull dereferenceable(64) %p2, i64 64)
%cmp68.not = icmp eq i32 %bcmp, 0
br i1 %cmp68.not, label %if.end73, label %if.then69
if.then69: ; preds = %if.then48
%add71 = add nsw i32 %n, 1
call void @dfs(ptr noundef nonnull %tmp, ptr noundef nonnull %p1, i32 noundef %add71)
br label %if.end73
if.end73: ; preds = %if.then48, %if.then69, %if.end45
%30 = add i32 %j1.2.3, -1
%or.cond173 = icmp ult i32 %30, 3
br i1 %or.cond173, label %if.then77, label %if.end104
if.then77: ; preds = %if.end73
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %tmp, ptr noundef nonnull align 4 dereferenceable(64) %p1, i64 64, i1 false)
%idxprom79 = sext i32 %i1.2.3 to i64
%idxprom81 = zext i32 %j1.2.3 to i64
%arrayidx82 = getelementptr inbounds [4 x [4 x i32]], ptr %tmp, i64 0, i64 %idxprom79, i64 %idxprom81
%31 = load i32, ptr %arrayidx82, align 4, !tbaa !5
%idxprom86 = zext i32 %30 to i64
%arrayidx87 = getelementptr inbounds [4 x [4 x i32]], ptr %tmp, i64 0, i64 %idxprom79, i64 %idxprom86
%32 = load i32, ptr %arrayidx87, align 4, !tbaa !5
store i32 %32, ptr %arrayidx82, align 4, !tbaa !5
store i32 %31, ptr %arrayidx87, align 4, !tbaa !5
%bcmp256 = call i32 @bcmp(ptr noundef nonnull dereferenceable(64) %tmp, ptr noundef nonnull dereferenceable(64) %p2, i64 64)
%cmp99.not = icmp eq i32 %bcmp256, 0
br i1 %cmp99.not, label %if.end104, label %if.then100
if.then100: ; preds = %if.then77
%add102 = add nsw i32 %n, 1
call void @dfs(ptr noundef nonnull %tmp, ptr noundef nonnull %p1, i32 noundef %add102)
br label %if.end104
if.end104: ; preds = %if.then77, %if.then100, %if.end73
%or.cond174 = icmp ult i32 %i1.2.3, 3
br i1 %or.cond174, label %if.then108, label %if.end135
if.then108: ; preds = %if.end104
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %tmp, ptr noundef nonnull align 4 dereferenceable(64) %p1, i64 64, i1 false)
%idxprom110 = zext i32 %i1.2.3 to i64
%idxprom112 = sext i32 %j1.2.3 to i64
%arrayidx113 = getelementptr inbounds [4 x [4 x i32]], ptr %tmp, i64 0, i64 %idxprom110, i64 %idxprom112
%33 = load i32, ptr %arrayidx113, align 4, !tbaa !5
%add114 = add nuw nsw i32 %i1.2.3, 1
%idxprom115 = zext i32 %add114 to i64
%arrayidx118 = getelementptr inbounds [4 x [4 x i32]], ptr %tmp, i64 0, i64 %idxprom115, i64 %idxprom112
%34 = load i32, ptr %arrayidx118, align 4, !tbaa !5
store i32 %34, ptr %arrayidx113, align 4, !tbaa !5
store i32 %33, ptr %arrayidx118, align 4, !tbaa !5
%bcmp257 = call i32 @bcmp(ptr noundef nonnull dereferenceable(64) %tmp, ptr noundef nonnull dereferenceable(64) %p2, i64 64)
%cmp130.not = icmp eq i32 %bcmp257, 0
br i1 %cmp130.not, label %if.end135, label %if.then131
if.then131: ; preds = %if.then108
%add133 = add nsw i32 %n, 1
call void @dfs(ptr noundef nonnull %tmp, ptr noundef nonnull %p1, i32 noundef %add133)
br label %if.end135
if.end135: ; preds = %if.then108, %if.then131, %if.end104
%or.cond175 = icmp ult i32 %j1.2.3, 3
br i1 %or.cond175, label %if.then139, label %cleanup
if.then139: ; preds = %if.end135
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %tmp, ptr noundef nonnull align 4 dereferenceable(64) %p1, i64 64, i1 false)
%idxprom141 = sext i32 %i1.2.3 to i64
%idxprom143 = zext i32 %j1.2.3 to i64
%arrayidx144 = getelementptr inbounds [4 x [4 x i32]], ptr %tmp, i64 0, i64 %idxprom141, i64 %idxprom143
%35 = load i32, ptr %arrayidx144, align 4, !tbaa !5
%add147 = add nuw nsw i32 %j1.2.3, 1
%idxprom148 = zext i32 %add147 to i64
%arrayidx149 = getelementptr inbounds [4 x [4 x i32]], ptr %tmp, i64 0, i64 %idxprom141, i64 %idxprom148
%36 = load i32, ptr %arrayidx149, align 4, !tbaa !5
store i32 %36, ptr %arrayidx144, align 4, !tbaa !5
store i32 %35, ptr %arrayidx149, align 4, !tbaa !5
%bcmp258 = call i32 @bcmp(ptr noundef nonnull dereferenceable(64) %tmp, ptr noundef nonnull dereferenceable(64) %p2, i64 64)
%cmp161.not = icmp eq i32 %bcmp258, 0
br i1 %cmp161.not, label %cleanup, label %if.then162
if.then162: ; preds = %if.then139
%add164 = add nsw i32 %n, 1
call void @dfs(ptr noundef nonnull %tmp, ptr noundef nonnull %p1, i32 noundef %add164)
br label %cleanup
cleanup: ; preds = %if.end135, %if.then162, %if.then139, %if.end41, %if.then37, %if.then39
call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %tmp) #7
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: 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 #4 {
entry:
%p = alloca [4 x [4 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %p) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%arrayidx5.1 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%arrayidx5.2 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2)
%arrayidx5.3 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3)
%arrayidx5.119 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 1, i64 0
%call.120 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.119)
%arrayidx5.1.1 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 1, i64 1
%call.1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1.1)
%arrayidx5.2.1 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 1, i64 2
%call.2.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2.1)
%arrayidx5.3.1 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 1, i64 3
%call.3.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3.1)
%arrayidx5.221 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 2, i64 0
%call.222 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.221)
%arrayidx5.1.2 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 2, i64 1
%call.1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1.2)
%arrayidx5.2.2 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 2, i64 2
%call.2.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2.2)
%arrayidx5.3.2 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 2, i64 3
%call.3.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3.2)
%arrayidx5.323 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 3, i64 0
%call.324 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.323)
%arrayidx5.1.3 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 3, i64 1
%call.1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1.3)
%arrayidx5.2.3 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 3, i64 2
%call.2.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2.3)
%arrayidx5.3.3 = getelementptr inbounds [4 x [4 x i32]], ptr %p, i64 0, i64 3, i64 3
%call.3.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3.3)
call void @dfs(ptr noundef nonnull %p, ptr noundef nonnull %p, i32 noundef 0)
%0 = load i32, ptr @min, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %p) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind willreturn memory(argmem: read) }
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"}
|
#include <stdio.h>
int main(void){
int stone[100000];
int num[100000];
int pos = 0;
int n;
int i;
int d;
while(scanf("%d",&n) && n){
scanf("%d",&d);
stone[pos] = d;
num[pos] = 1;
for(i=1;i<n;i++){
scanf("%d",&d);
if(stone[pos]==d){
num[pos]++;
}else{
if((i+1) & 0x0001){
//奇数
pos++;
stone[pos]=d;
num[pos]=1;
}else{
//偶数
if(pos>0){
if(stone[pos-1]!=stone[pos]){
num[pos]++;
num[pos-1]+=num[pos];
pos--;
}else{
stone[pos]=d;
num[pos]++;
}
}else{
stone[pos]=d;
num[pos]++;
}
}
}
}
d=0;
for(i=0;i<=pos;i++){
if(stone[i]==0){
d+=num[i];
}
}
printf("%d\n",d);
pos=0;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164826/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164826/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%stone = alloca [100000 x i32], align 16
%num = alloca [100000 x i32], align 16
%n = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %stone) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %num) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call100 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool101 = icmp ne i32 %call100, 0
%0 = load i32, ptr %n, align 4
%tobool1102 = icmp ne i32 %0, 0
%1 = select i1 %tobool101, i1 %tobool1102, i1 false
br i1 %1, label %while.body, label %while.end
while.body: ; preds = %entry, %for.end65
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%2 = load i32, ptr %d, align 4, !tbaa !5
store i32 %2, ptr %stone, align 16, !tbaa !5
store i32 1, ptr %num, align 16, !tbaa !5
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp92 = icmp sgt i32 %3, 1
br i1 %cmp92, label %for.body, label %for.end.thread
for.end.thread: ; preds = %while.body
store i32 0, ptr %d, align 4, !tbaa !5
br label %for.body54.preheader
for.body: ; preds = %while.body, %for.inc
%i.094 = phi i32 [ %inc51, %for.inc ], [ 1, %while.body ]
%pos.193 = phi i32 [ %pos.2, %for.inc ], [ 0, %while.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%idxprom6 = sext i32 %pos.193 to i64
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr %stone, i64 0, i64 %idxprom6
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%5 = load i32, ptr %d, align 4, !tbaa !5
%cmp8 = icmp eq i32 %4, %5
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body
%arrayidx10 = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %idxprom6
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%inc = add nsw i32 %6, 1
store i32 %inc, ptr %arrayidx10, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%7 = and i32 %i.094, 1
%tobool11.not.not = icmp eq i32 %7, 0
br i1 %tobool11.not.not, label %if.then12, label %if.else18
if.then12: ; preds = %if.else
%inc13 = add nsw i32 %pos.193, 1
%idxprom14 = sext i32 %inc13 to i64
%arrayidx15 = getelementptr inbounds [100000 x i32], ptr %stone, i64 0, i64 %idxprom14
store i32 %5, ptr %arrayidx15, align 4, !tbaa !5
%arrayidx17 = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %idxprom14
store i32 1, ptr %arrayidx17, align 4, !tbaa !5
br label %for.inc
if.else18: ; preds = %if.else
%cmp19 = icmp sgt i32 %pos.193, 0
br i1 %cmp19, label %if.then20, label %if.else42
if.then20: ; preds = %if.else18
%sub = add nsw i32 %pos.193, -1
%idxprom21 = zext i32 %sub to i64
%arrayidx22 = getelementptr inbounds [100000 x i32], ptr %stone, i64 0, i64 %idxprom21
%8 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp25.not = icmp eq i32 %8, %4
br i1 %cmp25.not, label %if.else36, label %if.then26
if.then26: ; preds = %if.then20
%arrayidx28 = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %idxprom6
%9 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%inc29 = add nsw i32 %9, 1
store i32 %inc29, ptr %arrayidx28, align 4, !tbaa !5
%arrayidx34 = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %idxprom21
%10 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%add35 = add nsw i32 %10, %inc29
store i32 %add35, ptr %arrayidx34, align 4, !tbaa !5
br label %for.inc
if.else36: ; preds = %if.then20
store i32 %5, ptr %arrayidx7, align 4, !tbaa !5
%arrayidx40 = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %idxprom6
%11 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%inc41 = add nsw i32 %11, 1
store i32 %inc41, ptr %arrayidx40, align 4, !tbaa !5
br label %for.inc
if.else42: ; preds = %if.else18
store i32 %5, ptr %arrayidx7, align 4, !tbaa !5
%arrayidx46 = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %idxprom6
%12 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%inc47 = add nsw i32 %12, 1
store i32 %inc47, ptr %arrayidx46, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then, %if.else42, %if.else36, %if.then26, %if.then12
%pos.2 = phi i32 [ %pos.193, %if.then ], [ %inc13, %if.then12 ], [ %sub, %if.then26 ], [ %pos.193, %if.else36 ], [ %pos.193, %if.else42 ]
%inc51 = add nuw nsw i32 %i.094, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc51, %13
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
store i32 0, ptr %d, align 4, !tbaa !5
%cmp53.not97 = icmp slt i32 %pos.2, 0
br i1 %cmp53.not97, label %for.end65, label %for.body54.preheader
for.body54.preheader: ; preds = %for.end.thread, %for.end
%pos.1.lcssa106 = phi i32 [ 0, %for.end.thread ], [ %pos.2, %for.end ]
%14 = add nuw i32 %pos.1.lcssa106, 1
%wide.trip.count = zext i32 %14 to i64
%xtraiter = and i64 %wide.trip.count, 1
%15 = icmp eq i32 %pos.1.lcssa106, 0
br i1 %15, label %for.end65.loopexit.unr-lcssa, label %for.body54.preheader.new
for.body54.preheader.new: ; preds = %for.body54.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body54
for.body54: ; preds = %for.inc63.1, %for.body54.preheader.new
%indvars.iv = phi i64 [ 0, %for.body54.preheader.new ], [ %indvars.iv.next.1, %for.inc63.1 ]
%add619698 = phi i32 [ 0, %for.body54.preheader.new ], [ %add6195.1, %for.inc63.1 ]
%niter = phi i64 [ 0, %for.body54.preheader.new ], [ %niter.next.1, %for.inc63.1 ]
%arrayidx56 = getelementptr inbounds [100000 x i32], ptr %stone, i64 0, i64 %indvars.iv
%16 = load i32, ptr %arrayidx56, align 8, !tbaa !5
%cmp57 = icmp eq i32 %16, 0
br i1 %cmp57, label %if.then58, label %for.inc63
if.then58: ; preds = %for.body54
%arrayidx60 = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %indvars.iv
%17 = load i32, ptr %arrayidx60, align 8, !tbaa !5
%add61 = add nsw i32 %add619698, %17
store i32 %add61, ptr %d, align 4, !tbaa !5
br label %for.inc63
for.inc63: ; preds = %for.body54, %if.then58
%add6195 = phi i32 [ %add619698, %for.body54 ], [ %add61, %if.then58 ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx56.1 = getelementptr inbounds [100000 x i32], ptr %stone, i64 0, i64 %indvars.iv.next
%18 = load i32, ptr %arrayidx56.1, align 4, !tbaa !5
%cmp57.1 = icmp eq i32 %18, 0
br i1 %cmp57.1, label %if.then58.1, label %for.inc63.1
if.then58.1: ; preds = %for.inc63
%arrayidx60.1 = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %indvars.iv.next
%19 = load i32, ptr %arrayidx60.1, align 4, !tbaa !5
%add61.1 = add nsw i32 %add6195, %19
store i32 %add61.1, ptr %d, align 4, !tbaa !5
br label %for.inc63.1
for.inc63.1: ; preds = %if.then58.1, %for.inc63
%add6195.1 = phi i32 [ %add6195, %for.inc63 ], [ %add61.1, %if.then58.1 ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end65.loopexit.unr-lcssa, label %for.body54, !llvm.loop !11
for.end65.loopexit.unr-lcssa: ; preds = %for.inc63.1, %for.body54.preheader
%add6195.lcssa.ph = phi i32 [ undef, %for.body54.preheader ], [ %add6195.1, %for.inc63.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body54.preheader ], [ %indvars.iv.next.1, %for.inc63.1 ]
%add619698.unr = phi i32 [ 0, %for.body54.preheader ], [ %add6195.1, %for.inc63.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end65, label %for.body54.epil
for.body54.epil: ; preds = %for.end65.loopexit.unr-lcssa
%arrayidx56.epil = getelementptr inbounds [100000 x i32], ptr %stone, i64 0, i64 %indvars.iv.unr
%20 = load i32, ptr %arrayidx56.epil, align 4, !tbaa !5
%cmp57.epil = icmp eq i32 %20, 0
br i1 %cmp57.epil, label %if.then58.epil, label %for.end65
if.then58.epil: ; preds = %for.body54.epil
%arrayidx60.epil = getelementptr inbounds [100000 x i32], ptr %num, i64 0, i64 %indvars.iv.unr
%21 = load i32, ptr %arrayidx60.epil, align 4, !tbaa !5
%add61.epil = add nsw i32 %add619698.unr, %21
store i32 %add61.epil, ptr %d, align 4, !tbaa !5
br label %for.end65
for.end65: ; preds = %for.end65.loopexit.unr-lcssa, %if.then58.epil, %for.body54.epil, %for.end
%22 = phi i32 [ 0, %for.end ], [ %add6195.lcssa.ph, %for.end65.loopexit.unr-lcssa ], [ %add619698.unr, %for.body54.epil ], [ %add61.epil, %if.then58.epil ]
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %22)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool = icmp ne i32 %call, 0
%23 = load i32, ptr %n, align 4
%tobool1 = icmp ne i32 %23, 0
%24 = select i1 %tobool, i1 %tobool1, i1 false
br i1 %24, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %for.end65, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %num) #3
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %stone) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int a[604];
int main()
{
int n, i, count = 0, v;
scanf ("%d", &n);
for (i = 0; i < n; i++) {
scanf ("%d", &v);
a[v]++;
}
for (i = 1; i < 601; i++) {
if (a[i] > 0)
count++;
}
printf ("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16487/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16487/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 local_unnamed_addr global [604 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%v = 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 %v) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %vector.body.preheader
vector.body.preheader: ; preds = %for.body, %entry
br label %vector.body
vector.body: ; preds = %vector.body.1, %vector.body.preheader
%index = phi i64 [ 0, %vector.body.preheader ], [ %index.next.1, %vector.body.1 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.body.preheader ], [ %16, %vector.body.1 ]
%vec.phi24 = phi <4 x i32> [ zeroinitializer, %vector.body.preheader ], [ %17, %vector.body.1 ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [604 x i32], ptr @a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
%wide.load25 = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = icmp sgt <4 x i32> %wide.load, zeroinitializer
%4 = icmp sgt <4 x i32> %wide.load25, zeroinitializer
%5 = zext <4 x i1> %3 to <4 x i32>
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = add <4 x i32> %vec.phi, %5
%8 = add <4 x i32> %vec.phi24, %6
%9 = icmp eq i64 %index, 592
br i1 %9, label %middle.block, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.body
%offset.idx.1 = or i64 %index, 9
%10 = getelementptr inbounds [604 x i32], ptr @a, i64 0, i64 %offset.idx.1
%wide.load.1 = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load25.1 = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = icmp sgt <4 x i32> %wide.load.1, zeroinitializer
%13 = icmp sgt <4 x i32> %wide.load25.1, zeroinitializer
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %7, %14
%17 = add <4 x i32> %8, %15
%index.next.1 = add nuw nsw i64 %index, 16
br label %vector.body
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%i.020 = phi i32 [ %inc2, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%19 = load i32, ptr %v, align 4, !tbaa !5
%idxprom = sext i32 %19 to i64
%arrayidx = getelementptr inbounds [604 x i32], ptr @a, i64 0, i64 %idxprom
%20 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %20, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%inc2 = add nuw nsw i32 %i.020, 1
%21 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc2, %21
br i1 %cmp, label %for.body, label %vector.body.preheader, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(void){
int a,b,c,n1,n2;
n1=0;n2=0;
while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
if((a*a+b*b)==c*c){n1++;}else if(a==b){n2++;}
}
printf("%d\n%d\n",n1,n2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164912/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164912/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d,%d,%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d\0A%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) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%n2.014 = phi i32 [ %n2.1, %while.body ], [ 0, %entry ]
%n1.013 = phi i32 [ %n1.1, %while.body ], [ 0, %entry ]
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%1 = load i32, ptr %b, align 4, !tbaa !5
%mul1 = mul nsw i32 %1, %1
%add = add nuw nsw i32 %mul1, %mul
%2 = load i32, ptr %c, align 4, !tbaa !5
%mul2 = mul nsw i32 %2, %2
%cmp3 = icmp eq i32 %add, %mul2
%cmp4 = icmp eq i32 %0, %1
%inc = zext i1 %cmp3 to i32
%n1.1 = add nuw nsw i32 %n1.013, %inc
%not.cmp3 = xor i1 %cmp3, true
%narrow = select i1 %not.cmp3, i1 %cmp4, i1 false
%spec.select = zext i1 %narrow to i32
%n2.1 = add nuw nsw i32 %n2.014, %spec.select
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%n1.0.lcssa = phi i32 [ 0, %entry ], [ %n1.1, %while.body ]
%n2.0.lcssa = phi i32 [ 0, %entry ], [ %n2.1, %while.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n1.0.lcssa, i32 noundef %n2.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int a,b,d,i=0,j=0;
while((scanf("%d,%d,%d",&a,&b,&d)) != EOF){
if(a*a+b*b==d*d) i++;
if(a==b) j++;
}
printf("%d\n%d\n",i,j);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_164963/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_164963/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d,%d,%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d\0A%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
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %d)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%j.014 = phi i32 [ %j.1, %while.body ], [ 0, %entry ]
%i.013 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%1 = load i32, ptr %b, align 4, !tbaa !5
%mul1 = mul nsw i32 %1, %1
%add = add nuw nsw i32 %mul1, %mul
%2 = load i32, ptr %d, align 4, !tbaa !5
%mul2 = mul nsw i32 %2, %2
%cmp3 = icmp eq i32 %add, %mul2
%inc = zext i1 %cmp3 to i32
%spec.select = add nuw nsw i32 %i.013, %inc
%cmp4 = icmp eq i32 %0, %1
%inc6 = zext i1 %cmp4 to i32
%j.1 = add nuw nsw i32 %j.014, %inc6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %d)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
%j.0.lcssa = phi i32 [ 0, %entry ], [ %j.1, %while.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa, i32 noundef %j.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int N,i,Num;
int A[8]={0};
scanf("%d",&N);
for(i=0;i<N;++i)
{
scanf("%d",&Num);
if(Num==5||Num==7)
{
printf("-1\n");
return 0;
}
++A[Num];
}
if(A[4]<=A[1]&&A[4]<=A[2])
{
A[1]-=A[4];
A[2]-=A[4];
if(A[6]==A[1]&&(A[2]+A[3]==A[6]))
{
for(i=0;i<A[4];++i)
{
printf("1 2 4\n");
}
for(i=0;i<A[2];++i)
{
printf("1 2 6\n");
}
for(i=0;i<A[3];++i)
{
printf("1 3 6\n");
}
}
else
{
printf("-1\n");
}
}
else
{
printf("-1\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16502/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16502/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.6 = private unnamed_addr constant [6 x i8] c"1 3 6\00", align 1
@str.7 = private unnamed_addr constant [6 x i8] c"1 2 6\00", align 1
@str.8 = private unnamed_addr constant [6 x i8] c"1 2 4\00", align 1
@str.9 = 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
%Num = alloca i32, align 4
%A = alloca [8 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Num) #5
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %A) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %A, i8 0, i64 32, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp74 = icmp sgt i32 %0, 0
br i1 %cmp74, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%arrayidx785 = getelementptr inbounds [8 x i32], ptr %A, i64 0, i64 1
br label %land.lhs.true
for.body: ; preds = %entry, %if.end
%i.075 = phi i32 [ %inc5, %if.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Num)
%1 = load i32, ptr %Num, align 4
%2 = and i32 %1, -3
%or.cond = icmp eq i32 %2, 5
br i1 %or.cond, label %cleanup.sink.split, label %if.end
if.end: ; preds = %for.body
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [8 x i32], ptr %A, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%inc5 = add nuw nsw i32 %i.075, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc5, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end
%arrayidx6.phi.trans.insert = getelementptr inbounds [8 x i32], ptr %A, i64 0, i64 4
%.pre = load i32, ptr %arrayidx6.phi.trans.insert, align 16, !tbaa !5
%arrayidx7.phi.trans.insert = getelementptr inbounds [8 x i32], ptr %A, i64 0, i64 1
%.pre84 = load i32, ptr %arrayidx7.phi.trans.insert, align 4, !tbaa !5
%arrayidx7 = getelementptr inbounds [8 x i32], ptr %A, i64 0, i64 1
%cmp8.not = icmp sgt i32 %.pre, %.pre84
br i1 %cmp8.not, label %cleanup.sink.split, label %land.lhs.true
land.lhs.true: ; preds = %for.end.thread, %for.end
%arrayidx787 = phi ptr [ %arrayidx785, %for.end.thread ], [ %arrayidx7, %for.end ]
%5 = phi i32 [ 0, %for.end.thread ], [ %.pre, %for.end ]
%6 = phi i32 [ 0, %for.end.thread ], [ %.pre84, %for.end ]
%arrayidx10 = getelementptr inbounds [8 x i32], ptr %A, i64 0, i64 2
%7 = load i32, ptr %arrayidx10, align 8, !tbaa !5
%cmp11.not = icmp sgt i32 %5, %7
br i1 %cmp11.not, label %cleanup.sink.split, label %if.then12
if.then12: ; preds = %land.lhs.true
%sub = sub nsw i32 %6, %5
store i32 %sub, ptr %arrayidx787, align 4, !tbaa !5
%sub17 = sub i32 %7, %5
%arrayidx18 = getelementptr inbounds [8 x i32], ptr %A, i64 0, i64 6
%8 = load i32, ptr %arrayidx18, align 8, !tbaa !5
%cmp20 = icmp eq i32 %8, %sub
br i1 %cmp20, label %land.lhs.true21, label %cleanup.sink.split
land.lhs.true21: ; preds = %if.then12
%arrayidx23 = getelementptr inbounds [8 x i32], ptr %A, i64 0, i64 3
%9 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%add = add nsw i32 %9, %sub17
%cmp25 = icmp eq i32 %add, %sub
br i1 %cmp25, label %for.cond27.preheader, label %cleanup.sink.split
for.cond27.preheader: ; preds = %land.lhs.true21
%cmp2976 = icmp sgt i32 %5, 0
br i1 %cmp2976, label %for.body30, label %for.cond35.preheader
for.cond35.preheader: ; preds = %for.body30, %for.cond27.preheader
%cmp3778 = icmp sgt i32 %sub17, 0
br i1 %cmp3778, label %for.body38, label %for.cond43.preheader
for.body30: ; preds = %for.cond27.preheader, %for.body30
%i.177 = phi i32 [ %inc33, %for.body30 ], [ 0, %for.cond27.preheader ]
%puts72 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%inc33 = add nuw nsw i32 %i.177, 1
%exitcond.not = icmp eq i32 %inc33, %5
br i1 %exitcond.not, label %for.cond35.preheader, label %for.body30, !llvm.loop !11
for.cond43.preheader: ; preds = %for.body38, %for.cond35.preheader
%cmp4580 = icmp sgt i32 %9, 0
br i1 %cmp4580, label %for.body46, label %cleanup
for.body38: ; preds = %for.cond35.preheader, %for.body38
%i.279 = phi i32 [ %inc41, %for.body38 ], [ 0, %for.cond35.preheader ]
%puts71 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%inc41 = add nuw nsw i32 %i.279, 1
%exitcond82.not = icmp eq i32 %inc41, %sub17
br i1 %exitcond82.not, label %for.cond43.preheader, label %for.body38, !llvm.loop !12
for.body46: ; preds = %for.cond43.preheader, %for.body46
%i.381 = phi i32 [ %inc49, %for.body46 ], [ 0, %for.cond43.preheader ]
%puts70 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc49 = add nuw nsw i32 %i.381, 1
%exitcond83.not = icmp eq i32 %inc49, %9
br i1 %exitcond83.not, label %cleanup, label %for.body46, !llvm.loop !13
cleanup.sink.split: ; preds = %for.body, %for.end, %land.lhs.true, %if.then12, %land.lhs.true21
%str.sink = phi ptr [ @str.9, %land.lhs.true21 ], [ @str.9, %if.then12 ], [ @str.9, %land.lhs.true ], [ @str.9, %for.end ], [ @str.9, %for.body ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
br label %cleanup
cleanup: ; preds = %for.body46, %cleanup.sink.split, %for.cond43.preheader
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 4, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(){
int H,W,N;
scanf("%d\n%d\n%d",&H,&W,&N);
if(H<W) H=W;
int c=0;
while(N>0){
N-=H;
c++;
}
printf("%d\n",c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165070/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165070/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A%d\0A%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:
%H = alloca i32, align 4
%W = alloca i32, align 4
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #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 %H, ptr noundef nonnull %W, ptr noundef nonnull %N)
%0 = load i32, ptr %H, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %H, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%.pr = load i32, ptr %N, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %.pr, 0
br i1 %cmp15, label %while.body, label %while.end
while.body: ; preds = %if.end, %while.body
%c.06 = phi i32 [ %inc, %while.body ], [ 0, %if.end ]
%3 = phi i32 [ %sub, %while.body ], [ %.pr, %if.end ]
%sub = sub nsw i32 %3, %2
%inc = add nuw nsw i32 %c.06, 1
%cmp1 = icmp sgt i32 %sub, 0
br i1 %cmp1, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %sub, ptr %N, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %if.end
%c.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %if.end ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
typedef struct{
int point;
int len;
}pair;
int compare(const void *a,const void *b){
pair x=*(pair*)a;
pair y=*(pair*)b;
int p=x.point;
int q=y.point;
if(p>q)return 1;
return -1;
}
int max(int a,int b){
return a>b?a:b;
}
int main()
{ int h,w,n,c=0,ans=0;
scanf("%d%d%d",&h,&w,&n);
while(c<n){
c+=max(h,w);
ans++;
}
printf("%d",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165113/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165113/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: 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) local_unnamed_addr #0 {
entry:
%x.sroa.0.0.copyload = load i32, ptr %a, align 4, !tbaa.struct !5
%y.sroa.0.0.copyload = load i32, ptr %b, align 4, !tbaa.struct !5
%cmp = icmp sgt i32 %x.sroa.0.0.copyload, %y.sroa.0.0.copyload
%. = 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) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !6
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %h, align 4, !tbaa !6
%2 = load i32, ptr %w, align 4, !tbaa !6
%cond.i = call i32 @llvm.smax.i32(i32 %1, i32 %2)
%smax = call i32 @llvm.smax.i32(i32 %2, i32 %1)
%smax8 = call i32 @llvm.smax.i32(i32 %smax, i32 %0)
%3 = add i32 %smax8, -1
%4 = udiv i32 %3, %cond.i
%5 = add i32 %4, 1
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %while.body.preheader, label %vector.ph
vector.ph: ; preds = %while.body.lr.ph
%n.vec = and i32 %5, -8
%ind.end = mul i32 %n.vec, %cond.i
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi9 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%6 = add <4 x i32> %vec.phi, <i32 1, i32 1, i32 1, i32 1>
%7 = add <4 x i32> %vec.phi9, <i32 1, i32 1, i32 1, i32 1>
%index.next = add nuw i32 %index, 8
%8 = icmp eq i32 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %5, %n.vec
br i1 %cmp.n, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %while.body.lr.ph, %middle.block
%ans.07.ph = phi i32 [ 0, %while.body.lr.ph ], [ %9, %middle.block ]
%c.06.ph = phi i32 [ 0, %while.body.lr.ph ], [ %ind.end, %middle.block ]
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%ans.07 = phi i32 [ %inc, %while.body ], [ %ans.07.ph, %while.body.preheader ]
%c.06 = phi i32 [ %add, %while.body ], [ %c.06.ph, %while.body.preheader ]
%add = add nsw i32 %cond.i, %c.06
%inc = add nuw nsw i32 %ans.07, 1
%cmp = icmp slt i32 %add, %0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !14
while.end: ; preds = %while.body, %middle.block, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %9, %middle.block ], [ %inc, %while.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree 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 = !{i64 0, i64 4, !6, i64 4, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include<stdio.h>
#include<string.h>
int main()
{
int a,b,c,d,e;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
d=a>=b? a:b;
if(c%d==0) e=c/d;
else e=c/d+1;
printf("%d\n",e);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165157/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165157/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4
%1 = load i32, ptr %b, align 4
%cond = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%2 = load i32, ptr %c, align 4, !tbaa !5
%rem = srem i32 %2, %cond
%cmp3 = icmp ne i32 %rem, 0
%div = sdiv i32 %2, %cond
%add = zext i1 %cmp3 to i32
%e.0 = add nsw i32 %div, %add
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %e.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,e,c1=0,c2=0,c3=0,c4=0,c6=0,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&e);
switch(e)
{
case 1:c1++;
break;
case 2:c2++;
break;
case 3:c3++;
break;
case 4:c4++;
break;
case 6:c6++;
break;
default:
printf("-1");
return 0;
}
}
if((c3==(c6-c2+c4))&&(c2>=c4)&&(c6-c2+c4>=0)&&(c1==(c4+c6)))
{
for(i=0;i<c4;i++)
printf("1 2 4\n");
for(i=0;i<c2-c4;i++)
printf("1 2 6\n");
for(i=0;i<c3;i++)
printf("1 3 6\n");
}
else
printf("-1");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_16520/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_16520/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@str = private unnamed_addr constant [6 x i8] c"1 3 6\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"1 2 6\00", align 1
@str.6 = private unnamed_addr constant [6 x i8] c"1 2 4\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%e = alloca 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 %e) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp84 = icmp sgt i32 %0, 0
br i1 %cmp84, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.090 = phi i32 [ %inc11, %for.inc ], [ 0, %entry ]
%c6.089 = phi i32 [ %c6.1, %for.inc ], [ 0, %entry ]
%c4.088 = phi i32 [ %c4.1, %for.inc ], [ 0, %entry ]
%c3.087 = phi i32 [ %c3.1, %for.inc ], [ 0, %entry ]
%c2.086 = phi i32 [ %c2.1, %for.inc ], [ 0, %entry ]
%c1.085 = phi i32 [ %c1.1, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %e)
%1 = load i32, ptr %e, align 4, !tbaa !5
switch i32 %1, label %cleanup.sink.split [
i32 1, label %sw.bb
i32 2, label %sw.bb2
i32 3, label %sw.bb4
i32 4, label %sw.bb6
i32 6, label %sw.bb8
]
sw.bb: ; preds = %for.body
%inc = add nsw i32 %c1.085, 1
br label %for.inc
sw.bb2: ; preds = %for.body
%inc3 = add nsw i32 %c2.086, 1
br label %for.inc
sw.bb4: ; preds = %for.body
%inc5 = add nsw i32 %c3.087, 1
br label %for.inc
sw.bb6: ; preds = %for.body
%inc7 = add nsw i32 %c4.088, 1
br label %for.inc
sw.bb8: ; preds = %for.body
%inc9 = add nsw i32 %c6.089, 1
br label %for.inc
for.inc: ; preds = %sw.bb, %sw.bb2, %sw.bb4, %sw.bb6, %sw.bb8
%c1.1 = phi i32 [ %c1.085, %sw.bb8 ], [ %c1.085, %sw.bb6 ], [ %c1.085, %sw.bb4 ], [ %c1.085, %sw.bb2 ], [ %inc, %sw.bb ]
%c2.1 = phi i32 [ %c2.086, %sw.bb8 ], [ %c2.086, %sw.bb6 ], [ %c2.086, %sw.bb4 ], [ %inc3, %sw.bb2 ], [ %c2.086, %sw.bb ]
%c3.1 = phi i32 [ %c3.087, %sw.bb8 ], [ %c3.087, %sw.bb6 ], [ %inc5, %sw.bb4 ], [ %c3.087, %sw.bb2 ], [ %c3.087, %sw.bb ]
%c4.1 = phi i32 [ %c4.088, %sw.bb8 ], [ %inc7, %sw.bb6 ], [ %c4.088, %sw.bb4 ], [ %c4.088, %sw.bb2 ], [ %c4.088, %sw.bb ]
%c6.1 = phi i32 [ %inc9, %sw.bb8 ], [ %c6.089, %sw.bb6 ], [ %c6.089, %sw.bb4 ], [ %c6.089, %sw.bb2 ], [ %c6.089, %sw.bb ]
%inc11 = add nuw nsw i32 %i.090, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc11, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%c1.0.lcssa = phi i32 [ 0, %entry ], [ %c1.1, %for.inc ]
%c2.0.lcssa = phi i32 [ 0, %entry ], [ %c2.1, %for.inc ]
%c3.0.lcssa = phi i32 [ 0, %entry ], [ %c3.1, %for.inc ]
%c4.0.lcssa = phi i32 [ 0, %entry ], [ %c4.1, %for.inc ]
%c6.0.lcssa = phi i32 [ 0, %entry ], [ %c6.1, %for.inc ]
%sub = sub nsw i32 %c6.0.lcssa, %c2.0.lcssa
%add = add nsw i32 %sub, %c4.0.lcssa
%cmp12 = icmp eq i32 %c3.0.lcssa, %add
%cmp13.not = icmp sge i32 %c2.0.lcssa, %c4.0.lcssa
%or.cond.not78 = and i1 %cmp12, %cmp13.not
%cmp17 = icmp sgt i32 %add, -1
%or.cond76 = and i1 %cmp17, %or.cond.not78
%add19 = add nsw i32 %c6.0.lcssa, %c4.0.lcssa
%cmp20 = icmp eq i32 %c1.0.lcssa, %add19
%or.cond77 = select i1 %or.cond76, i1 %cmp20, i1 false
br i1 %or.cond77, label %for.cond21.preheader, label %cleanup.sink.split
for.cond21.preheader: ; preds = %for.end
%cmp2295 = icmp sgt i32 %c4.0.lcssa, 0
br i1 %cmp2295, label %for.body23, label %for.cond28.preheader
for.cond28.preheader: ; preds = %for.body23, %for.cond21.preheader
%sub29 = sub nsw i32 %c2.0.lcssa, %c4.0.lcssa
%cmp3097 = icmp sgt i32 %sub29, 0
br i1 %cmp3097, label %for.body31, label %for.cond36.preheader
for.body23: ; preds = %for.cond21.preheader, %for.body23
%i.196 = phi i32 [ %inc26, %for.body23 ], [ 0, %for.cond21.preheader ]
%puts75 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc26 = add nuw nsw i32 %i.196, 1
%exitcond.not = icmp eq i32 %inc26, %c4.0.lcssa
br i1 %exitcond.not, label %for.cond28.preheader, label %for.body23, !llvm.loop !11
for.cond36.preheader: ; preds = %for.body31, %for.cond28.preheader
%cmp3799 = icmp sgt i32 %c3.0.lcssa, 0
br i1 %cmp3799, label %for.body38, label %cleanup
for.body31: ; preds = %for.cond28.preheader, %for.body31
%i.298 = phi i32 [ %inc34, %for.body31 ], [ 0, %for.cond28.preheader ]
%puts74 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%inc34 = add nuw nsw i32 %i.298, 1
%exitcond101.not = icmp eq i32 %inc34, %sub29
br i1 %exitcond101.not, label %for.cond36.preheader, label %for.body31, !llvm.loop !12
for.body38: ; preds = %for.cond36.preheader, %for.body38
%i.3100 = phi i32 [ %inc41, %for.body38 ], [ 0, %for.cond36.preheader ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%inc41 = add nuw nsw i32 %i.3100, 1
%exitcond102.not = icmp eq i32 %inc41, %c3.0.lcssa
br i1 %exitcond102.not, label %cleanup, label %for.body38, !llvm.loop !13
cleanup.sink.split: ; preds = %for.body, %for.end
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
cleanup: ; preds = %for.body38, %cleanup.sink.split, %for.cond36.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <float.h>
int main(void) {
double v, max = DBL_MIN, min = DBL_MAX;
while(~scanf("%lf", &v)) {
v > max && (max = v);
v < min && (min = v);
}
printf("%f\n", max - min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165243/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165243/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %v) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%tobool.not12 = icmp eq i32 %call11, -1
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%min.014 = phi double [ %min.1, %while.body ], [ 0x7FEFFFFFFFFFFFFF, %entry ]
%max.013 = phi double [ %max.1, %while.body ], [ 0x10000000000000, %entry ]
%0 = load double, ptr %v, align 8, !tbaa !5
%cmp = fcmp ogt double %0, %max.013
%max.1 = select i1 %cmp, double %0, double %max.013
%cmp2 = fcmp olt double %0, %min.014
%min.1 = select i1 %cmp2, double %0, double %min.014
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end.loopexit, label %while.body, !llvm.loop !9
while.end.loopexit: ; preds = %while.body
%1 = fsub double %max.1, %min.1
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%sub = phi double [ 0xFFEFFFFFFFFFFFFF, %entry ], [ %1, %while.end.loopexit ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %v) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
double h[100];
double h_max,h_min;
int n=0;
int i;
while(scanf("%lf",&h[n])!=EOF) {
n++;
}
h_max=h[0];
h_min=h[0];
for(i=0;i<n-1;i++) {
if(h_max<h[i+1]) h_max=h[i+1];
if(h_min>h[i+1]) h_min=h[i+1];
}
printf("%.1lf",h_max-h_min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165294/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165294/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%.1lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca [100 x double], align 16
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %h) #3
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv41 = phi i32 [ %indvars.iv.next42, %while.cond ], [ -1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x double], ptr %h, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%cmp.not = icmp eq i32 %call, -1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next42 = add nsw i32 %indvars.iv41, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !5
while.end: ; preds = %while.cond
%0 = load double, ptr %h, align 16, !tbaa !7
%1 = and i64 %indvars.iv, 4294967294
%cmp332.not = icmp eq i64 %1, 0
br i1 %cmp332.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %while.end
%wide.trip.count = zext i32 %indvars.iv41 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %indvars.iv41, 1
br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv38 = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next39.1, %for.body ]
%h_min.034 = phi double [ %0, %for.body.preheader.new ], [ %h_min.1.1, %for.body ]
%h_max.033 = phi double [ %0, %for.body.preheader.new ], [ %h_max.1.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%indvars.iv.next39 = or i64 %indvars.iv38, 1
%arrayidx5 = getelementptr inbounds [100 x double], ptr %h, i64 0, i64 %indvars.iv.next39
%3 = load double, ptr %arrayidx5, align 8, !tbaa !7
%cmp6 = fcmp olt double %h_max.033, %3
%h_max.1 = select i1 %cmp6, double %3, double %h_max.033
%cmp13 = fcmp ogt double %h_min.034, %3
%h_min.1 = select i1 %cmp13, double %3, double %h_min.034
%indvars.iv.next39.1 = add nuw nsw i64 %indvars.iv38, 2
%arrayidx5.1 = getelementptr inbounds [100 x double], ptr %h, i64 0, i64 %indvars.iv.next39.1
%4 = load double, ptr %arrayidx5.1, align 16, !tbaa !7
%cmp6.1 = fcmp olt double %h_max.1, %4
%h_max.1.1 = select i1 %cmp6.1, double %4, double %h_max.1
%cmp13.1 = fcmp ogt double %h_min.1, %4
%h_min.1.1 = select i1 %cmp13.1, double %4, double %h_min.1
%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.loopexit, label %for.body, !llvm.loop !11
for.end.loopexit.unr-lcssa.loopexit: ; preds = %for.body
%5 = add nuw nsw i64 %indvars.iv38, 3
br label %for.end.loopexit.unr-lcssa
for.end.loopexit.unr-lcssa: ; preds = %for.end.loopexit.unr-lcssa.loopexit, %for.body.preheader
%h_max.1.lcssa.ph = phi double [ undef, %for.body.preheader ], [ %h_max.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%h_min.1.lcssa.ph = phi double [ undef, %for.body.preheader ], [ %h_min.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%indvars.iv38.unr = phi i64 [ 1, %for.body.preheader ], [ %5, %for.end.loopexit.unr-lcssa.loopexit ]
%h_min.034.unr = phi double [ %0, %for.body.preheader ], [ %h_min.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%h_max.033.unr = phi double [ %0, %for.body.preheader ], [ %h_max.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%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
%arrayidx5.epil = getelementptr inbounds [100 x double], ptr %h, i64 0, i64 %indvars.iv38.unr
%6 = load double, ptr %arrayidx5.epil, align 8, !tbaa !7
%cmp6.epil = fcmp olt double %h_max.033.unr, %6
%h_max.1.epil = select i1 %cmp6.epil, double %6, double %h_max.033.unr
%cmp13.epil = fcmp ogt double %h_min.034.unr, %6
%h_min.1.epil = select i1 %cmp13.epil, double %6, double %h_min.034.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %while.end
%h_max.0.lcssa = phi double [ %0, %while.end ], [ %h_max.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %h_max.1.epil, %for.body.epil ]
%h_min.0.lcssa = phi double [ %0, %while.end ], [ %h_min.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %h_min.1.epil, %for.body.epil ]
%sub20 = fsub double %h_max.0.lcssa, %h_min.0.lcssa
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub20)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %h) #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include<stdio.h>
int main(void)
{
double ans_h=0,ans_l=10000000,a,ans=0;
while(scanf("%lf",&a)!=EOF){
if(ans_h < a)ans_h = a;
if(ans_l > a)ans_l = a;
}
ans = ans_h-ans_l;
printf("%lf\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165344/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not10 = icmp eq i32 %call9, -1
br i1 %cmp.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%ans_l.012 = phi double [ %ans_l.1, %while.body ], [ 1.000000e+07, %entry ]
%ans_h.011 = phi double [ %ans_h.1, %while.body ], [ 0.000000e+00, %entry ]
%0 = load double, ptr %a, align 8, !tbaa !5
%cmp1 = fcmp olt double %ans_h.011, %0
%ans_h.1 = select i1 %cmp1, double %0, double %ans_h.011
%cmp2 = fcmp ogt double %ans_l.012, %0
%ans_l.1 = select i1 %cmp2, double %0, double %ans_l.012
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !9
while.end.loopexit: ; preds = %while.body
%1 = fsub double %ans_h.1, %ans_l.1
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%sub = phi double [ -1.000000e+07, %entry ], [ %1, %while.end.loopexit ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
double max,min,input;
scanf("%lf",&input);
min=input;max=input;
while(scanf("%lf",&input)!=EOF){
if(max<input)max=input;
else if(input<min)min=input;
}
printf("%lf\n",max-min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165416/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165416/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %input) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load double, ptr %input, align 8, !tbaa !5
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%cmp.not10 = icmp eq i32 %call19, -1
br i1 %cmp.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end5
%min.012 = phi double [ %min.1, %if.end5 ], [ %0, %entry ]
%max.011 = phi double [ %max.1, %if.end5 ], [ %0, %entry ]
%1 = load double, ptr %input, align 8, !tbaa !5
%cmp2 = fcmp olt double %max.011, %1
br i1 %cmp2, label %if.end5, label %if.else
if.else: ; preds = %while.body
%cmp3 = fcmp olt double %1, %min.012
br i1 %cmp3, label %if.then4, label %if.end5
if.then4: ; preds = %if.else
br label %if.end5
if.end5: ; preds = %while.body, %if.else, %if.then4
%max.1 = phi double [ %max.011, %if.then4 ], [ %max.011, %if.else ], [ %1, %while.body ]
%min.1 = phi double [ %1, %if.then4 ], [ %min.012, %if.else ], [ %min.012, %while.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%cmp.not = icmp eq i32 %call1, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end5, %entry
%max.0.lcssa = phi double [ %0, %entry ], [ %max.1, %if.end5 ]
%min.0.lcssa = phi double [ %0, %entry ], [ %min.1, %if.end5 ]
%sub = fsub double %max.0.lcssa, %min.0.lcssa
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %input) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int inf = 1000000000; // 10^9
int main(){
int h,w;scanf("%d%d",&h,&w);
char s[51][51];
for(int i = 0;i < h;i++){
scanf("%s",s[i]);
}
int ans[51][51] = {0};
for(int i = 0;i < h;i++){
for(int j = 0;j < w;j++){
for(int k = -1;k < 2;k++){
for(int l = -1;l < 2;l++){
if(s[i+k][j+l] == '#')ans[i][j]++;
}
}
}
}
for(int i = 0;i < h;i++){
for(int j = 0;j < w;j++){
if(s[i][j]=='#')printf("#");
else printf("%d",ans[i][j]);
}
printf("\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165467/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165467/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@inf = dso_local local_unnamed_addr constant i32 1000000000, align 4
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = 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:
%h = alloca i32, align 4
%w = alloca i32, align 4
%s = alloca [51 x [51 x i8]], align 16
%ans = alloca [51 x [51 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
call void @llvm.lifetime.start.p0(i64 2601, ptr nonnull %s) #5
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp96 = icmp sgt i32 %0, 0
br i1 %cmp96, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 10404, ptr nonnull %ans) #5
br label %for.cond.cleanup47
for.cond.cleanup: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 10404, ptr nonnull %ans) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10404) %ans, i8 0, i64 10404, i1 false)
%cmp4102 = icmp sgt i32 %24, 0
br i1 %cmp4102, label %for.cond7.preheader.lr.ph, label %for.cond.cleanup47
for.cond7.preheader.lr.ph: ; preds = %for.cond.cleanup
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp8100 = icmp sgt i32 %1, 0
br i1 %cmp8100, label %for.cond7.preheader.us.preheader, label %for.cond50.preheader.preheader
for.cond7.preheader.us.preheader: ; preds = %for.cond7.preheader.lr.ph
%wide.trip.count135 = zext i32 %24 to i64
%wide.trip.count = zext i32 %1 to i64
br label %for.cond7.preheader.us
for.cond7.preheader.us: ; preds = %for.cond7.preheader.us.preheader, %for.cond7.for.cond.cleanup9_crit_edge.us
%indvars.iv132 = phi i64 [ 0, %for.cond7.preheader.us.preheader ], [ %3, %for.cond7.for.cond.cleanup9_crit_edge.us ]
%2 = add nsw i64 %indvars.iv132, -1
%3 = add nuw nsw i64 %indvars.iv132, 1
br label %for.cond11.preheader.us
if.then.us: ; preds = %for.cond11.preheader.us
%4 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us = add nsw i32 %4, 1
store i32 %inc30.us, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us
for.inc31.us: ; preds = %if.then.us, %for.cond11.preheader.us
%arrayidx23.us.1 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %2, i64 %indvars.iv129
%5 = load i8, ptr %arrayidx23.us.1, align 1, !tbaa !9
%cmp24.us.1 = icmp eq i8 %5, 35
br i1 %cmp24.us.1, label %if.then.us.1, label %for.inc31.us.1
if.then.us.1: ; preds = %for.inc31.us
%6 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us.1 = add nsw i32 %6, 1
store i32 %inc30.us.1, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us.1
for.inc31.us.1: ; preds = %if.then.us.1, %for.inc31.us
%7 = add nuw nsw i64 %indvars.iv129, 1
%arrayidx23.us.2 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %2, i64 %7
%8 = load i8, ptr %arrayidx23.us.2, align 1, !tbaa !9
%cmp24.us.2 = icmp eq i8 %8, 35
br i1 %cmp24.us.2, label %if.then.us.2, label %for.inc31.us.2
if.then.us.2: ; preds = %for.inc31.us.1
%9 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us.2 = add nsw i32 %9, 1
store i32 %inc30.us.2, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us.2
for.inc31.us.2: ; preds = %if.then.us.2, %for.inc31.us.1
%arrayidx23.us.1119 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv132, i64 %22
%10 = load i8, ptr %arrayidx23.us.1119, align 1, !tbaa !9
%cmp24.us.1120 = icmp eq i8 %10, 35
br i1 %cmp24.us.1120, label %if.then.us.1122, label %for.inc31.us.1123
if.then.us.1122: ; preds = %for.inc31.us.2
%11 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us.1121 = add nsw i32 %11, 1
store i32 %inc30.us.1121, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us.1123
for.inc31.us.1123: ; preds = %if.then.us.1122, %for.inc31.us.2
%arrayidx23.us.1.1 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv132, i64 %indvars.iv129
%12 = load i8, ptr %arrayidx23.us.1.1, align 1, !tbaa !9
%cmp24.us.1.1 = icmp eq i8 %12, 35
br i1 %cmp24.us.1.1, label %if.then.us.1.1, label %for.inc31.us.1.1
if.then.us.1.1: ; preds = %for.inc31.us.1123
%13 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us.1.1 = add nsw i32 %13, 1
store i32 %inc30.us.1.1, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us.1.1
for.inc31.us.1.1: ; preds = %if.then.us.1.1, %for.inc31.us.1123
%arrayidx23.us.2.1 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv132, i64 %7
%14 = load i8, ptr %arrayidx23.us.2.1, align 1, !tbaa !9
%cmp24.us.2.1 = icmp eq i8 %14, 35
br i1 %cmp24.us.2.1, label %if.then.us.2.1, label %for.inc31.us.2.1
if.then.us.2.1: ; preds = %for.inc31.us.1.1
%15 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us.2.1 = add nsw i32 %15, 1
store i32 %inc30.us.2.1, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us.2.1
for.inc31.us.2.1: ; preds = %if.then.us.2.1, %for.inc31.us.1.1
%arrayidx23.us.2124 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %3, i64 %22
%16 = load i8, ptr %arrayidx23.us.2124, align 1, !tbaa !9
%cmp24.us.2125 = icmp eq i8 %16, 35
br i1 %cmp24.us.2125, label %if.then.us.2127, label %for.inc31.us.2128
if.then.us.2127: ; preds = %for.inc31.us.2.1
%17 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us.2126 = add nsw i32 %17, 1
store i32 %inc30.us.2126, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us.2128
for.inc31.us.2128: ; preds = %if.then.us.2127, %for.inc31.us.2.1
%arrayidx23.us.1.2 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %3, i64 %indvars.iv129
%18 = load i8, ptr %arrayidx23.us.1.2, align 1, !tbaa !9
%cmp24.us.1.2 = icmp eq i8 %18, 35
br i1 %cmp24.us.1.2, label %if.then.us.1.2, label %for.inc31.us.1.2
if.then.us.1.2: ; preds = %for.inc31.us.2128
%19 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us.1.2 = add nsw i32 %19, 1
store i32 %inc30.us.1.2, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us.1.2
for.inc31.us.1.2: ; preds = %if.then.us.1.2, %for.inc31.us.2128
%arrayidx23.us.2.2 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %3, i64 %7
%20 = load i8, ptr %arrayidx23.us.2.2, align 1, !tbaa !9
%cmp24.us.2.2 = icmp eq i8 %20, 35
br i1 %cmp24.us.2.2, label %if.then.us.2.2, label %for.inc31.us.2.2
if.then.us.2.2: ; preds = %for.inc31.us.1.2
%21 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%inc30.us.2.2 = add nsw i32 %21, 1
store i32 %inc30.us.2.2, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc31.us.2.2
for.inc31.us.2.2: ; preds = %if.then.us.2.2, %for.inc31.us.1.2
%exitcond.not = icmp eq i64 %7, %wide.trip.count
br i1 %exitcond.not, label %for.cond7.for.cond.cleanup9_crit_edge.us, label %for.cond11.preheader.us, !llvm.loop !10
for.cond11.preheader.us: ; preds = %for.cond7.preheader.us, %for.inc31.us.2.2
%indvars.iv129 = phi i64 [ 0, %for.cond7.preheader.us ], [ %7, %for.inc31.us.2.2 ]
%arrayidx29.us = getelementptr inbounds [51 x [51 x i32]], ptr %ans, i64 0, i64 %indvars.iv132, i64 %indvars.iv129
%22 = add nsw i64 %indvars.iv129, -1
%arrayidx23.us = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %2, i64 %22
%23 = load i8, ptr %arrayidx23.us, align 1, !tbaa !9
%cmp24.us = icmp eq i8 %23, 35
br i1 %cmp24.us, label %if.then.us, label %for.inc31.us
for.cond7.for.cond.cleanup9_crit_edge.us: ; preds = %for.inc31.us.2.2
%exitcond136.not = icmp eq i64 %3, %wide.trip.count135
br i1 %exitcond136.not, label %for.cond44.preheader, label %for.cond7.preheader.us, !llvm.loop !12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 x [51 x i8]], ptr %s, 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
%24 = load i32, ptr %h, align 4, !tbaa !5
%25 = sext i32 %24 to i64
%cmp = icmp slt i64 %indvars.iv.next, %25
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond44.preheader: ; preds = %for.cond7.for.cond.cleanup9_crit_edge.us
br i1 %cmp4102, label %for.cond50.preheader.preheader, label %for.cond.cleanup47
for.cond50.preheader.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.cond44.preheader
br label %for.cond50.preheader
for.cond50.preheader: ; preds = %for.cond50.preheader.preheader, %for.cond.cleanup53
%indvars.iv140 = phi i64 [ %indvars.iv.next141, %for.cond.cleanup53 ], [ 0, %for.cond50.preheader.preheader ]
%26 = load i32, ptr %w, align 4, !tbaa !5
%cmp51104 = icmp sgt i32 %26, 0
br i1 %cmp51104, label %for.body54, label %for.cond.cleanup53
for.cond.cleanup47: ; preds = %for.cond.cleanup53, %for.cond.cleanup, %for.cond.cleanup.thread, %for.cond44.preheader
call void @llvm.lifetime.end.p0(i64 10404, ptr nonnull %ans) #5
call void @llvm.lifetime.end.p0(i64 2601, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
for.cond.cleanup53: ; preds = %for.inc70, %for.cond50.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%27 = load i32, ptr %h, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp45 = icmp slt i64 %indvars.iv.next141, %28
br i1 %cmp45, label %for.cond50.preheader, label %for.cond.cleanup47, !llvm.loop !14
for.body54: ; preds = %for.cond50.preheader, %for.inc70
%indvars.iv137 = phi i64 [ %indvars.iv.next138, %for.inc70 ], [ 0, %for.cond50.preheader ]
%arrayidx58 = getelementptr inbounds [51 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv140, i64 %indvars.iv137
%29 = load i8, ptr %arrayidx58, align 1, !tbaa !9
%cmp60 = icmp eq i8 %29, 35
br i1 %cmp60, label %if.then62, label %if.else
if.then62: ; preds = %for.body54
%putchar95 = call i32 @putchar(i32 35)
br label %for.inc70
if.else: ; preds = %for.body54
%arrayidx67 = getelementptr inbounds [51 x [51 x i32]], ptr %ans, i64 0, i64 %indvars.iv140, i64 %indvars.iv137
%30 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%call68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %30)
br label %for.inc70
for.inc70: ; preds = %if.then62, %if.else
%indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
%31 = load i32, ptr %w, align 4, !tbaa !5
%32 = sext i32 %31 to i64
%cmp51 = icmp slt i64 %indvars.iv.next138, %32
br i1 %cmp51, label %for.body54, label %for.cond.cleanup53, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
|
#include <stdio.h>
int main(void)
{
int h, w;
char s[50][51];
scanf("%d %d", &h, &w);
for (int i = 0; i < h; i++)
scanf("%s", s[i]);
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
int count = 0;
if (s[i][j] == '#') {
putchar('#');
}
else {
for (int a = i - 1; a <= i + 1; a++) {
for (int b = j - 1; b <= j + 1; b++) {
if (s[a][b] == '#')
count++;
}
}
printf("%d", count);
}
}
putchar('\n');
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165517/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165517/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%s = alloca [50 x [51 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 2550, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp70 = icmp sgt i32 %0, 0
br i1 %cmp70, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.cond7.preheader, label %for.cond.cleanup5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %h, 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.cond3.preheader, !llvm.loop !9
for.cond7.preheader: ; preds = %for.cond3.preheader, %for.cond.cleanup9
%indvars.iv107 = phi i64 [ %indvars.iv.next108, %for.cond.cleanup9 ], [ 0, %for.cond3.preheader ]
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.cond.cleanup9 ], [ -1, %for.cond3.preheader ]
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp876 = icmp sgt i32 %4, 0
br i1 %cmp876, label %for.body10.lr.ph, label %for.cond.cleanup9
for.body10.lr.ph: ; preds = %for.cond7.preheader
%indvars.iv.next91 = add nsw i64 %indvars.iv88, 1
%indvars.iv.next91.1 = add nsw i64 %indvars.iv88, 2
br label %for.body10
for.cond.cleanup5: ; preds = %for.cond.cleanup9, %entry, %for.cond3.preheader
call void @llvm.lifetime.end.p0(i64 2550, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
for.cond.cleanup9: ; preds = %if.end46, %for.cond7.preheader
%5 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %5)
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%6 = load i32, ptr %h, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4 = icmp slt i64 %indvars.iv.next108, %7
%indvars.iv.next89 = add nsw i64 %indvars.iv88, 1
br i1 %cmp4, label %for.cond7.preheader, label %for.cond.cleanup5, !llvm.loop !13
for.body10: ; preds = %for.body10.lr.ph, %if.end46
%indvars.iv104 = phi i64 [ 0, %for.body10.lr.ph ], [ %indvars.iv.next105, %if.end46 ]
%indvars.iv81 = phi i64 [ -1, %for.body10.lr.ph ], [ %indvars.iv.next82.pre-phi, %if.end46 ]
%arrayidx14 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv107, i64 %indvars.iv104
%8 = load i8, ptr %arrayidx14, align 1, !tbaa !14
%cmp15 = icmp eq i8 %8, 35
br i1 %cmp15, label %if.then, label %if.else
if.then: ; preds = %for.body10
%9 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i69 = call i32 @putc(i32 noundef 35, ptr noundef %9)
%.pre = add nsw i64 %indvars.iv81, 1
br label %if.end46
if.else: ; preds = %for.body10
%arrayidx33 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv88, i64 %indvars.iv81
%indvars.iv.next84 = add nsw i64 %indvars.iv81, 1
%10 = load <2 x i8>, ptr %arrayidx33, align 1, !tbaa !14
%indvars.iv.next84.1 = add nsw i64 %indvars.iv81, 2
%arrayidx33.2 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv88, i64 %indvars.iv.next84.1
%11 = load i8, ptr %arrayidx33.2, align 1, !tbaa !14
%arrayidx33.195 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv.next91, i64 %indvars.iv81
%12 = load i8, ptr %arrayidx33.195, align 1, !tbaa !14
%arrayidx33.1.1 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv.next91, i64 %indvars.iv.next84
%13 = load <2 x i8>, ptr %arrayidx33.1.1, align 1, !tbaa !14
%arrayidx33.2100 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv.next91.1, i64 %indvars.iv81
%14 = load <2 x i8>, ptr %arrayidx33.2100, align 1, !tbaa !14
%15 = shufflevector <2 x i8> %10, <2 x i8> poison, <8 x i32> <i32 1, i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%16 = insertelement <8 x i8> %15, i8 %11, i64 2
%17 = insertelement <8 x i8> %16, i8 %12, i64 3
%18 = shufflevector <2 x i8> %13, <2 x i8> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%19 = shufflevector <8 x i8> %17, <8 x i8> %18, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 poison, i32 poison>
%20 = shufflevector <2 x i8> %14, <2 x i8> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%21 = shufflevector <8 x i8> %19, <8 x i8> %20, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 8, i32 9>
%22 = icmp eq <8 x i8> %21, <i8 35, i8 35, i8 35, i8 35, i8 35, i8 35, i8 35, i8 35>
%arrayidx33.2.2 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv.next91.1, i64 %indvars.iv.next84.1
%23 = load i8, ptr %arrayidx33.2.2, align 1, !tbaa !14
%cmp35.2.2 = icmp eq i8 %23, 35
%inc38.2.2 = zext i1 %cmp35.2.2 to i32
%24 = bitcast <8 x i1> %22 to i8
%25 = call i8 @llvm.ctpop.i8(i8 %24), !range !15
%26 = zext i8 %25 to i32
%op.rdx = add nuw nsw i32 %26, %inc38.2.2
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %op.rdx)
br label %if.end46
if.end46: ; preds = %if.else, %if.then
%indvars.iv.next82.pre-phi = phi i64 [ %indvars.iv.next84, %if.else ], [ %.pre, %if.then ]
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%27 = load i32, ptr %w, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp8 = icmp slt i64 %indvars.iv.next105, %28
br i1 %cmp8, label %for.body10, label %for.cond.cleanup9, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.ctpop.i8(i8) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{!7, !7, i64 0}
!15 = !{i8 0, i8 9}
!16 = distinct !{!16, !10}
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
int h, w;
scanf("%d %d", &h, &w);
char foo[51][51];
for (int i = 0; i < h; ++i) {
scanf("%s", foo[i]);
}
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
if (foo[i][j] == '#') {
putchar('#');
continue;
}
int count = 0;
if (i != 0) {
count += foo[i - 1][j] == '#' ? 1 : 0;
if (j != w - 1) {
count += foo[i - 1][j + 1] == '#' ? 1 : 0;
}
if (j != 0) {
count += foo[i - 1][j - 1] == '#' ? 1 : 0;
}
}
if (j != 0) {
count += foo[i][j - 1] == '#' ? 1 : 0;
if (i != h - 1) {
count += foo[i + 1][j - 1] == '#' ? 1 : 0;
}
}
if (i != h - 1) {
count += foo[i + 1][j] == '#' ? 1 : 0;
if (j != w - 1) {
count += foo[i + 1][j + 1] == '#' ? 1 : 0;
}
}
if (j != w - 1) {
count += foo[i][j + 1] == '#' ? 1 : 0;
}
putchar(count + '0');
}
putchar('\n');
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165560/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165560/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%foo = alloca [51 x [51 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
call void @llvm.lifetime.start.p0(i64 2601, ptr nonnull %foo) #3
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp191 = icmp sgt i32 %0, 0
br i1 %cmp191, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp4196 = icmp sgt i32 %1, 0
br i1 %cmp4196, label %for.cond7.preheader, label %for.cond.cleanup5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 x [51 x i8]], ptr %foo, 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 %h, 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.cond3.preheader, !llvm.loop !9
for.cond7.preheader: ; preds = %for.cond3.preheader, %for.cond.cleanup9
%3 = phi i32 [ %17, %for.cond.cleanup9 ], [ %1, %for.cond3.preheader ]
%indvars.iv208 = phi i64 [ %indvars.iv.next209.pre-phi, %for.cond.cleanup9 ], [ 0, %for.cond3.preheader ]
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp8193 = icmp sgt i32 %4, 0
br i1 %cmp8193, label %for.body10.lr.ph, label %for.cond7.preheader.for.cond.cleanup9_crit_edge
for.cond7.preheader.for.cond.cleanup9_crit_edge: ; preds = %for.cond7.preheader
%.pre214 = add nuw nsw i64 %indvars.iv208, 1
br label %for.cond.cleanup9
for.body10.lr.ph: ; preds = %for.cond7.preheader
%cmp18.not = icmp eq i64 %indvars.iv208, 0
%5 = add nsw i64 %indvars.iv208, -1
%6 = add nuw nsw i64 %indvars.iv208, 1
%arrayidx14.peel = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %indvars.iv208, i64 0
%7 = load i8, ptr %arrayidx14.peel, align 1, !tbaa !11
%cmp15.peel = icmp eq i8 %7, 35
br i1 %cmp15.peel, label %for.inc138.peel, label %if.end.peel
if.end.peel: ; preds = %for.body10.lr.ph
br i1 %cmp18.not, label %if.end89.peel, label %if.then20.peel
if.then20.peel: ; preds = %if.end.peel
%arrayidx24.peel = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %5, i64 0
%8 = load i8, ptr %arrayidx24.peel, align 1, !tbaa !11
%cmp26.peel = icmp eq i8 %8, 35
%cond.peel = zext i1 %cmp26.peel to i32
%cmp29.not.peel = icmp eq i32 %4, 1
br i1 %cmp29.not.peel, label %if.end89.peel, label %if.then31.peel
if.then31.peel: ; preds = %if.then20.peel
%arrayidx37.peel = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %5, i64 1
%9 = load i8, ptr %arrayidx37.peel, align 1, !tbaa !11
%cmp39.peel = icmp eq i8 %9, 35
%cond41.peel = zext i1 %cmp39.peel to i32
%add42.peel = add nuw nsw i32 %cond41.peel, %cond.peel
br label %if.end89.peel
if.end89.peel: ; preds = %if.end.peel, %if.then20.peel, %if.then31.peel
%count.2.peel = phi i32 [ %add42.peel, %if.then31.peel ], [ %cond.peel, %if.then20.peel ], [ 0, %if.end.peel ]
%sub90.peel = add nsw i32 %3, -1
%10 = zext i32 %sub90.peel to i64
%cmp91.not.peel = icmp eq i64 %indvars.iv208, %10
br i1 %cmp91.not.peel, label %if.end120.peel, label %if.then93.peel
if.then93.peel: ; preds = %if.end89.peel
%arrayidx98.peel = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %6, i64 0
%11 = load i8, ptr %arrayidx98.peel, align 1, !tbaa !11
%cmp100.peel = icmp eq i8 %11, 35
%cond102.peel = zext i1 %cmp100.peel to i32
%add103.peel = add nuw nsw i32 %count.2.peel, %cond102.peel
%cmp105.not.peel = icmp eq i32 %4, 1
br i1 %cmp105.not.peel, label %if.end135.peel, label %if.end120.peel.thread227
if.end120.peel.thread227: ; preds = %if.then93.peel
%arrayidx113.peel = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %6, i64 1
%12 = load i8, ptr %arrayidx113.peel, align 1, !tbaa !11
%cmp115.peel = icmp eq i8 %12, 35
%cond117.peel = zext i1 %cmp115.peel to i32
%add118.peel = add nuw nsw i32 %add103.peel, %cond117.peel
br label %if.then124.peel
if.end120.peel: ; preds = %if.end89.peel
%cmp122.not.peel = icmp eq i32 %4, 1
br i1 %cmp122.not.peel, label %if.end135.peel, label %if.then124.peel
if.then124.peel: ; preds = %if.end120.peel.thread227, %if.end120.peel
%count.3.peel231 = phi i32 [ %add118.peel, %if.end120.peel.thread227 ], [ %count.2.peel, %if.end120.peel ]
%arrayidx129.peel = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %indvars.iv208, i64 1
%13 = load i8, ptr %arrayidx129.peel, align 1, !tbaa !11
%cmp131.peel = icmp eq i8 %13, 35
%cond133.peel = zext i1 %cmp131.peel to i32
%add134.peel = add nuw nsw i32 %count.3.peel231, %cond133.peel
br label %if.end135.peel
if.end135.peel: ; preds = %if.then93.peel, %if.then124.peel, %if.end120.peel
%count.4.peel = phi i32 [ %add134.peel, %if.then124.peel ], [ %count.2.peel, %if.end120.peel ], [ %add103.peel, %if.then93.peel ]
%add136.peel = add nuw nsw i32 %count.4.peel, 48
br label %for.inc138.peel
for.inc138.peel: ; preds = %for.body10.lr.ph, %if.end135.peel
%.sink = phi i32 [ %add136.peel, %if.end135.peel ], [ 35, %for.body10.lr.ph ]
%14 = load ptr, ptr @stdout, align 8, !tbaa !12
%call.i183.peel = call i32 @putc(i32 noundef %.sink, ptr noundef %14)
%15 = load i32, ptr %w, align 4, !tbaa !5
%cmp8.peel = icmp sgt i32 %15, 1
br i1 %cmp8.peel, label %for.body10, label %for.cond.cleanup9
for.cond.cleanup5: ; preds = %for.cond.cleanup9, %entry, %for.cond3.preheader
call void @llvm.lifetime.end.p0(i64 2601, ptr nonnull %foo) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
for.cond.cleanup9: ; preds = %for.inc138, %for.inc138.peel, %for.cond7.preheader.for.cond.cleanup9_crit_edge
%indvars.iv.next209.pre-phi = phi i64 [ %.pre214, %for.cond7.preheader.for.cond.cleanup9_crit_edge ], [ %6, %for.inc138.peel ], [ %6, %for.inc138 ]
%16 = load ptr, ptr @stdout, align 8, !tbaa !12
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %16)
%17 = load i32, ptr %h, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp4 = icmp slt i64 %indvars.iv.next209.pre-phi, %18
br i1 %cmp4, label %for.cond7.preheader, label %for.cond.cleanup5, !llvm.loop !14
for.body10: ; preds = %for.inc138.peel, %for.inc138
%indvars.iv199 = phi i64 [ %indvars.iv.next200, %for.inc138 ], [ 1, %for.inc138.peel ]
%19 = phi i32 [ %40, %for.inc138 ], [ %15, %for.inc138.peel ]
%arrayidx14 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %indvars.iv208, i64 %indvars.iv199
%20 = load i8, ptr %arrayidx14, align 1, !tbaa !11
%cmp15 = icmp eq i8 %20, 35
br i1 %cmp15, label %for.inc138, label %if.end
if.end: ; preds = %for.body10
br i1 %cmp18.not, label %if.end59.if.then62_crit_edge, label %if.then20
if.then20: ; preds = %if.end
%arrayidx24 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %5, i64 %indvars.iv199
%21 = load i8, ptr %arrayidx24, align 1, !tbaa !11
%cmp26 = icmp eq i8 %21, 35
%cond = zext i1 %cmp26 to i32
%sub28 = add nsw i32 %19, -1
%22 = zext i32 %sub28 to i64
%cmp29.not = icmp eq i64 %indvars.iv199, %22
br i1 %cmp29.not, label %if.end59.thread187, label %if.then31
if.then31: ; preds = %if.then20
%23 = add nuw nsw i64 %indvars.iv199, 1
%arrayidx37 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %5, i64 %23
%24 = load i8, ptr %arrayidx37, align 1, !tbaa !11
%cmp39 = icmp eq i8 %24, 35
%cond41 = zext i1 %cmp39 to i32
%add42 = add nuw nsw i32 %cond41, %cond
br label %if.end59.thread187
if.end59.thread187: ; preds = %if.then20, %if.then31
%count.0 = phi i32 [ %add42, %if.then31 ], [ %cond, %if.then20 ]
%25 = add nsw i64 %indvars.iv199, -1
%arrayidx52 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %5, i64 %25
%26 = load i8, ptr %arrayidx52, align 1, !tbaa !11
%cmp54 = icmp eq i8 %26, 35
%cond56 = zext i1 %cmp54 to i32
%add57 = add nuw nsw i32 %count.0, %cond56
br label %if.then62
if.end59.if.then62_crit_edge: ; preds = %if.end
%.pre218 = add nsw i64 %indvars.iv199, -1
br label %if.then62
if.then62: ; preds = %if.end59.if.then62_crit_edge, %if.end59.thread187
%.pre-phi219 = phi i64 [ %.pre218, %if.end59.if.then62_crit_edge ], [ %25, %if.end59.thread187 ]
%count.1190 = phi i32 [ 0, %if.end59.if.then62_crit_edge ], [ %add57, %if.end59.thread187 ]
%arrayidx67 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %indvars.iv208, i64 %.pre-phi219
%27 = load i8, ptr %arrayidx67, align 1, !tbaa !11
%cmp69 = icmp eq i8 %27, 35
%cond71 = zext i1 %cmp69 to i32
%add72 = add nuw nsw i32 %count.1190, %cond71
%28 = load i32, ptr %h, align 4, !tbaa !5
%sub73 = add nsw i32 %28, -1
%29 = zext i32 %sub73 to i64
%cmp74.not = icmp eq i64 %indvars.iv208, %29
br i1 %cmp74.not, label %if.end89, label %if.then76
if.then76: ; preds = %if.then62
%arrayidx82 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %6, i64 %.pre-phi219
%30 = load i8, ptr %arrayidx82, align 1, !tbaa !11
%cmp84 = icmp eq i8 %30, 35
%cond86 = zext i1 %cmp84 to i32
%add87 = add nuw nsw i32 %add72, %cond86
br label %if.end89
if.end89: ; preds = %if.then62, %if.then76
%count.2 = phi i32 [ %add87, %if.then76 ], [ %add72, %if.then62 ]
%31 = load i32, ptr %h, align 4, !tbaa !5
%sub90 = add nsw i32 %31, -1
%32 = zext i32 %sub90 to i64
%cmp91.not = icmp eq i64 %indvars.iv208, %32
br i1 %cmp91.not, label %if.end89.if.end120_crit_edge, label %if.then93
if.end89.if.end120_crit_edge: ; preds = %if.end89
%.pre215 = add nsw i32 %19, -1
%.pre216 = zext i32 %.pre215 to i64
br label %if.end120
if.then93: ; preds = %if.end89
%arrayidx98 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %6, i64 %indvars.iv199
%33 = load i8, ptr %arrayidx98, align 1, !tbaa !11
%cmp100 = icmp eq i8 %33, 35
%cond102 = zext i1 %cmp100 to i32
%add103 = add nuw nsw i32 %count.2, %cond102
%sub104 = add nsw i32 %19, -1
%34 = zext i32 %sub104 to i64
%cmp105.not = icmp eq i64 %indvars.iv199, %34
br i1 %cmp105.not, label %if.end120, label %if.then107
if.then107: ; preds = %if.then93
%35 = add nuw nsw i64 %indvars.iv199, 1
%arrayidx113 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %6, i64 %35
%36 = load i8, ptr %arrayidx113, align 1, !tbaa !11
%cmp115 = icmp eq i8 %36, 35
%cond117 = zext i1 %cmp115 to i32
%add118 = add nuw nsw i32 %add103, %cond117
br label %if.end120
if.end120: ; preds = %if.end89.if.end120_crit_edge, %if.then93, %if.then107
%.pre-phi217 = phi i64 [ %.pre216, %if.end89.if.end120_crit_edge ], [ %34, %if.then93 ], [ %34, %if.then107 ]
%count.3 = phi i32 [ %count.2, %if.end89.if.end120_crit_edge ], [ %add103, %if.then93 ], [ %add118, %if.then107 ]
%cmp122.not = icmp eq i64 %indvars.iv199, %.pre-phi217
br i1 %cmp122.not, label %if.end135, label %if.then124
if.then124: ; preds = %if.end120
%37 = add nuw nsw i64 %indvars.iv199, 1
%arrayidx129 = getelementptr inbounds [51 x [51 x i8]], ptr %foo, i64 0, i64 %indvars.iv208, i64 %37
%38 = load i8, ptr %arrayidx129, align 1, !tbaa !11
%cmp131 = icmp eq i8 %38, 35
%cond133 = zext i1 %cmp131 to i32
%add134 = add nuw nsw i32 %count.3, %cond133
br label %if.end135
if.end135: ; preds = %if.then124, %if.end120
%count.4 = phi i32 [ %add134, %if.then124 ], [ %count.3, %if.end120 ]
%add136 = add nuw nsw i32 %count.4, 48
br label %for.inc138
for.inc138: ; preds = %for.body10, %if.end135
%add136.sink = phi i32 [ %add136, %if.end135 ], [ 35, %for.body10 ]
%39 = load ptr, ptr @stdout, align 8, !tbaa !12
%call.i184 = call i32 @putc(i32 noundef %add136.sink, ptr noundef %39)
%indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
%40 = load i32, ptr %w, align 4, !tbaa !5
%41 = sext i32 %40 to i64
%cmp8 = icmp slt i64 %indvars.iv.next200, %41
br i1 %cmp8, label %for.body10, label %for.cond.cleanup9, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#include <string.h>
char s[50][51] = { 0 };
int main(void) {
int H, W;
scanf("%d %d", &H, &W);
for (int i = 0; i < H; i++) scanf("%s", &s[i]);
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
int cnt = 0;
for (int k = i - 1; k <= i + 1; k++) {
for (int l = j - 1; l <= j + 1; l++) {
if (s[k][l] == '#') cnt++;
}
}
if (s[i][j] == '.') printf("%d", cnt);
else printf("%c", s[i][j]);
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165610/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165610/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@s = dso_local global [50 x [51 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp75 = icmp sgt i32 %0, 0
br i1 %cmp75, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.cond7.preheader, label %for.cond.cleanup5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x [51 x i8]], ptr @s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %H, 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.cond3.preheader, !llvm.loop !9
for.cond7.preheader: ; preds = %for.cond3.preheader, %for.cond.cleanup9
%indvars.iv112 = phi i64 [ %indvars.iv.next113, %for.cond.cleanup9 ], [ 0, %for.cond3.preheader ]
%indvars.iv93 = phi i64 [ %indvars.iv.next96, %for.cond.cleanup9 ], [ -1, %for.cond3.preheader ]
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp881 = icmp sgt i32 %4, 0
%indvars.iv.next96 = add nsw i64 %indvars.iv93, 1
br i1 %cmp881, label %for.body10.lr.ph, label %for.cond.cleanup9
for.body10.lr.ph: ; preds = %for.cond7.preheader
%indvars.iv.next96.1 = add nsw i64 %indvars.iv93, 2
br label %for.body10
for.cond.cleanup5: ; preds = %for.cond.cleanup9, %entry, %for.cond3.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #5
ret i32 0
for.cond.cleanup9: ; preds = %if.end49, %for.cond7.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%5 = load i32, ptr %H, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp4 = icmp slt i64 %indvars.iv.next113, %6
br i1 %cmp4, label %for.cond7.preheader, label %for.cond.cleanup5, !llvm.loop !11
for.body10: ; preds = %for.body10.lr.ph, %if.end49
%indvars.iv109 = phi i64 [ 0, %for.body10.lr.ph ], [ %indvars.iv.next110, %if.end49 ]
%indvars.iv86 = phi i64 [ -1, %for.body10.lr.ph ], [ %indvars.iv.next89, %if.end49 ]
%indvars.iv.next89 = add nsw i64 %indvars.iv86, 1
%arrayidx37 = getelementptr inbounds [50 x [51 x i8]], ptr @s, i64 0, i64 %indvars.iv112, i64 %indvars.iv109
%7 = load i8, ptr %arrayidx37, align 1, !tbaa !12
%cmp39 = icmp eq i8 %7, 46
br i1 %cmp39, label %if.then41, label %if.else
if.then41: ; preds = %for.body10
%arrayidx24 = getelementptr inbounds [50 x [51 x i8]], ptr @s, i64 0, i64 %indvars.iv93, i64 %indvars.iv86
%8 = load <2 x i8>, ptr %arrayidx24, align 1, !tbaa !12
%indvars.iv.next89.1 = add nsw i64 %indvars.iv86, 2
%arrayidx24.2 = getelementptr inbounds [50 x [51 x i8]], ptr @s, i64 0, i64 %indvars.iv93, i64 %indvars.iv.next89.1
%9 = load i8, ptr %arrayidx24.2, align 1, !tbaa !12
%arrayidx24.1100 = getelementptr inbounds [50 x [51 x i8]], ptr @s, i64 0, i64 %indvars.iv.next96, i64 %indvars.iv86
%10 = load i8, ptr %arrayidx24.1100, align 1, !tbaa !12
%arrayidx24.1.1 = getelementptr inbounds [50 x [51 x i8]], ptr @s, i64 0, i64 %indvars.iv.next96, i64 %indvars.iv.next89
%11 = load <2 x i8>, ptr %arrayidx24.1.1, align 1, !tbaa !12
%arrayidx24.2105 = getelementptr inbounds [50 x [51 x i8]], ptr @s, i64 0, i64 %indvars.iv.next96.1, i64 %indvars.iv86
%12 = load <2 x i8>, ptr %arrayidx24.2105, align 1, !tbaa !12
%13 = shufflevector <2 x i8> %8, <2 x i8> poison, <8 x i32> <i32 1, i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%14 = insertelement <8 x i8> %13, i8 %9, i64 2
%15 = insertelement <8 x i8> %14, i8 %10, i64 3
%16 = shufflevector <2 x i8> %11, <2 x i8> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%17 = shufflevector <8 x i8> %15, <8 x i8> %16, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 poison, i32 poison>
%18 = shufflevector <2 x i8> %12, <2 x i8> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%19 = shufflevector <8 x i8> %17, <8 x i8> %18, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 8, i32 9>
%20 = icmp eq <8 x i8> %19, <i8 35, i8 35, i8 35, i8 35, i8 35, i8 35, i8 35, i8 35>
%arrayidx24.2.2 = getelementptr inbounds [50 x [51 x i8]], ptr @s, i64 0, i64 %indvars.iv.next96.1, i64 %indvars.iv.next89.1
%21 = load i8, ptr %arrayidx24.2.2, align 1, !tbaa !12
%cmp25.2.2 = icmp eq i8 %21, 35
%inc27.2.2 = zext i1 %cmp25.2.2 to i32
%22 = bitcast <8 x i1> %20 to i8
%23 = call i8 @llvm.ctpop.i8(i8 %22), !range !13
%24 = zext i8 %23 to i32
%op.rdx = add nuw nsw i32 %24, %inc27.2.2
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %op.rdx)
br label %if.end49
if.else: ; preds = %for.body10
%conv38 = sext i8 %7 to i32
%putchar74 = call i32 @putchar(i32 %conv38)
br label %if.end49
if.end49: ; preds = %if.else, %if.then41
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%25 = load i32, ptr %W, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp8 = icmp slt i64 %indvars.iv.next110, %26
br i1 %cmp8, label %for.body10, label %for.cond.cleanup9, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.ctpop.i8(i8) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = !{i8 0, i8 9}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(void)
{
int a, b, c, d, s, o;
scanf("%d%d%d%d",&a,&b,&c,&d);
if(a<c)
s=c;
else
s=a;
if(b<d)
o=b;
else
o=d;
if(s<o)
printf("%d\n",o-s);
else
printf("0\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165654/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165654/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [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
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%o.0 = call i32 @llvm.smin.i32(i32 %2, i32 %3)
%cmp5 = icmp slt i32 %., %o.0
br i1 %cmp5, label %if.then6, label %if.else8
if.then6: ; preds = %entry
%sub = sub nsw i32 %o.0, %.
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
br label %if.end10
if.else8: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end10
if.end10: ; preds = %if.else8, %if.then6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; 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>
int main() {
int a, b, c, d;
scanf("%d%d%d%d", &a, &b, &c, &d);
if (c > b || a > d) {
printf("0\n");
}
else if (c < a && d < b ) {
printf("%d\n", d-a);
}
else if (c < a && d > b ) {
printf("%d\n", b-a);
}
else if (c > a && d > b ) {
printf("%d\n", b-c);
}
else if (c > a && d < b ) {
printf("%d\n", d-c);
}
else if (a > c && b == b) {
printf("%d\n", d-a);
}
else if (a < c && b == d) {
printf("%d\n", b-c);
}
else if (a == c && b == d) {
printf("%d\n", b-c);
}
else if (a == c && b > d) {
printf("%d\n", d-a);
}
else if (a == c && b < d) {
printf("%d\n", b-c);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165704/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.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
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %2, %3
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %lor.lhs.false, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end71
if.else: ; preds = %lor.lhs.false
%cmp3 = icmp slt i32 %0, %2
%cmp4 = icmp slt i32 %3, %1
%or.cond = and i1 %cmp3, %cmp4
br i1 %or.cond, label %if.then5, label %if.else7
if.then5: ; preds = %if.else
%sub = sub nsw i32 %3, %2
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
br label %if.end71
if.else7: ; preds = %if.else
br i1 %cmp3, label %land.lhs.true9, label %if.else14.thread
land.lhs.true9: ; preds = %if.else7
%cmp10 = icmp sgt i32 %3, %1
br i1 %cmp10, label %if.then11, label %if.then32
if.then11: ; preds = %land.lhs.true9
%sub12 = sub nsw i32 %1, %2
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub12)
br label %if.end71
if.else14.thread: ; preds = %if.else7
%cmp1590 = icmp sgt i32 %0, %2
br i1 %cmp1590, label %land.lhs.true16, label %if.else42
land.lhs.true16: ; preds = %if.else14.thread
%cmp17 = icmp sgt i32 %3, %1
br i1 %cmp17, label %if.then18, label %land.lhs.true23
if.then18: ; preds = %land.lhs.true16
%sub19 = sub nsw i32 %1, %0
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub19)
br label %if.end71
land.lhs.true23: ; preds = %land.lhs.true16
br i1 %cmp4, label %if.then25, label %land.lhs.true37
if.then25: ; preds = %land.lhs.true23
%sub26 = sub nsw i32 %3, %0
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub26)
br label %if.end71
if.then32: ; preds = %land.lhs.true9
%sub33 = sub nsw i32 %3, %2
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub33)
br label %if.end71
land.lhs.true37: ; preds = %land.lhs.true23
%cmp38 = icmp eq i32 %1, %3
br i1 %cmp38, label %if.then39, label %if.else42
if.then39: ; preds = %land.lhs.true37
%sub40 = sub nsw i32 %1, %0
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub40)
br label %if.end71
if.else42: ; preds = %if.else14.thread, %land.lhs.true37
%cmp43 = icmp eq i32 %2, %0
br i1 %cmp43, label %land.lhs.true44, label %if.end71
land.lhs.true44: ; preds = %if.else42
%cmp45 = icmp eq i32 %1, %3
br i1 %cmp45, label %if.then46, label %land.lhs.true51
if.then46: ; preds = %land.lhs.true44
%sub47 = sub nsw i32 %1, %0
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub47)
br label %if.end71
land.lhs.true51: ; preds = %land.lhs.true44
br i1 %cmp4, label %if.then53, label %land.lhs.true58
if.then53: ; preds = %land.lhs.true51
%sub54 = sub nsw i32 %3, %0
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub54)
br label %if.end71
land.lhs.true58: ; preds = %land.lhs.true51
%cmp59 = icmp slt i32 %1, %3
br i1 %cmp59, label %if.then60, label %if.end71
if.then60: ; preds = %land.lhs.true58
%sub61 = sub nsw i32 %1, %0
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub61)
br label %if.end71
if.end71: ; preds = %if.else42, %if.then5, %if.then18, %if.then32, %if.then46, %land.lhs.true58, %if.then60, %if.then53, %if.then39, %if.then25, %if.then11, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
if(b<=c||d<=a){
puts("0");
return 0;
}
if(a>c){
if(b<d)printf("%d",b-a);
else printf("%d",d-a);
}
else {
if(b<d)printf("%d",b-c);
else printf("%d",d-c);
}
puts("");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165748/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165748/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
br i1 %cmp.not, label %lor.lhs.false, label %if.then
lor.lhs.false: ; preds = %entry
%2 = load i32, ptr %d, align 4, !tbaa !5
%3 = load i32, ptr %a, align 4, !tbaa !5
%cmp1.not = icmp sgt i32 %2, %3
br i1 %cmp1.not, label %if.end, label %if.then
if.then: ; preds = %lor.lhs.false, %entry
%call2 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
if.end: ; preds = %lor.lhs.false
%cmp3 = icmp sgt i32 %3, %1
%cmp5 = icmp slt i32 %0, %2
br i1 %cmp3, label %if.then4, label %if.else11
if.then4: ; preds = %if.end
br i1 %cmp5, label %if.then6, label %if.else
if.then6: ; preds = %if.then4
%sub = sub nsw i32 %0, %3
br label %if.end20
if.else: ; preds = %if.then4
%sub8 = sub nsw i32 %2, %3
br label %if.end20
if.else11: ; preds = %if.end
br i1 %cmp5, label %if.then13, label %if.else16
if.then13: ; preds = %if.else11
%sub14 = sub nsw i32 %0, %1
br label %if.end20
if.else16: ; preds = %if.else11
%sub17 = sub nsw i32 %2, %1
br label %if.end20
if.end20: ; preds = %if.then13, %if.else16, %if.then6, %if.else
%sub14.sink = phi i32 [ %sub14, %if.then13 ], [ %sub17, %if.else16 ], [ %sub, %if.then6 ], [ %sub8, %if.else ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub14.sink)
%putchar = call i32 @putchar(i32 10)
br label %cleanup
cleanup: ; preds = %if.end20, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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"}
|
#include<stdio.h>
int main()
{
int a,b,c,d,n=0;
scanf("%d%d%d%d",&a,&b,&c,&d);
for(int i=0;i<=100;i++)
if(i>a&&i<=b&&i>c&&i<=d)
n++;
printf("%d",n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165791/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165791/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [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
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4
%2 = load i32, ptr %c, align 4
%3 = load i32, ptr %d, align 4
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert20 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat21 = shufflevector <4 x i32> %broadcast.splatinsert20, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert22 = insertelement <4 x i32> poison, i32 %2, i64 0
%broadcast.splat23 = shufflevector <4 x i32> %broadcast.splatinsert22, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert24 = insertelement <4 x i32> poison, i32 %3, i64 0
%broadcast.splat25 = shufflevector <4 x i32> %broadcast.splatinsert24, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body.1, %entry
%index = phi i32 [ 0, %entry ], [ %index.next.1, %vector.body.1 ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %entry ], [ %vec.ind.next.1, %vector.body.1 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %entry ], [ %22, %vector.body.1 ]
%4 = icmp sgt <4 x i32> %vec.ind, %broadcast.splat
%5 = icmp sle <4 x i32> %vec.ind, %broadcast.splat21
%6 = select <4 x i1> %4, <4 x i1> %5, <4 x i1> zeroinitializer
%7 = icmp sgt <4 x i32> %vec.ind, %broadcast.splat23
%8 = select <4 x i1> %6, <4 x i1> %7, <4 x i1> zeroinitializer
%9 = icmp sle <4 x i32> %vec.ind, %broadcast.splat25
%10 = select <4 x i1> %8, <4 x i1> %9, <4 x i1> zeroinitializer
%11 = zext <4 x i1> %10 to <4 x i32>
%12 = add <4 x i32> %vec.phi, %11
%13 = icmp eq i32 %index, 96
br i1 %13, label %for.body, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.body
%vec.ind.next = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%14 = icmp sgt <4 x i32> %vec.ind.next, %broadcast.splat
%15 = icmp sle <4 x i32> %vec.ind.next, %broadcast.splat21
%16 = select <4 x i1> %14, <4 x i1> %15, <4 x i1> zeroinitializer
%17 = icmp sgt <4 x i32> %vec.ind.next, %broadcast.splat23
%18 = select <4 x i1> %16, <4 x i1> %17, <4 x i1> zeroinitializer
%19 = icmp sle <4 x i32> %vec.ind.next, %broadcast.splat25
%20 = select <4 x i1> %18, <4 x i1> %19, <4 x i1> zeroinitializer
%21 = zext <4 x i1> %20 to <4 x i32>
%22 = add <4 x i32> %12, %21
%index.next.1 = add nuw nsw i32 %index, 8
%vec.ind.next.1 = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body
for.body: ; preds = %vector.body
%23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %12)
%cmp1 = icmp slt i32 %0, 100
%cmp2.not = icmp sgt i32 %1, 99
%or.cond.not17.not.not = select i1 %cmp1, i1 %cmp2.not, i1 false
%cmp4 = icmp slt i32 %2, 100
%or.cond15 = select i1 %or.cond.not17.not.not, i1 %cmp4, i1 false
%cmp6.not = icmp sgt i32 %3, 99
%or.cond16 = select i1 %or.cond15, i1 %cmp6.not, i1 false
%inc = zext i1 %or.cond16 to i32
%n.1 = add nuw nsw i32 %23, %inc
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include<stdio.h>
int main()
{
int A, B, C, D;
scanf("%d", &A);
scanf("%d", &B);
scanf("%d", &C);
scanf("%d", &D);
if (B < C || D < A)
printf("%d",0);
else
{
if (A < C)
{
if (B < D)
{
printf("%d", B - C);
}
else
{
printf("%d", D - C);
}
}
else
{
if (B < D)
{
printf("%d", B - A);
}
else
{
printf("%d", D - A);
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165834/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165834/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%D = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %C)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %D)
%0 = load i32, ptr %B, align 4, !tbaa !5
%1 = load i32, ptr %C, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.end24, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%2 = load i32, ptr %D, align 4, !tbaa !5
%3 = load i32, ptr %A, align 4, !tbaa !5
%cmp4 = icmp slt i32 %2, %3
br i1 %cmp4, label %if.end24, label %if.else
if.else: ; preds = %lor.lhs.false
%cmp6 = icmp slt i32 %3, %1
%cmp8 = icmp slt i32 %0, %2
br i1 %cmp6, label %if.then7, label %if.else14
if.then7: ; preds = %if.else
br i1 %cmp8, label %if.then9, label %if.else11
if.then9: ; preds = %if.then7
%sub = sub nsw i32 %0, %1
br label %if.end24
if.else11: ; preds = %if.then7
%sub12 = sub nsw i32 %2, %1
br label %if.end24
if.else14: ; preds = %if.else
br i1 %cmp8, label %if.then16, label %if.else19
if.then16: ; preds = %if.else14
%sub17 = sub nsw i32 %0, %3
br label %if.end24
if.else19: ; preds = %if.else14
%sub20 = sub nsw i32 %2, %3
br label %if.end24
if.end24: ; preds = %entry, %lor.lhs.false, %if.else11, %if.then9, %if.else19, %if.then16
%sub12.sink = phi i32 [ %sub12, %if.else11 ], [ %sub, %if.then9 ], [ %sub20, %if.else19 ], [ %sub17, %if.then16 ], [ 0, %lor.lhs.false ], [ 0, %entry ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub12.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{int A,B,C,D,sum,x,y;
while(~scanf("%d%d%d%d",&A,&B,&C,&D))
{
if(B<C||D<A)
printf("0\n");
else {
x=A>C?A:C;
y=B<D?B:D;
sum=y-x;
printf("%d\n",sum);
}}
return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165878/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165878/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.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
%D = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #5
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %D)
%tobool.not14 = icmp eq i32 %call13, -1
br i1 %tobool.not14, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %B, align 4
%1 = load i32, ptr %C, align 4
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %while.body
%2 = load i32, ptr %D, align 4
%3 = load i32, ptr %A, align 4
%cmp1 = icmp slt i32 %2, %3
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %lor.lhs.false, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %lor.lhs.false
%cond = call i32 @llvm.smax.i32(i32 %3, i32 %1)
%cond8 = call i32 @llvm.smin.i32(i32 %0, i32 %2)
%sub = sub nsw i32 %cond8, %cond
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
br label %if.end
if.end: ; preds = %if.else, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %D)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include <stdbool.h>
typedef double db;
typedef int in;
typedef long int li;
typedef long long int lli;
typedef long ld;
typedef long lld;
#define pi M_PI
#define in scanf
#define out printf
#define inf INT_MAX
#define rep(i,n) for(int i=0;i<n;++i)
#define debugd(d) printf("%d\n",d)
#define debugs(s) printf("%s\n",s)
#define debugc(c) printf("%c\n",c)
#define debugf(f) printf("%f\n",f)
int main (void)
{
int a,b,c,d;
int s,e;
in("%d %d %d %d \n",&a,&b,&c,&d);
if(a>d||c>b){
puts("0");
return 0;
}
s = a>=c ? a : c;
e = b<=d ? b : d;
printf("%d\n",e-s);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165928/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165928/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [14 x i8] c"%d %d %d %d \0A\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4
%1 = load i32, ptr %d, align 4
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%2 = load i32, ptr %c, align 4
%3 = load i32, ptr %b, align 4
%cmp1 = icmp sgt i32 %2, %3
br i1 %cmp1, label %if.then, label %if.end
if.then: ; preds = %lor.lhs.false, %entry
%call2 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
if.end: ; preds = %lor.lhs.false
%cond = call i32 @llvm.smax.i32(i32 %0, i32 %2)
%cond8 = call i32 @llvm.smin.i32(i32 %3, i32 %1)
%sub = sub nsw i32 %cond8, %cond
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
br label %cleanup
cleanup: ; preds = %if.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1145141919
#define llinf 1145141919810364364
#define mod 1000000007
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int main(void){
int a,b,c,d,dat[128]={0},i,r=0;
scanf("%d%d%d%d",&a,&b,&c,&d);
for(i=a;i<b;i++){dat[i]++;}
for(i=c;i<d;i++){dat[i]++;}
for(i=0;i<=127;i++){if(dat[i]==2){r++;}}
printf("%d\n",r);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_165971/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_165971/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !14
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !15
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !16
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !17
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !19
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !20
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !21
%1 = load i32, ptr %b, align 4, !tbaa !21
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !21
%1 = load i32, ptr %b, align 4, !tbaa !21
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !25
%1 = load i64, ptr %b, align 8, !tbaa !25
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !25
%1 = load i64, ptr %b, align 8, !tbaa !25
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !27
%1 = load double, ptr %b, align 8, !tbaa !27
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !27
%1 = load double, ptr %b, align 8, !tbaa !27
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%dat = alloca [128 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #9
call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %dat) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(512) %dat, i8 0, i64 512, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !21
%1 = load i32, ptr %b, align 4, !tbaa !21
%cmp31 = icmp slt i32 %0, %1
br i1 %cmp31, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%2 = sext i32 %0 to i64
%wide.trip.count = sext i32 %1 to i64
%3 = sub nsw i64 %wide.trip.count, %2
%min.iters.check = icmp ult i64 %3, 8
br i1 %min.iters.check, label %for.body.preheader75, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %3, -8
%ind.end = add nsw i64 %n.vec, %2
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %index, %2
%4 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !21
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load47 = load <4 x i32>, ptr %5, align 4, !tbaa !21
%6 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%7 = add nsw <4 x i32> %wide.load47, <i32 1, i32 1, i32 1, i32 1>
store <4 x i32> %6, ptr %4, align 4, !tbaa !21
store <4 x i32> %7, ptr %5, align 4, !tbaa !21
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !29
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader75
for.body.preheader75: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %2, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader75, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader75 ]
%arrayidx = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx, align 4, !tbaa !21
%inc = add nsw i32 %9, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !21
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !30
for.end: ; preds = %for.body, %middle.block, %entry
%10 = load i32, ptr %c, align 4, !tbaa !21
%11 = load i32, ptr %d, align 4, !tbaa !21
%cmp333 = icmp slt i32 %10, %11
br i1 %cmp333, label %for.body4.preheader, label %vector.body67
for.body4.preheader: ; preds = %for.end
%12 = sext i32 %10 to i64
%wide.trip.count41 = sext i32 %11 to i64
%13 = sub nsw i64 %wide.trip.count41, %12
%min.iters.check50 = icmp ult i64 %13, 8
br i1 %min.iters.check50, label %for.body4.preheader74, label %vector.ph51
vector.ph51: ; preds = %for.body4.preheader
%n.vec53 = and i64 %13, -8
%ind.end54 = add nsw i64 %n.vec53, %12
br label %vector.body57
vector.body57: ; preds = %vector.body57, %vector.ph51
%index58 = phi i64 [ 0, %vector.ph51 ], [ %index.next62, %vector.body57 ]
%offset.idx59 = add i64 %index58, %12
%14 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 %offset.idx59
%wide.load60 = load <4 x i32>, ptr %14, align 4, !tbaa !21
%15 = getelementptr inbounds i32, ptr %14, i64 4
%wide.load61 = load <4 x i32>, ptr %15, align 4, !tbaa !21
%16 = add nsw <4 x i32> %wide.load60, <i32 1, i32 1, i32 1, i32 1>
%17 = add nsw <4 x i32> %wide.load61, <i32 1, i32 1, i32 1, i32 1>
store <4 x i32> %16, ptr %14, align 4, !tbaa !21
store <4 x i32> %17, ptr %15, align 4, !tbaa !21
%index.next62 = add nuw i64 %index58, 8
%18 = icmp eq i64 %index.next62, %n.vec53
br i1 %18, label %middle.block48, label %vector.body57, !llvm.loop !31
middle.block48: ; preds = %vector.body57
%cmp.n56 = icmp eq i64 %13, %n.vec53
br i1 %cmp.n56, label %vector.body67, label %for.body4.preheader74
for.body4.preheader74: ; preds = %for.body4.preheader, %middle.block48
%indvars.iv38.ph = phi i64 [ %12, %for.body4.preheader ], [ %ind.end54, %middle.block48 ]
br label %for.body4
vector.body67: ; preds = %middle.block48, %for.end, %for.body4
%wide.load70 = load <4 x i32>, ptr %dat, align 16, !tbaa !21
%19 = getelementptr inbounds i32, ptr %dat, i64 4
%wide.load71 = load <4 x i32>, ptr %19, align 16, !tbaa !21
%20 = icmp eq <4 x i32> %wide.load70, <i32 2, i32 2, i32 2, i32 2>
%21 = icmp eq <4 x i32> %wide.load71, <i32 2, i32 2, i32 2, i32 2>
%22 = zext <4 x i1> %20 to <4 x i32>
%23 = zext <4 x i1> %21 to <4 x i32>
%24 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 8
%wide.load70.1 = load <4 x i32>, ptr %24, align 16, !tbaa !21
%25 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 12
%wide.load71.1 = load <4 x i32>, ptr %25, align 16, !tbaa !21
%26 = icmp eq <4 x i32> %wide.load70.1, <i32 2, i32 2, i32 2, i32 2>
%27 = icmp eq <4 x i32> %wide.load71.1, <i32 2, i32 2, i32 2, i32 2>
%28 = zext <4 x i1> %26 to <4 x i32>
%29 = zext <4 x i1> %27 to <4 x i32>
%30 = add nuw nsw <4 x i32> %22, %28
%31 = add nuw nsw <4 x i32> %23, %29
%32 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 16
%wide.load70.2 = load <4 x i32>, ptr %32, align 16, !tbaa !21
%33 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 20
%wide.load71.2 = load <4 x i32>, ptr %33, align 16, !tbaa !21
%34 = icmp eq <4 x i32> %wide.load70.2, <i32 2, i32 2, i32 2, i32 2>
%35 = icmp eq <4 x i32> %wide.load71.2, <i32 2, i32 2, i32 2, i32 2>
%36 = zext <4 x i1> %34 to <4 x i32>
%37 = zext <4 x i1> %35 to <4 x i32>
%38 = add nuw nsw <4 x i32> %30, %36
%39 = add nuw nsw <4 x i32> %31, %37
%40 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 24
%wide.load70.3 = load <4 x i32>, ptr %40, align 16, !tbaa !21
%41 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 28
%wide.load71.3 = load <4 x i32>, ptr %41, align 16, !tbaa !21
%42 = icmp eq <4 x i32> %wide.load70.3, <i32 2, i32 2, i32 2, i32 2>
%43 = icmp eq <4 x i32> %wide.load71.3, <i32 2, i32 2, i32 2, i32 2>
%44 = zext <4 x i1> %42 to <4 x i32>
%45 = zext <4 x i1> %43 to <4 x i32>
%46 = add nuw nsw <4 x i32> %38, %44
%47 = add nuw nsw <4 x i32> %39, %45
%48 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 32
%wide.load70.4 = load <4 x i32>, ptr %48, align 16, !tbaa !21
%49 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 36
%wide.load71.4 = load <4 x i32>, ptr %49, align 16, !tbaa !21
%50 = icmp eq <4 x i32> %wide.load70.4, <i32 2, i32 2, i32 2, i32 2>
%51 = icmp eq <4 x i32> %wide.load71.4, <i32 2, i32 2, i32 2, i32 2>
%52 = zext <4 x i1> %50 to <4 x i32>
%53 = zext <4 x i1> %51 to <4 x i32>
%54 = add nuw nsw <4 x i32> %46, %52
%55 = add nuw nsw <4 x i32> %47, %53
%56 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 40
%wide.load70.5 = load <4 x i32>, ptr %56, align 16, !tbaa !21
%57 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 44
%wide.load71.5 = load <4 x i32>, ptr %57, align 16, !tbaa !21
%58 = icmp eq <4 x i32> %wide.load70.5, <i32 2, i32 2, i32 2, i32 2>
%59 = icmp eq <4 x i32> %wide.load71.5, <i32 2, i32 2, i32 2, i32 2>
%60 = zext <4 x i1> %58 to <4 x i32>
%61 = zext <4 x i1> %59 to <4 x i32>
%62 = add nuw nsw <4 x i32> %54, %60
%63 = add nuw nsw <4 x i32> %55, %61
%64 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 48
%wide.load70.6 = load <4 x i32>, ptr %64, align 16, !tbaa !21
%65 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 52
%wide.load71.6 = load <4 x i32>, ptr %65, align 16, !tbaa !21
%66 = icmp eq <4 x i32> %wide.load70.6, <i32 2, i32 2, i32 2, i32 2>
%67 = icmp eq <4 x i32> %wide.load71.6, <i32 2, i32 2, i32 2, i32 2>
%68 = zext <4 x i1> %66 to <4 x i32>
%69 = zext <4 x i1> %67 to <4 x i32>
%70 = add nuw nsw <4 x i32> %62, %68
%71 = add nuw nsw <4 x i32> %63, %69
%72 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 56
%wide.load70.7 = load <4 x i32>, ptr %72, align 16, !tbaa !21
%73 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 60
%wide.load71.7 = load <4 x i32>, ptr %73, align 16, !tbaa !21
%74 = icmp eq <4 x i32> %wide.load70.7, <i32 2, i32 2, i32 2, i32 2>
%75 = icmp eq <4 x i32> %wide.load71.7, <i32 2, i32 2, i32 2, i32 2>
%76 = zext <4 x i1> %74 to <4 x i32>
%77 = zext <4 x i1> %75 to <4 x i32>
%78 = add <4 x i32> %70, %76
%79 = add <4 x i32> %71, %77
%80 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 64
%wide.load70.8 = load <4 x i32>, ptr %80, align 16, !tbaa !21
%81 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 68
%wide.load71.8 = load <4 x i32>, ptr %81, align 16, !tbaa !21
%82 = icmp eq <4 x i32> %wide.load70.8, <i32 2, i32 2, i32 2, i32 2>
%83 = icmp eq <4 x i32> %wide.load71.8, <i32 2, i32 2, i32 2, i32 2>
%84 = zext <4 x i1> %82 to <4 x i32>
%85 = zext <4 x i1> %83 to <4 x i32>
%86 = add <4 x i32> %78, %84
%87 = add <4 x i32> %79, %85
%88 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 72
%wide.load70.9 = load <4 x i32>, ptr %88, align 16, !tbaa !21
%89 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 76
%wide.load71.9 = load <4 x i32>, ptr %89, align 16, !tbaa !21
%90 = icmp eq <4 x i32> %wide.load70.9, <i32 2, i32 2, i32 2, i32 2>
%91 = icmp eq <4 x i32> %wide.load71.9, <i32 2, i32 2, i32 2, i32 2>
%92 = zext <4 x i1> %90 to <4 x i32>
%93 = zext <4 x i1> %91 to <4 x i32>
%94 = add <4 x i32> %86, %92
%95 = add <4 x i32> %87, %93
%96 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 80
%wide.load70.10 = load <4 x i32>, ptr %96, align 16, !tbaa !21
%97 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 84
%wide.load71.10 = load <4 x i32>, ptr %97, align 16, !tbaa !21
%98 = icmp eq <4 x i32> %wide.load70.10, <i32 2, i32 2, i32 2, i32 2>
%99 = icmp eq <4 x i32> %wide.load71.10, <i32 2, i32 2, i32 2, i32 2>
%100 = zext <4 x i1> %98 to <4 x i32>
%101 = zext <4 x i1> %99 to <4 x i32>
%102 = add <4 x i32> %94, %100
%103 = add <4 x i32> %95, %101
%104 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 88
%wide.load70.11 = load <4 x i32>, ptr %104, align 16, !tbaa !21
%105 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 92
%wide.load71.11 = load <4 x i32>, ptr %105, align 16, !tbaa !21
%106 = icmp eq <4 x i32> %wide.load70.11, <i32 2, i32 2, i32 2, i32 2>
%107 = icmp eq <4 x i32> %wide.load71.11, <i32 2, i32 2, i32 2, i32 2>
%108 = zext <4 x i1> %106 to <4 x i32>
%109 = zext <4 x i1> %107 to <4 x i32>
%110 = add <4 x i32> %102, %108
%111 = add <4 x i32> %103, %109
%112 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 96
%wide.load70.12 = load <4 x i32>, ptr %112, align 16, !tbaa !21
%113 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 100
%wide.load71.12 = load <4 x i32>, ptr %113, align 16, !tbaa !21
%114 = icmp eq <4 x i32> %wide.load70.12, <i32 2, i32 2, i32 2, i32 2>
%115 = icmp eq <4 x i32> %wide.load71.12, <i32 2, i32 2, i32 2, i32 2>
%116 = zext <4 x i1> %114 to <4 x i32>
%117 = zext <4 x i1> %115 to <4 x i32>
%118 = add <4 x i32> %110, %116
%119 = add <4 x i32> %111, %117
%120 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 104
%wide.load70.13 = load <4 x i32>, ptr %120, align 16, !tbaa !21
%121 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 108
%wide.load71.13 = load <4 x i32>, ptr %121, align 16, !tbaa !21
%122 = icmp eq <4 x i32> %wide.load70.13, <i32 2, i32 2, i32 2, i32 2>
%123 = icmp eq <4 x i32> %wide.load71.13, <i32 2, i32 2, i32 2, i32 2>
%124 = zext <4 x i1> %122 to <4 x i32>
%125 = zext <4 x i1> %123 to <4 x i32>
%126 = add <4 x i32> %118, %124
%127 = add <4 x i32> %119, %125
%128 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 112
%wide.load70.14 = load <4 x i32>, ptr %128, align 16, !tbaa !21
%129 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 116
%wide.load71.14 = load <4 x i32>, ptr %129, align 16, !tbaa !21
%130 = icmp eq <4 x i32> %wide.load70.14, <i32 2, i32 2, i32 2, i32 2>
%131 = icmp eq <4 x i32> %wide.load71.14, <i32 2, i32 2, i32 2, i32 2>
%132 = zext <4 x i1> %130 to <4 x i32>
%133 = zext <4 x i1> %131 to <4 x i32>
%134 = add <4 x i32> %126, %132
%135 = add <4 x i32> %127, %133
%136 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 120
%wide.load70.15 = load <4 x i32>, ptr %136, align 16, !tbaa !21
%137 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 124
%wide.load71.15 = load <4 x i32>, ptr %137, align 16, !tbaa !21
%138 = icmp eq <4 x i32> %wide.load70.15, <i32 2, i32 2, i32 2, i32 2>
%139 = icmp eq <4 x i32> %wide.load71.15, <i32 2, i32 2, i32 2, i32 2>
%140 = zext <4 x i1> %138 to <4 x i32>
%141 = zext <4 x i1> %139 to <4 x i32>
%142 = add <4 x i32> %134, %140
%143 = add <4 x i32> %135, %141
%bin.rdx = add <4 x i32> %143, %142
%144 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %144)
call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %dat) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #9
ret i32 0
for.body4: ; preds = %for.body4.preheader74, %for.body4
%indvars.iv38 = phi i64 [ %indvars.iv.next39, %for.body4 ], [ %indvars.iv38.ph, %for.body4.preheader74 ]
%arrayidx6 = getelementptr inbounds [128 x i32], ptr %dat, i64 0, i64 %indvars.iv38
%145 = load i32, ptr %arrayidx6, align 4, !tbaa !21
%inc7 = add nsw i32 %145, 1
store i32 %inc7, ptr %arrayidx6, align 4, !tbaa !21
%indvars.iv.next39 = add nsw i64 %indvars.iv38, 1
%exitcond42.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count41
br i1 %exitcond42.not, label %vector.body67, label %for.body4, !llvm.loop !32
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #8
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nofree nounwind "no-trapping-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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !18}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !23, i64 0}
!23 = !{!"omnipotent char", !24, i64 0}
!24 = !{!"Simple C/C++ TBAA"}
!25 = !{!26, !26, i64 0}
!26 = !{!"long long", !23, i64 0}
!27 = !{!28, !28, i64 0}
!28 = !{!"double", !23, i64 0}
!29 = distinct !{!29, !6, !9, !10}
!30 = distinct !{!30, !6, !10, !9}
!31 = distinct !{!31, !6, !9, !10}
!32 = distinct !{!32, !6, !10, !9}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
double money = 100; //単位は千 10万=100,000
int n,i;
scanf("%d", &n);
for (i=0; i<n; i++){
money *= 1.05;
money = ceil(money);
}
printf("%d\n", (int)money*1000);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166013/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166013/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %0, 7
%1 = icmp ult i32 %0, 8
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %0, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%money.07 = phi double [ 1.000000e+02, %for.body.preheader.new ], [ %9, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = fmul double %money.07, 1.050000e+00
%2 = call double @llvm.ceil.f64(double %mul)
%mul.1 = fmul double %2, 1.050000e+00
%3 = call double @llvm.ceil.f64(double %mul.1)
%mul.2 = fmul double %3, 1.050000e+00
%4 = call double @llvm.ceil.f64(double %mul.2)
%mul.3 = fmul double %4, 1.050000e+00
%5 = call double @llvm.ceil.f64(double %mul.3)
%mul.4 = fmul double %5, 1.050000e+00
%6 = call double @llvm.ceil.f64(double %mul.4)
%mul.5 = fmul double %6, 1.050000e+00
%7 = call double @llvm.ceil.f64(double %mul.5)
%mul.6 = fmul double %7, 1.050000e+00
%8 = call double @llvm.ceil.f64(double %mul.6)
%mul.7 = fmul double %8, 1.050000e+00
%9 = call double @llvm.ceil.f64(double %mul.7)
%niter.next.7 = add i32 %niter, 8
%niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%.lcssa.ph = phi double [ undef, %for.body.preheader ], [ %9, %for.body ]
%money.07.unr = phi double [ 1.000000e+02, %for.body.preheader ], [ %9, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%money.07.epil = phi double [ %10, %for.body.epil ], [ %money.07.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = fmul double %money.07.epil, 1.050000e+00
%10 = call double @llvm.ceil.f64(double %mul.epil)
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end.loopexit, label %for.body.epil, !llvm.loop !11
for.end.loopexit: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa
%.lcssa = phi double [ %.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %10, %for.body.epil ]
%11 = fptosi double %.lcssa to i32
%12 = mul nsw i32 %11, 1000
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%money.0.lcssa = phi i32 [ 100000, %entry ], [ %12, %for.end.loopexit ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %money.0.lcssa)
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 speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main(void){
int n, i, debt;
debt=100000;
scanf("%d", &n);
for(i=0; i<n; i++){
debt=debt+(debt/20);
if(debt%1000!=0)
debt=debt+(1000-(debt%1000));
}
printf("%d\n", debt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166064/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166064/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%debt.013 = phi i32 [ %debt.1, %for.body ], [ 100000, %entry ]
%i.012 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%div = sdiv i32 %debt.013, 20
%add = add nsw i32 %div, %debt.013
%rem = srem i32 %add, 1000
%cmp1.not = icmp eq i32 %rem, 0
%reass.sub = add i32 %add, 1000
%add3 = sub i32 %reass.sub, %rem
%debt.1 = select i1 %cmp1.not, i32 %add, i32 %add3
%inc = add nuw nsw i32 %i.012, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%debt.0.lcssa = phi i32 [ 100000, %entry ], [ %debt.1, %for.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %debt.0.lcssa)
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>
int debt_amount(int, int);
int main(){
int n;
scanf("%d", &n);
printf("%d\n", debt_amount(100000, n));
return 0;
}
int debt_amount(int a, int x){
if(x >= 1){
a = (a + a*0.05 + 999)/1000;
a = a*1000;
return debt_amount(a, x-1);
}else{
return a;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166114/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166114/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%cmp8.i = icmp sgt i32 %0, 0
br i1 %cmp8.i, label %if.then.i.preheader, label %debt_amount.exit
if.then.i.preheader: ; preds = %entry
%xtraiter = and i32 %0, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %debt_amount.exit.loopexit.unr-lcssa, label %if.then.i.preheader.new
if.then.i.preheader.new: ; preds = %if.then.i.preheader
%unroll_iter = and i32 %0, -2
br label %if.then.i
if.then.i: ; preds = %if.then.i, %if.then.i.preheader.new
%a.tr9.i = phi i32 [ 100000, %if.then.i.preheader.new ], [ %mul.i.1, %if.then.i ]
%niter = phi i32 [ 0, %if.then.i.preheader.new ], [ %niter.next.1, %if.then.i ]
%conv.i = sitofp i32 %a.tr9.i to double
%2 = call double @llvm.fmuladd.f64(double %conv.i, double 5.000000e-02, double %conv.i)
%add.i = fadd double %2, 9.990000e+02
%div.i = fdiv double %add.i, 1.000000e+03
%conv2.i = fptosi double %div.i to i32
%mul.i = mul nsw i32 %conv2.i, 1000
%conv.i.1 = sitofp i32 %mul.i to double
%3 = call double @llvm.fmuladd.f64(double %conv.i.1, double 5.000000e-02, double %conv.i.1)
%add.i.1 = fadd double %3, 9.990000e+02
%div.i.1 = fdiv double %add.i.1, 1.000000e+03
%conv2.i.1 = fptosi double %div.i.1 to i32
%mul.i.1 = mul nsw i32 %conv2.i.1, 1000
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1.not = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1.not, label %debt_amount.exit.loopexit.unr-lcssa.loopexit, label %if.then.i
debt_amount.exit.loopexit.unr-lcssa.loopexit: ; preds = %if.then.i
%4 = sitofp i32 %mul.i.1 to double
br label %debt_amount.exit.loopexit.unr-lcssa
debt_amount.exit.loopexit.unr-lcssa: ; preds = %debt_amount.exit.loopexit.unr-lcssa.loopexit, %if.then.i.preheader
%mul.i.lcssa.ph = phi i32 [ undef, %if.then.i.preheader ], [ %mul.i.1, %debt_amount.exit.loopexit.unr-lcssa.loopexit ]
%a.tr9.i.unr = phi double [ 1.000000e+05, %if.then.i.preheader ], [ %4, %debt_amount.exit.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %debt_amount.exit, label %if.then.i.epil
if.then.i.epil: ; preds = %debt_amount.exit.loopexit.unr-lcssa
%5 = call double @llvm.fmuladd.f64(double %a.tr9.i.unr, double 5.000000e-02, double %a.tr9.i.unr)
%add.i.epil = fadd double %5, 9.990000e+02
%div.i.epil = fdiv double %add.i.epil, 1.000000e+03
%conv2.i.epil = fptosi double %div.i.epil to i32
%mul.i.epil = mul nsw i32 %conv2.i.epil, 1000
br label %debt_amount.exit
debt_amount.exit: ; preds = %if.then.i.epil, %debt_amount.exit.loopexit.unr-lcssa, %entry
%a.tr.lcssa.i = phi i32 [ 100000, %entry ], [ %mul.i.lcssa.ph, %debt_amount.exit.loopexit.unr-lcssa ], [ %mul.i.epil, %if.then.i.epil ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.tr.lcssa.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @debt_amount(i32 noundef %a, i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp8 = icmp sgt i32 %x, 0
br i1 %cmp8, label %if.then.preheader, label %return
if.then.preheader: ; preds = %entry
%xtraiter = and i32 %x, 1
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %if.then.prol.loopexit, label %if.then.prol
if.then.prol: ; preds = %if.then.preheader
%conv.prol = sitofp i32 %a to double
%0 = tail call double @llvm.fmuladd.f64(double %conv.prol, double 5.000000e-02, double %conv.prol)
%add.prol = fadd double %0, 9.990000e+02
%div.prol = fdiv double %add.prol, 1.000000e+03
%conv2.prol = fptosi double %div.prol to i32
%mul.prol = mul nsw i32 %conv2.prol, 1000
%sub.prol = add nsw i32 %x, -1
br label %if.then.prol.loopexit
if.then.prol.loopexit: ; preds = %if.then.prol, %if.then.preheader
%x.tr10.unr = phi i32 [ %x, %if.then.preheader ], [ %sub.prol, %if.then.prol ]
%a.tr9.unr = phi i32 [ %a, %if.then.preheader ], [ %mul.prol, %if.then.prol ]
%mul.lcssa.unr = phi i32 [ undef, %if.then.preheader ], [ %mul.prol, %if.then.prol ]
%1 = icmp eq i32 %x, 1
br i1 %1, label %return, label %if.then
if.then: ; preds = %if.then.prol.loopexit, %if.then
%x.tr10 = phi i32 [ %sub.1, %if.then ], [ %x.tr10.unr, %if.then.prol.loopexit ]
%a.tr9 = phi i32 [ %mul.1, %if.then ], [ %a.tr9.unr, %if.then.prol.loopexit ]
%conv = sitofp i32 %a.tr9 to double
%2 = tail call double @llvm.fmuladd.f64(double %conv, double 5.000000e-02, double %conv)
%add = fadd double %2, 9.990000e+02
%div = fdiv double %add, 1.000000e+03
%conv2 = fptosi double %div to i32
%mul = mul nsw i32 %conv2, 1000
%conv.1 = sitofp i32 %mul to double
%3 = tail call double @llvm.fmuladd.f64(double %conv.1, double 5.000000e-02, double %conv.1)
%add.1 = fadd double %3, 9.990000e+02
%div.1 = fdiv double %add.1, 1.000000e+03
%conv2.1 = fptosi double %div.1 to i32
%mul.1 = mul nsw i32 %conv2.1, 1000
%sub.1 = add nsw i32 %x.tr10, -2
%4 = add i32 %x.tr10, -3
%cmp.1 = icmp ult i32 %4, -2
br i1 %cmp.1, label %if.then, label %return
return: ; preds = %if.then.prol.loopexit, %if.then, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %mul.lcssa.unr, %if.then.prol.loopexit ], [ %mul.1, %if.then ]
ret i32 %a.tr.lcssa
}
; 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 double @llvm.fmuladd.f64(double, double, double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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>
int main(void)
{
int n, x = 100000;
scanf( "%d", &n );
while(n--){
x *= 1.05;
if( x % 1000 > 0)
x += 1000 - x % 1000;
}
printf( "%d\n", x );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166165/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166165/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%n.promoted = load i32, ptr %n, align 4, !tbaa !5
%tobool.not11 = icmp eq i32 %n.promoted, 0
br i1 %tobool.not11, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%xtraiter = and i32 %n.promoted, 1
%0 = icmp eq i32 %n.promoted, 1
br i1 %0, label %while.end.loopexit.unr-lcssa, label %while.body.preheader.new
while.body.preheader.new: ; preds = %while.body.preheader
%unroll_iter = and i32 %n.promoted, -2
br label %while.body
while.body: ; preds = %while.body, %while.body.preheader.new
%x.012 = phi i32 [ 100000, %while.body.preheader.new ], [ %x.1.1, %while.body ]
%niter = phi i32 [ 0, %while.body.preheader.new ], [ %niter.next.1, %while.body ]
%conv = sitofp i32 %x.012 to double
%mul = fmul double %conv, 1.050000e+00
%conv1 = fptosi double %mul to i32
%rem = srem i32 %conv1, 1000
%cmp = icmp sgt i32 %rem, 0
%reass.sub = add i32 %conv1, 1000
%add = sub i32 %reass.sub, %rem
%x.1 = select i1 %cmp, i32 %add, i32 %conv1
%conv.1 = sitofp i32 %x.1 to double
%mul.1 = fmul double %conv.1, 1.050000e+00
%conv1.1 = fptosi double %mul.1 to i32
%rem.1 = srem i32 %conv1.1, 1000
%cmp.1 = icmp sgt i32 %rem.1, 0
%reass.sub.1 = add i32 %conv1.1, 1000
%add.1 = sub i32 %reass.sub.1, %rem.1
%x.1.1 = select i1 %cmp.1, i32 %add.1, i32 %conv1.1
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %while.end.loopexit.unr-lcssa.loopexit, label %while.body, !llvm.loop !9
while.end.loopexit.unr-lcssa.loopexit: ; preds = %while.body
%1 = sitofp i32 %x.1.1 to double
%2 = fmul double %1, 1.050000e+00
%3 = fptosi double %2 to i32
br label %while.end.loopexit.unr-lcssa
while.end.loopexit.unr-lcssa: ; preds = %while.end.loopexit.unr-lcssa.loopexit, %while.body.preheader
%x.1.lcssa.ph = phi i32 [ undef, %while.body.preheader ], [ %x.1.1, %while.end.loopexit.unr-lcssa.loopexit ]
%x.012.unr = phi i32 [ 105000, %while.body.preheader ], [ %3, %while.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.end, label %while.body.epil
while.body.epil: ; preds = %while.end.loopexit.unr-lcssa
%rem.epil = srem i32 %x.012.unr, 1000
%cmp.epil = icmp sgt i32 %rem.epil, 0
%reass.sub.epil = add i32 %x.012.unr, 1000
%add.epil = sub i32 %reass.sub.epil, %rem.epil
%x.1.epil = select i1 %cmp.epil, i32 %add.epil, i32 %x.012.unr
br label %while.end
while.end: ; preds = %while.body.epil, %while.end.loopexit.unr-lcssa, %entry
%x.0.lcssa = phi i32 [ 100000, %entry ], [ %x.1.lcssa.ph, %while.end.loopexit.unr-lcssa ], [ %x.1.epil, %while.body.epil ]
store i32 -1, ptr %n, align 4, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.0.lcssa)
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>
int main()
{
int n, i;
int ans = 100000;
scanf("%d", &n);
for (i = 0; i < n; i++) {
ans *= 1.05;
ans = ((ans+999)/1000) * 1000;
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166215/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166215/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %0, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %0, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%ans.09 = phi i32 [ 100000, %for.body.preheader.new ], [ %mul2.1, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%conv = sitofp i32 %ans.09 to double
%mul = fmul double %conv, 1.050000e+00
%conv1 = fptosi double %mul to i32
%conv1.fr = freeze i32 %conv1
%add = add i32 %conv1.fr, 999
%2 = srem i32 %add, 1000
%mul2 = sub nsw i32 %add, %2
%conv.1 = sitofp i32 %mul2 to double
%mul.1 = fmul double %conv.1, 1.050000e+00
%conv1.1 = fptosi double %mul.1 to i32
%conv1.fr.1 = freeze i32 %conv1.1
%add.1 = add i32 %conv1.fr.1, 999
%3 = srem i32 %add.1, 1000
%mul2.1 = sub nsw i32 %add.1, %3
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa.loopexit: ; preds = %for.body
%4 = sitofp i32 %mul2.1 to double
%5 = fmul double %4, 1.050000e+00
%6 = fptosi double %5 to i32
%7 = freeze i32 %6
%8 = add i32 %7, 999
br label %for.end.loopexit.unr-lcssa
for.end.loopexit.unr-lcssa: ; preds = %for.end.loopexit.unr-lcssa.loopexit, %for.body.preheader
%mul2.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %mul2.1, %for.end.loopexit.unr-lcssa.loopexit ]
%ans.09.unr = phi i32 [ 105999, %for.body.preheader ], [ %8, %for.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%9 = srem i32 %ans.09.unr, 1000
%mul2.epil = sub nsw i32 %ans.09.unr, %9
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%ans.0.lcssa = phi i32 [ 100000, %entry ], [ %mul2.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul2.epil, %for.body.epil ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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>
int main(void){
int n;
int i;
int b=100000;
int a;
scanf("%d ",&n);
for(i=0;i<n;i++){
b+=( b*0.05 );
a=(b/1000)*1000;
if( a!=b )
a+=1000;
b=a;
}
printf("%d\n",b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166288/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166288/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %0, 0
br i1 %cmp13, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %0, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %0, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%b.015 = phi i32 [ 100000, %for.body.preheader.new ], [ %spec.select.1, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%conv = sitofp i32 %b.015 to double
%2 = call double @llvm.fmuladd.f64(double %conv, double 5.000000e-02, double %conv)
%conv2 = fptosi double %2 to i32
%conv2.fr = freeze i32 %conv2
%3 = srem i32 %conv2.fr, 1000
%cmp3.not = icmp eq i32 %3, 0
%mul = add i32 %conv2.fr, 1000
%add = sub i32 %mul, %3
%spec.select = select i1 %cmp3.not, i32 %conv2.fr, i32 %add
%conv.1 = sitofp i32 %spec.select to double
%4 = call double @llvm.fmuladd.f64(double %conv.1, double 5.000000e-02, double %conv.1)
%conv2.1 = fptosi double %4 to i32
%conv2.fr.1 = freeze i32 %conv2.1
%5 = srem i32 %conv2.fr.1, 1000
%cmp3.not.1 = icmp eq i32 %5, 0
%mul.1 = add i32 %conv2.fr.1, 1000
%add.1 = sub i32 %mul.1, %5
%spec.select.1 = select i1 %cmp3.not.1, i32 %conv2.fr.1, i32 %add.1
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa.loopexit: ; preds = %for.body
%6 = sitofp i32 %spec.select.1 to double
br label %for.end.loopexit.unr-lcssa
for.end.loopexit.unr-lcssa: ; preds = %for.end.loopexit.unr-lcssa.loopexit, %for.body.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %spec.select.1, %for.end.loopexit.unr-lcssa.loopexit ]
%b.015.unr = phi double [ 1.000000e+05, %for.body.preheader ], [ %6, %for.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%7 = call double @llvm.fmuladd.f64(double %b.015.unr, double 5.000000e-02, double %b.015.unr)
%conv2.epil = fptosi double %7 to i32
%conv2.fr.epil = freeze i32 %conv2.epil
%8 = srem i32 %conv2.fr.epil, 1000
%cmp3.not.epil = icmp eq i32 %8, 0
%mul.epil = add i32 %conv2.fr.epil, 1000
%add.epil = sub i32 %mul.epil, %8
%spec.select.epil = select i1 %cmp3.not.epil, i32 %conv2.fr.epil, i32 %add.epil
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%b.0.lcssa = phi i32 [ 100000, %entry ], [ %spec.select.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body.epil ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %b.0.lcssa)
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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a=100000,b,n;
scanf("%d",&n);
for(b=0;b<n;b++){
a=a*1.05;
if(a!=(a/1000)*1000){a=(a/1000+1)*1000;}
}
printf("%d\n",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166330/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166330/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %0, 0
br i1 %cmp13, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %0, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %0, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%a.014 = phi i32 [ 100000, %for.body.preheader.new ], [ %a.1.1, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%conv = sitofp i32 %a.014 to double
%mul = fmul double %conv, 1.050000e+00
%conv1 = fptosi double %mul to i32
%conv1.fr = freeze i32 %conv1
%2 = srem i32 %conv1.fr, 1000
%cmp3.not = icmp eq i32 %2, 0
%mul2 = add i32 %conv1.fr, 1000
%mul6 = sub i32 %mul2, %2
%a.1 = select i1 %cmp3.not, i32 %conv1.fr, i32 %mul6
%conv.1 = sitofp i32 %a.1 to double
%mul.1 = fmul double %conv.1, 1.050000e+00
%conv1.1 = fptosi double %mul.1 to i32
%conv1.fr.1 = freeze i32 %conv1.1
%3 = srem i32 %conv1.fr.1, 1000
%cmp3.not.1 = icmp eq i32 %3, 0
%mul2.1 = add i32 %conv1.fr.1, 1000
%mul6.1 = sub i32 %mul2.1, %3
%a.1.1 = select i1 %cmp3.not.1, i32 %conv1.fr.1, i32 %mul6.1
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa.loopexit: ; preds = %for.body
%4 = sitofp i32 %a.1.1 to double
%5 = fmul double %4, 1.050000e+00
%6 = fptosi double %5 to i32
%7 = freeze i32 %6
br label %for.end.loopexit.unr-lcssa
for.end.loopexit.unr-lcssa: ; preds = %for.end.loopexit.unr-lcssa.loopexit, %for.body.preheader
%a.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %a.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%a.014.unr = phi i32 [ 105000, %for.body.preheader ], [ %7, %for.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%8 = srem i32 %a.014.unr, 1000
%cmp3.not.epil = icmp eq i32 %8, 0
%mul2.epil = add i32 %a.014.unr, 1000
%mul6.epil = sub i32 %mul2.epil, %8
%a.1.epil = select i1 %cmp3.not.epil, i32 %a.014.unr, i32 %mul6.epil
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%a.0.lcssa = phi i32 [ 100000, %entry ], [ %a.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %a.1.epil, %for.body.epil ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.0.lcssa)
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>
int main(void)
{
int n;
int money = 100000;
int i;
scanf("%d", &n);
for (i = 0; i < n; i++){
money = money + (money * 0.05);
if (money % 1000){
money = (money + 1000) / 1000 * 1000;
}
}
printf("%d\n", money);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166374/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166374/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %0, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.011 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%money.010 = phi i32 [ %money.1, %for.inc ], [ 100000, %entry ]
%conv = sitofp i32 %money.010 to double
%1 = call double @llvm.fmuladd.f64(double %conv, double 5.000000e-02, double %conv)
%conv2 = fptosi double %1 to i32
%conv2.fr = freeze i32 %conv2
%rem = srem i32 %conv2.fr, 1000
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%add = add i32 %conv2.fr, 1000
%2 = srem i32 %add, 1000
%mul = sub nsw i32 %add, %2
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%money.1 = phi i32 [ %mul, %if.then ], [ %conv2.fr, %for.body ]
%inc = add nuw nsw i32 %i.011, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%money.0.lcssa = phi i32 [ 100000, %entry ], [ %money.1, %for.inc ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %money.0.lcssa)
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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int money = 100000;
int i, n;
scanf("%d", &n);
for (i = 0; i < n; i++){
money += (money * 0.05);
if (money % 1000 != 0){
money = (money + 1000) / 1000 * 1000;
}
}
printf("%d\n", money);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166431/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166431/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.013 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%money.012 = phi i32 [ %money.1, %for.inc ], [ 100000, %entry ]
%conv = sitofp i32 %money.012 to double
%1 = call double @llvm.fmuladd.f64(double %conv, double 5.000000e-02, double %conv)
%conv2 = fptosi double %1 to i32
%conv2.fr = freeze i32 %conv2
%rem = srem i32 %conv2.fr, 1000
%cmp3.not = icmp eq i32 %rem, 0
br i1 %cmp3.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%add = add i32 %conv2.fr, 1000
%2 = srem i32 %add, 1000
%mul = sub nsw i32 %add, %2
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%money.1 = phi i32 [ %mul, %if.then ], [ %conv2.fr, %for.body ]
%inc = add nuw nsw i32 %i.013, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%money.0.lcssa = phi i32 [ 100000, %entry ], [ %money.1, %for.inc ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %money.0.lcssa)
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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int n,i,kari,ri;
kari=100000;
scanf("%d",&n);
for(i=0;i<n;i++){
ri=kari*5;
ri=ri/100;
kari=kari+ri;
if(kari%1000>0){
kari=kari/1000;
kari++;
kari=kari*1000;
}
}
printf("%d\n",kari);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166475/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166475/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.016 = phi i32 [ %inc4, %for.body ], [ 0, %entry ]
%kari.015 = phi i32 [ %kari.1, %for.body ], [ 100000, %entry ]
%div = sdiv i32 %kari.015, 20
%add = add i32 %div, %kari.015
%rem = srem i32 %add, 1000
%cmp1 = icmp sgt i32 %rem, 0
%1 = add i32 %add, 1000
%mul3 = sub i32 %1, %rem
%kari.1 = select i1 %cmp1, i32 %mul3, i32 %add
%inc4 = add nuw nsw i32 %i.016, 1
%exitcond.not = icmp eq i32 %inc4, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%kari.0.lcssa = phi i32 [ 100000, %entry ], [ %kari.1, %for.body ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %kari.0.lcssa)
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>
int main(void){
int n, i, frac;
float out;
out = 100000;
scanf("%d", &n);
for(i = 0; i < n; i++){
out = out * 1.05;
frac = (int)out % 1000;
if(frac != 0) out = out - (float)frac + 1000;
}
printf("%d\n", (int)out);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166518/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166518/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %0, 0
br i1 %cmp13, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%out.015 = phi float [ %out.1, %for.body ], [ 1.000000e+05, %entry ]
%i.014 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%conv = fpext float %out.015 to double
%mul = fmul double %conv, 1.050000e+00
%conv1 = fptrunc double %mul to float
%conv2 = fptosi float %conv1 to i32
%rem = srem i32 %conv2, 1000
%cmp3.not = icmp eq i32 %rem, 0
%conv5 = sitofp i32 %rem to float
%sub = fsub float %conv1, %conv5
%add = fadd float %sub, 1.000000e+03
%out.1 = select i1 %cmp3.not, float %conv1, float %add
%inc = add nuw nsw i32 %i.014, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%1 = fptosi float %out.1 to i32
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%out.0.lcssa = phi i32 [ 100000, %entry ], [ %1, %for.end.loopexit ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %out.0.lcssa)
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>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#include <limits.h>
int main(void){
int n,i;
double ans=100;
scanf("%d",&n);
for(i=0;i<n;i++){
ans*=1.05;
ans=ceil(ans);
}
printf("%d\n",(int)ans*1000);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166569/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166569/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %0, 7
%1 = icmp ult i32 %0, 8
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %0, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%ans.08 = phi double [ 1.000000e+02, %for.body.preheader.new ], [ %9, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = fmul double %ans.08, 1.050000e+00
%2 = call double @llvm.ceil.f64(double %mul)
%mul.1 = fmul double %2, 1.050000e+00
%3 = call double @llvm.ceil.f64(double %mul.1)
%mul.2 = fmul double %3, 1.050000e+00
%4 = call double @llvm.ceil.f64(double %mul.2)
%mul.3 = fmul double %4, 1.050000e+00
%5 = call double @llvm.ceil.f64(double %mul.3)
%mul.4 = fmul double %5, 1.050000e+00
%6 = call double @llvm.ceil.f64(double %mul.4)
%mul.5 = fmul double %6, 1.050000e+00
%7 = call double @llvm.ceil.f64(double %mul.5)
%mul.6 = fmul double %7, 1.050000e+00
%8 = call double @llvm.ceil.f64(double %mul.6)
%mul.7 = fmul double %8, 1.050000e+00
%9 = call double @llvm.ceil.f64(double %mul.7)
%niter.next.7 = add i32 %niter, 8
%niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%.lcssa.ph = phi double [ undef, %for.body.preheader ], [ %9, %for.body ]
%ans.08.unr = phi double [ 1.000000e+02, %for.body.preheader ], [ %9, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%ans.08.epil = phi double [ %10, %for.body.epil ], [ %ans.08.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = fmul double %ans.08.epil, 1.050000e+00
%10 = call double @llvm.ceil.f64(double %mul.epil)
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end.loopexit, label %for.body.epil, !llvm.loop !11
for.end.loopexit: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa
%.lcssa = phi double [ %.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %10, %for.body.epil ]
%11 = fptosi double %.lcssa to i32
%12 = mul nsw i32 %11, 1000
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%ans.0.lcssa = phi i32 [ 100000, %entry ], [ %12, %for.end.loopexit ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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 speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
#include <string.h>
int main(void) {
char s[101];
int slen, i, t, count = 0;
while (scanf("%s", s) != EOF) {
slen = strlen(s);
t = slen / 2;
if (slen % 2) {
for (i = 1; i <= t; i++)
if (s[t-i] != s[t+i]) break;
if (i == t + 1) count++;
}
else {
for (i = 0; i < t; i++)
if (s[t-i-1] != s[t+i]) break;
if (i == t) count++;
}
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166611/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166611/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #4
%call72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not73 = icmp eq i32 %call72, -1
br i1 %cmp.not73, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end43
%count.074 = phi i32 [ %count.1, %if.end43 ], [ 0, %entry ]
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%conv = trunc i64 %call2 to i32
%div = sdiv i32 %conv, 2
%0 = and i32 %conv, 1
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %for.cond18.preheader, label %for.cond.preheader
for.cond.preheader: ; preds = %while.body
%cmp3.not65 = icmp slt i32 %conv, 2
br i1 %cmp3.not65, label %for.cond.preheader.for.end_crit_edge, label %for.body.preheader
for.cond.preheader.for.end_crit_edge: ; preds = %for.cond.preheader
%.pre = add nsw i32 %div, 1
br label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%1 = sext i32 %div to i64
%2 = add nsw i32 %div, 1
%wide.trip.count = zext i32 %2 to i64
br label %for.body
for.cond18.preheader: ; preds = %while.body
%cmp1968 = icmp sgt i32 %conv, 1
br i1 %cmp1968, label %for.body21.preheader, label %for.end37
for.body21.preheader: ; preds = %for.cond18.preheader
%3 = sext i32 %div to i64
%wide.trip.count83 = zext i32 %div to i64
br label %for.body21
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%4 = sub nsw i64 %1, %indvars.iv
%arrayidx = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %4
%5 = load i8, ptr %arrayidx, align 1, !tbaa !5
%6 = add nsw i64 %indvars.iv, %1
%arrayidx7 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %6
%7 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9.not = icmp eq i8 %5, %7
br i1 %cmp9.not, label %for.inc, label %for.end.loopexit.split.loop.exit
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8
for.end.loopexit.split.loop.exit: ; preds = %for.body
%8 = trunc i64 %indvars.iv to i32
br label %for.end
for.end: ; preds = %for.inc, %for.end.loopexit.split.loop.exit, %for.cond.preheader.for.end_crit_edge
%add12.pre-phi = phi i32 [ %.pre, %for.cond.preheader.for.end_crit_edge ], [ %2, %for.end.loopexit.split.loop.exit ], [ %2, %for.inc ]
%i.0.lcssa = phi i32 [ 1, %for.cond.preheader.for.end_crit_edge ], [ %8, %for.end.loopexit.split.loop.exit ], [ %2, %for.inc ]
%cmp13 = icmp eq i32 %i.0.lcssa, %add12.pre-phi
br label %if.end43
for.body21: ; preds = %for.body21.preheader, %for.inc35
%indvars.iv79 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next80, %for.inc35 ]
%9 = trunc i64 %indvars.iv79 to i32
%10 = xor i32 %9, -1
%sub23 = add i32 %div, %10
%idxprom24 = sext i32 %sub23 to i64
%arrayidx25 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %idxprom24
%11 = load i8, ptr %arrayidx25, align 1, !tbaa !5
%12 = add nsw i64 %indvars.iv79, %3
%arrayidx29 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %12
%13 = load i8, ptr %arrayidx29, align 1, !tbaa !5
%cmp31.not = icmp eq i8 %11, %13
br i1 %cmp31.not, label %for.inc35, label %for.end37.loopexit.split.loop.exit
for.inc35: ; preds = %for.body21
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%exitcond84.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count83
br i1 %exitcond84.not, label %for.end37, label %for.body21, !llvm.loop !10
for.end37.loopexit.split.loop.exit: ; preds = %for.body21
%14 = trunc i64 %indvars.iv79 to i32
br label %for.end37
for.end37: ; preds = %for.inc35, %for.end37.loopexit.split.loop.exit, %for.cond18.preheader
%i.1.lcssa = phi i32 [ 0, %for.cond18.preheader ], [ %14, %for.end37.loopexit.split.loop.exit ], [ %div, %for.inc35 ]
%cmp38 = icmp eq i32 %i.1.lcssa, %div
br label %if.end43
if.end43: ; preds = %for.end37, %for.end
%inc16.pn.in = phi i1 [ %cmp13, %for.end ], [ %cmp38, %for.end37 ]
%inc16.pn = zext i1 %inc16.pn.in to i32
%count.1 = add nuw nsw i32 %count.074, %inc16.pn
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end43, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1, %if.end43 ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
|
#include<stdio.h>
#include<string.h>
int main(){
int ans=0;
int len;
char str[101];
while(~scanf("%s",str)){
len=strlen(str);
if(len==1){
ans++;
}else {
int i=0;
while(str[i]==str[len-i-1]){
i++;
if(i==len/2){
ans++;
break;
}
}
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166655/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166655/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %str) #4
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%tobool.not29 = icmp eq i32 %call28, -1
br i1 %tobool.not29, label %while.end19, label %while.body
while.body: ; preds = %entry, %if.end18
%ans.030 = phi i32 [ %ans.2, %if.end18 ], [ 0, %entry ]
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5
%conv = trunc i64 %call2 to i32
%cmp = icmp eq i32 %conv, 1
br i1 %cmp, label %if.then, label %while.cond4.preheader
while.cond4.preheader: ; preds = %while.body
%div = sdiv i32 %conv, 2
%zext = zext i32 %div to i64
br label %while.cond4
if.then: ; preds = %while.body
%inc = add nsw i32 %ans.030, 1
br label %if.end18
while.cond4: ; preds = %while.cond4.preheader, %while.body12
%indvars.iv = phi i64 [ 0, %while.cond4.preheader ], [ %indvars.iv.next, %while.body12 ]
%arrayidx = getelementptr inbounds [101 x i8], ptr %str, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%1 = xor i64 %indvars.iv, -1
%sub6 = add i64 %call2, %1
%sext = shl i64 %sub6, 32
%idxprom7 = ashr exact i64 %sext, 32
%arrayidx8 = getelementptr inbounds [101 x i8], ptr %str, i64 0, i64 %idxprom7
%2 = load i8, ptr %arrayidx8, align 1, !tbaa !5
%cmp10 = icmp eq i8 %0, %2
br i1 %cmp10, label %while.body12, label %if.end18
while.body12: ; preds = %while.cond4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = icmp eq i64 %indvars.iv.next, %zext
br i1 %3, label %if.then16, label %while.cond4, !llvm.loop !8
if.then16: ; preds = %while.body12
%inc17 = add nsw i32 %ans.030, 1
br label %if.end18
if.end18: ; preds = %while.cond4, %if.then16, %if.then
%ans.2 = phi i32 [ %inc, %if.then ], [ %inc17, %if.then16 ], [ %ans.030, %while.cond4 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end19, label %while.body, !llvm.loop !10
while.end19: ; preds = %if.end18, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %ans.2, %if.end18 ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[101];
int count = 0;
while(scanf("%s", s) != EOF) {
int i;
int l = strlen(s);
if(l == 1) count++;
else {
for(i = 0; i < l / 2; i++) {
if(i == l / 2 - 1) {
if(s[i] == s[l - i - 1]) count++;
}
else {
if(s[i] != s[l - i - 1]) break;
}
}
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166699/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166699/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #4
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not55 = icmp eq i32 %call54, -1
br i1 %cmp.not55, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end36
%count.056 = phi i32 [ %count.3, %if.end36 ], [ 0, %entry ]
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%conv = trunc i64 %call2 to i32
%cmp3 = icmp eq i32 %conv, 1
br i1 %cmp3, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %while.body
%cmp550 = icmp sgt i32 %conv, 1
br i1 %cmp550, label %for.body.lr.ph, label %if.end36
for.body.lr.ph: ; preds = %for.cond.preheader
%div5960 = lshr i32 %conv, 1
%sub = add nsw i32 %div5960, -1
%0 = zext i32 %sub to i64
%wide.trip.count = zext i32 %div5960 to i64
%arrayidx = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %0
%sub13 = sub i32 %conv, %div5960
%idxprom14 = sext i32 %sub13 to i64
%arrayidx15 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %idxprom14
br label %for.body
if.then: ; preds = %while.body
%inc = add nsw i32 %count.056, 1
br label %if.end36
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%count.152 = phi i32 [ %count.056, %for.body.lr.ph ], [ %count.2, %for.inc ]
%cmp8 = icmp eq i64 %indvars.iv, %0
br i1 %cmp8, label %if.then10, label %if.else21
if.then10: ; preds = %for.body
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
%2 = load i8, ptr %arrayidx15, align 1, !tbaa !5
%cmp17 = icmp eq i8 %1, %2
%inc20 = zext i1 %cmp17 to i32
%spec.select = add nsw i32 %count.152, %inc20
br label %for.inc
if.else21: ; preds = %for.body
%arrayidx23 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx23, align 1, !tbaa !5
%4 = xor i64 %indvars.iv, -1
%sub26 = add i64 %call2, %4
%sext = shl i64 %sub26, 32
%idxprom27 = ashr exact i64 %sext, 32
%arrayidx28 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %idxprom27
%5 = load i8, ptr %arrayidx28, align 1, !tbaa !5
%cmp30.not = icmp eq i8 %3, %5
br i1 %cmp30.not, label %for.inc, label %if.end36
for.inc: ; preds = %if.then10, %if.else21
%count.2 = phi i32 [ %count.152, %if.else21 ], [ %spec.select, %if.then10 ]
%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.end36, label %for.body, !llvm.loop !8
if.end36: ; preds = %if.else21, %for.inc, %for.cond.preheader, %if.then
%count.3 = phi i32 [ %inc, %if.then ], [ %count.056, %for.cond.preheader ], [ %count.152, %if.else21 ], [ %count.2, %for.inc ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end36, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.3, %if.end36 ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
#include <math.h>
int main()
{
int n;
scanf("%d",&n);
n=pow(n,3);
printf("%d\n",n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_166741/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_166741/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%call1 = call double @pow(double noundef %conv, double noundef 3.000000e+00) #4
%conv2 = fptosi double %call1 to i32
store i32 %conv2, ptr %n, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv2)
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 @pow(double noundef, 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"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.