Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
const int long SIZE = 100000;
int main ()
{
int long A[SIZE] , B[SIZE];
int long a , b , k ,m , i , alarge , bsmall;
scanf("%ld %ld",&a,&b);
scanf("%ld %ld",&k,&m);
for(i=0 ; i<a ; i++)
scanf("%ld",&A[i]);
for(i=0 ; i<b ; i++)
scanf("%ld",&B[i]);
alarge = A[k-1];
bsmall = B[b-m];
if(alarge<bsmall)
printf("YES\n");
else
printf("NO\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2533/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2533/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@SIZE = dso_local local_unnamed_addr constant i64 100000, align 8
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%k = alloca i64, align 8
%m = alloca i64, align 8
%vla23 = alloca [100000 x i64], align 16
%vla124 = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %m)
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp26 = icmp sgt i64 %0, 0
br i1 %cmp26, label %for.body, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body, %entry
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp528 = icmp sgt i64 %1, 0
br i1 %cmp528, label %for.body6, label %for.end11
for.body: ; preds = %entry, %for.body
%i.027 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla23, i64 %i.027
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.027, 1
%2 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.body6: ; preds = %for.cond4.preheader, %for.body6
%i.129 = phi i64 [ %inc10, %for.body6 ], [ 0, %for.cond4.preheader ]
%arrayidx7 = getelementptr inbounds i64, ptr %vla124, i64 %i.129
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx7)
%inc10 = add nuw nsw i64 %i.129, 1
%3 = load i64, ptr %b, align 8, !tbaa !5
%cmp5 = icmp slt i64 %inc10, %3
br i1 %cmp5, label %for.body6, label %for.end11, !llvm.loop !11
for.end11: ; preds = %for.body6, %for.cond4.preheader
%.lcssa = phi i64 [ %1, %for.cond4.preheader ], [ %3, %for.body6 ]
%4 = load i64, ptr %k, align 8, !tbaa !5
%5 = getelementptr i64, ptr %vla23, i64 %4
%arrayidx12 = getelementptr i64, ptr %5, i64 -1
%6 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%7 = load i64, ptr %m, align 8, !tbaa !5
%sub13 = sub nsw i64 %.lcssa, %7
%arrayidx14 = getelementptr inbounds i64, ptr %vla124, i64 %sub13
%8 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%cmp15 = icmp slt i64 %6, %8
%str.4.str = select i1 %cmp15, ptr @str.4, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !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>
#define LEN 100005
typedef struct pp{
char name[100];
int t;
}P;
P Q[LEN+1];
int head = 1, tail, n;
void enqueue(P x);
P dequeue();
int main(){
int elaps = 0, c;
int i,q;
P u;
scanf("%d %d",&n,&q);
for(i = 1;i <= n; i++){
scanf("%s",Q[i].name);
scanf("%d",&Q[i].t);
}
tail = n + 1;
while( head != tail){
u = dequeue();
c = q < u.t ? q : u.t;
u.t -= c;
elaps += c;
if(u.t > 0) enqueue(u);
else{
printf("%s %d\n",u.name, elaps);
}
}
return 0;
}
void enqueue(P x){
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue(){
int i = head;
head = (head +1) % LEN;
return Q[i];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253342/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253342/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@head = dso_local local_unnamed_addr global i32 1, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@Q = dso_local global [100006 x %struct.pp] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@tail = dso_local local_unnamed_addr global i32 0, align 4
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not26 = icmp slt i32 %0, 1
br i1 %cmp.not26, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%3 = load i32, ptr @head, align 4, !tbaa !5
%cmp5.not28 = icmp eq i32 %3, %add
br i1 %cmp5.not28, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%4 = phi i32 [ %add, %while.body.lr.ph ], [ %8, %if.end ]
%5 = phi i32 [ %3, %while.body.lr.ph ], [ %9, %if.end ]
%elaps.029 = phi i32 [ 0, %while.body.lr.ph ], [ %add10, %if.end ]
%add.i = add nsw i32 %5, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !11
%idxprom.i = sext i32 %5 to i64
%arrayidx.i = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%6 = load i32, ptr %q, align 4
%7 = load i32, ptr %t6, align 4
%cond = call i32 @llvm.smin.i32(i32 %6, i32 %7)
%sub = sub nsw i32 %7, %cond
store i32 %sub, ptr %t6, align 4, !tbaa !14
%add10 = add nsw i32 %cond, %elaps.029
%cmp12 = icmp sgt i32 %sub, 0
br i1 %cmp12, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i22 = sext i32 %4 to i64
%arrayidx.i23 = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i22
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i23, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i24 = add nsw i32 %4, 1
%rem.i25 = srem i32 %add.i24, 100005
store i32 %rem.i25, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add10)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre32 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%8 = phi i32 [ %.pre32, %if.else ], [ %rem.i25, %if.then ]
%9 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %9, %8
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: 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(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !17
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !17
ret void
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!12}
!12 = distinct !{!12, !13, !"dequeue: %agg.result"}
!13 = distinct !{!13, !"dequeue"}
!14 = !{!15, !6, i64 100}
!15 = !{!"pp", !7, i64 0, !6, i64 100}
!16 = distinct !{!16, !10}
!17 = !{i64 0, i64 100, !18, i64 100, i64 4, !5}
!18 = !{!7, !7, i64 0}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN 100005
typedef struct pp{
char name[100];
int t;
}P;
P Q[LEN];
int head,tail,n;
void enqueue(P x){
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue(){
P x = Q[head];
head = (head+1) % LEN;
return x;
}
int min(int a,int b){
return a<b ? a : b;
}
int main(){
int elaps = 0,c;
int i,q;
P u;
scanf("%d %d",&n,&q);
for(i=1;i<=n;i++){
scanf("%s",Q[i].name);
scanf("%d",&Q[i].t);
}
head = 1; tail = n+1;
while(head != tail){
u = dequeue();
c = min(q,u.t);
u.t -= c;
elaps += c;
if(u.t>0) enqueue(u);
else{
printf("%s %d\n",u.name,elaps);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253386/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253386/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100005 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.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
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%elaps.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add9, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t6, align 4, !tbaa !16
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %t6, align 4, !tbaa !16
%add9 = add nsw i32 %cond.i, %elaps.028
%cmp11 = icmp sgt i32 %sub, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add9)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree 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.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree 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 = { 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 = { 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 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include<stdio.h>
int main(void)
{
int n,m,max,i,j,sum,k,r[50],b[50],w[50];
char s[50][51];
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){
w[i]=0;
b[i]=0;
r[i]=0;
}
for(i=0;i<n;i++){
scanf("%s",s[i]);
for(j=0;j<m;j++){
if(s[i][j]!='W'){
w[i]++;
}
if(s[i][j]!='B'){
b[i]++;
}
if(s[i][j]!='R'){
r[i]++;
}
}
}
max=2501;
for(i=0;i<n-2;i++){
for(j=0;j<n-1;j++){
sum=0;
for(k=0;k<=i;k++){
sum+=w[k];
}
for(k=i+1;k<=j;k++){
sum+=b[k];
}
for(k=j+1;k<n;k++){
sum+=r[k];
}
if(sum<max){
max=sum;
}
}
}
printf("%d\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253429/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253429/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%r = alloca [50 x i32], align 16
%b = alloca [50 x i32], align 16
%w = alloca [50 x i32], align 16
%s = alloca [50 x [51 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 2550, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp148 = icmp sgt i32 %0, 0
br i1 %cmp148, label %for.body7.preheader, label %for.end102
for.body7.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %w, i8 0, i64 %2, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 16 %b, i8 0, i64 %2, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 16 %r, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.body7
for.cond53.preheader: ; preds = %for.inc50
%cmp54168 = icmp sgt i32 %37, 2
br i1 %cmp54168, label %for.cond57.preheader.us.preheader, label %for.end102
for.cond57.preheader.us.preheader: ; preds = %for.cond53.preheader
%sub = add i32 %37, -2
%sub58 = add nsw i32 %37, -1
%3 = zext i32 %37 to i64
%wide.trip.count208 = zext i32 %sub to i64
%wide.trip.count201 = zext i32 %sub58 to i64
%wide.trip.count196 = zext i32 %37 to i64
br label %for.cond57.preheader.us
for.cond57.preheader.us: ; preds = %for.cond57.preheader.us.preheader, %for.cond57.for.inc100_crit_edge.us
%indvars.iv203 = phi i64 [ 1, %for.cond57.preheader.us.preheader ], [ %indvars.iv.next204, %for.cond57.for.inc100_crit_edge.us ]
%indvars.iv186 = phi i64 [ 0, %for.cond57.preheader.us.preheader ], [ %indvars.iv.next187, %for.cond57.for.inc100_crit_edge.us ]
%max.0169.us = phi i32 [ 2501, %for.cond57.preheader.us.preheader ], [ %spec.select.us, %for.cond57.for.inc100_crit_edge.us ]
%min.iters.check236 = icmp ult i64 %indvars.iv203, 8
%n.vec239 = and i64 %indvars.iv203, 9223372036854775800
%cmp.n241 = icmp eq i64 %indvars.iv203, %n.vec239
br label %for.cond62.preheader.us
for.body65.us: ; preds = %for.body65.us.preheader, %for.body65.us
%indvars.iv179 = phi i64 [ %indvars.iv.next180, %for.body65.us ], [ %indvars.iv179.ph, %for.body65.us.preheader ]
%sum.0154.us = phi i32 [ %add.us, %for.body65.us ], [ %sum.0154.us.ph, %for.body65.us.preheader ]
%arrayidx67.us = getelementptr inbounds [50 x i32], ptr %w, i64 0, i64 %indvars.iv179
%4 = load i32, ptr %arrayidx67.us, align 4, !tbaa !5
%add.us = add nsw i32 %4, %sum.0154.us
%indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
%exitcond185.not = icmp eq i64 %indvars.iv.next180, %indvars.iv203
br i1 %exitcond185.not, label %for.cond72.preheader.us, label %for.body65.us, !llvm.loop !9
for.end81.us: ; preds = %for.body75.us, %middle.block215, %for.cond72.preheader.us
%sum.1.lcssa.us = phi i32 [ %add.us.lcssa, %for.cond72.preheader.us ], [ %21, %middle.block215 ], [ %add78.us, %for.body75.us ]
%indvars.iv.next199 = add nuw nsw i64 %indvars.iv198, 1
%cmp84160.us = icmp ult i64 %indvars.iv.next199, %3
br i1 %cmp84160.us, label %for.body86.us.preheader, label %for.end92.us
for.body86.us.preheader: ; preds = %for.end81.us
%min.iters.check = icmp ult i64 %24, 8
br i1 %min.iters.check, label %for.body86.us.preheader251, label %vector.ph
vector.ph: ; preds = %for.body86.us.preheader
%n.vec = and i64 %24, -8
%ind.end = add i64 %indvars.iv191, %n.vec
%5 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.1.lcssa.us, i64 0
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> [ %5, %vector.ph ], [ %8, %vector.body ]
%vec.phi213 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%offset.idx = add i64 %indvars.iv191, %index
%6 = getelementptr inbounds [50 x i32], ptr %r, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %6, align 4, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
%wide.load214 = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = add <4 x i32> %wide.load, %vec.phi
%9 = add <4 x i32> %wide.load214, %vec.phi213
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %24, %n.vec
br i1 %cmp.n, label %for.end92.us, label %for.body86.us.preheader251
for.body86.us.preheader251: ; preds = %for.body86.us.preheader, %middle.block
%indvars.iv193.ph = phi i64 [ %indvars.iv191, %for.body86.us.preheader ], [ %ind.end, %middle.block ]
%sum.2161.us.ph = phi i32 [ %sum.1.lcssa.us, %for.body86.us.preheader ], [ %11, %middle.block ]
br label %for.body86.us
for.end92.us: ; preds = %for.body86.us, %middle.block, %for.end81.us
%sum.2.lcssa.us = phi i32 [ %sum.1.lcssa.us, %for.end81.us ], [ %11, %middle.block ], [ %add89.us, %for.body86.us ]
%spec.select.us = call i32 @llvm.smin.i32(i32 %sum.2.lcssa.us, i32 %max.1165.us)
%indvars.iv.next192 = add nuw nsw i64 %indvars.iv191, 1
%exitcond202.not = icmp eq i64 %indvars.iv.next199, %wide.trip.count201
br i1 %exitcond202.not, label %for.cond57.for.inc100_crit_edge.us, label %for.cond62.preheader.us, !llvm.loop !14
for.body86.us: ; preds = %for.body86.us.preheader251, %for.body86.us
%indvars.iv193 = phi i64 [ %indvars.iv.next194, %for.body86.us ], [ %indvars.iv193.ph, %for.body86.us.preheader251 ]
%sum.2161.us = phi i32 [ %add89.us, %for.body86.us ], [ %sum.2161.us.ph, %for.body86.us.preheader251 ]
%arrayidx88.us = getelementptr inbounds [50 x i32], ptr %r, i64 0, i64 %indvars.iv193
%12 = load i32, ptr %arrayidx88.us, align 4, !tbaa !5
%add89.us = add nsw i32 %12, %sum.2161.us
%indvars.iv.next194 = add nuw nsw i64 %indvars.iv193, 1
%exitcond197.not = icmp eq i64 %indvars.iv.next194, %wide.trip.count196
br i1 %exitcond197.not, label %for.end92.us, label %for.body86.us, !llvm.loop !15
for.body75.us: ; preds = %for.body75.us.preheader252, %for.body75.us
%indvars.iv188 = phi i64 [ %indvars.iv.next189, %for.body75.us ], [ %indvars.iv188.ph, %for.body75.us.preheader252 ]
%sum.1157.us = phi i32 [ %add78.us, %for.body75.us ], [ %sum.1157.us.ph, %for.body75.us.preheader252 ]
%indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1
%arrayidx77.us = getelementptr inbounds [50 x i32], ptr %b, i64 0, i64 %indvars.iv.next189
%13 = load i32, ptr %arrayidx77.us, align 4, !tbaa !5
%add78.us = add nsw i32 %13, %sum.1157.us
%cmp73.not.not.us = icmp ult i64 %indvars.iv.next189, %indvars.iv198
br i1 %cmp73.not.not.us, label %for.body75.us, label %for.end81.us, !llvm.loop !16
for.cond72.preheader.us: ; preds = %for.body65.us, %middle.block234
%add.us.lcssa = phi i32 [ %30, %middle.block234 ], [ %add.us, %for.body65.us ]
%cmp73.not.not156.us = icmp ult i64 %indvars.iv186, %indvars.iv198
br i1 %cmp73.not.not156.us, label %for.body75.us.preheader, label %for.end81.us
for.body75.us.preheader: ; preds = %for.cond72.preheader.us
%min.iters.check217 = icmp ult i64 %22, 8
br i1 %min.iters.check217, label %for.body75.us.preheader252, label %vector.ph218
vector.ph218: ; preds = %for.body75.us.preheader
%n.vec220 = and i64 %22, -8
%ind.end221 = add i64 %indvars.iv186, %n.vec220
%14 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add.us.lcssa, i64 0
br label %vector.body224
vector.body224: ; preds = %vector.body224, %vector.ph218
%index225 = phi i64 [ 0, %vector.ph218 ], [ %index.next231, %vector.body224 ]
%vec.phi226 = phi <4 x i32> [ %14, %vector.ph218 ], [ %18, %vector.body224 ]
%vec.phi227 = phi <4 x i32> [ zeroinitializer, %vector.ph218 ], [ %19, %vector.body224 ]
%offset.idx228 = add i64 %indvars.iv186, %index225
%15 = add nuw nsw i64 %offset.idx228, 1
%16 = getelementptr inbounds [50 x i32], ptr %b, i64 0, i64 %15
%wide.load229 = load <4 x i32>, ptr %16, align 4, !tbaa !5
%17 = getelementptr inbounds i32, ptr %16, i64 4
%wide.load230 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = add <4 x i32> %wide.load229, %vec.phi226
%19 = add <4 x i32> %wide.load230, %vec.phi227
%index.next231 = add nuw i64 %index225, 8
%20 = icmp eq i64 %index.next231, %n.vec220
br i1 %20, label %middle.block215, label %vector.body224, !llvm.loop !17
middle.block215: ; preds = %vector.body224
%bin.rdx232 = add <4 x i32> %19, %18
%21 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx232)
%cmp.n223 = icmp eq i64 %22, %n.vec220
br i1 %cmp.n223, label %for.end81.us, label %for.body75.us.preheader252
for.body75.us.preheader252: ; preds = %for.body75.us.preheader, %middle.block215
%indvars.iv188.ph = phi i64 [ %indvars.iv186, %for.body75.us.preheader ], [ %ind.end221, %middle.block215 ]
%sum.1157.us.ph = phi i32 [ %add.us.lcssa, %for.body75.us.preheader ], [ %21, %middle.block215 ]
br label %for.body75.us
for.cond62.preheader.us: ; preds = %for.cond57.preheader.us, %for.end92.us
%indvars.iv198 = phi i64 [ 0, %for.cond57.preheader.us ], [ %indvars.iv.next199, %for.end92.us ]
%indvars.iv191 = phi i64 [ 1, %for.cond57.preheader.us ], [ %indvars.iv.next192, %for.end92.us ]
%max.1165.us = phi i32 [ %max.0169.us, %for.cond57.preheader.us ], [ %spec.select.us, %for.end92.us ]
%22 = sub nsw i64 %indvars.iv198, %indvars.iv186
%23 = xor i64 %indvars.iv198, -1
%24 = add nsw i64 %23, %wide.trip.count196
br i1 %min.iters.check236, label %for.body65.us.preheader, label %vector.body242
vector.body242: ; preds = %for.cond62.preheader.us, %vector.body242
%index243 = phi i64 [ %index.next248, %vector.body242 ], [ 0, %for.cond62.preheader.us ]
%vec.phi244 = phi <4 x i32> [ %27, %vector.body242 ], [ zeroinitializer, %for.cond62.preheader.us ]
%vec.phi245 = phi <4 x i32> [ %28, %vector.body242 ], [ zeroinitializer, %for.cond62.preheader.us ]
%25 = getelementptr inbounds [50 x i32], ptr %w, i64 0, i64 %index243
%wide.load246 = load <4 x i32>, ptr %25, align 16, !tbaa !5
%26 = getelementptr inbounds i32, ptr %25, i64 4
%wide.load247 = load <4 x i32>, ptr %26, align 16, !tbaa !5
%27 = add <4 x i32> %wide.load246, %vec.phi244
%28 = add <4 x i32> %wide.load247, %vec.phi245
%index.next248 = add nuw i64 %index243, 8
%29 = icmp eq i64 %index.next248, %n.vec239
br i1 %29, label %middle.block234, label %vector.body242, !llvm.loop !18
middle.block234: ; preds = %vector.body242
%bin.rdx249 = add <4 x i32> %28, %27
%30 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx249)
br i1 %cmp.n241, label %for.cond72.preheader.us, label %for.body65.us.preheader
for.body65.us.preheader: ; preds = %for.cond62.preheader.us, %middle.block234
%indvars.iv179.ph = phi i64 [ 0, %for.cond62.preheader.us ], [ %n.vec239, %middle.block234 ]
%sum.0154.us.ph = phi i32 [ 0, %for.cond62.preheader.us ], [ %30, %middle.block234 ]
br label %for.body65.us
for.cond57.for.inc100_crit_edge.us: ; preds = %for.end92.us
%indvars.iv.next187 = add nuw nsw i64 %indvars.iv186, 1
%indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1
%exitcond209.not = icmp eq i64 %indvars.iv.next187, %wide.trip.count208
br i1 %exitcond209.not, label %for.end102, label %for.cond57.preheader.us, !llvm.loop !19
for.body7: ; preds = %for.body7.preheader, %for.inc50
%indvars.iv176 = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next177, %for.inc50 ]
%arrayidx9 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv176
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx9)
%31 = load i32, ptr %m, align 4, !tbaa !5
%cmp12150 = icmp sgt i32 %31, 0
br i1 %cmp12150, label %for.body13.lr.ph, label %for.inc50
for.body13.lr.ph: ; preds = %for.body7
%arrayidx21 = getelementptr inbounds [50 x i32], ptr %w, i64 0, i64 %indvars.iv176
%arrayidx32 = getelementptr inbounds [50 x i32], ptr %b, i64 0, i64 %indvars.iv176
%arrayidx44 = getelementptr inbounds [50 x i32], ptr %r, i64 0, i64 %indvars.iv176
%wide.trip.count = zext i32 %31 to i64
br label %for.body13
for.body13: ; preds = %for.body13.lr.ph, %for.inc47
%indvars.iv = phi i64 [ 0, %for.body13.lr.ph ], [ %indvars.iv.next, %for.inc47 ]
%arrayidx17 = getelementptr inbounds [50 x [51 x i8]], ptr %s, i64 0, i64 %indvars.iv176, i64 %indvars.iv
%32 = load i8, ptr %arrayidx17, align 1, !tbaa !20
%cmp18.not = icmp eq i8 %32, 87
br i1 %cmp18.not, label %if.end34.thread144, label %if.end
if.end34.thread144: ; preds = %for.body13
%33 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%inc33146 = add nsw i32 %33, 1
store i32 %inc33146, ptr %arrayidx32, align 4, !tbaa !5
br label %if.then42
if.end: ; preds = %for.body13
%34 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%inc22 = add nsw i32 %34, 1
store i32 %inc22, ptr %arrayidx21, align 4, !tbaa !5
%cmp28.not = icmp eq i8 %32, 66
br i1 %cmp28.not, label %if.then42, label %if.end34
if.end34: ; preds = %if.end
%35 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%inc33 = add nsw i32 %35, 1
store i32 %inc33, ptr %arrayidx32, align 4, !tbaa !5
%cmp40.not = icmp eq i8 %32, 82
br i1 %cmp40.not, label %for.inc47, label %if.then42
if.then42: ; preds = %if.end, %if.end34.thread144, %if.end34
%36 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%inc45 = add nsw i32 %36, 1
store i32 %inc45, ptr %arrayidx44, align 4, !tbaa !5
br label %for.inc47
for.inc47: ; preds = %if.end34, %if.then42
%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.inc50, label %for.body13, !llvm.loop !21
for.inc50: ; preds = %for.inc47, %for.body7
%indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
%37 = load i32, ptr %n, align 4, !tbaa !5
%38 = sext i32 %37 to i64
%cmp6 = icmp slt i64 %indvars.iv.next177, %38
br i1 %cmp6, label %for.body7, label %for.cond53.preheader, !llvm.loop !22
for.end102: ; preds = %for.cond57.for.inc100_crit_edge.us, %entry, %for.cond53.preheader
%max.0.lcssa = phi i32 [ 2501, %for.cond53.preheader ], [ 2501, %entry ], [ %spec.select.us, %for.cond57.for.inc100_crit_edge.us ]
%call103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2550, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10, !12, !11}
!19 = distinct !{!19, !10}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
int main(void)
{
int n, i;
char s[10001];
scanf("%d", &n);
scanf("%s", s);
for (i = 0; s[i] != '\0'; i++) //配列s[iに入ってる文字の、次の文字を代入する
{
s[i] = 'A' + (s[i] - 'A' + n) % 26;
}
printf("%s", s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253472/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253472/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [10001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 10001, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp.not15 = icmp eq i8 %0, 0
br i1 %cmp.not15, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %n, align 4, !tbaa !8
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%2 = phi i8 [ %0, %for.body.lr.ph ], [ %4, %for.body ]
%arrayidx17 = phi ptr [ %s, %for.body.lr.ph ], [ %arrayidx, %for.body ]
%conv = sext i8 %2 to i32
%sub = add nsw i32 %conv, -65
%add = add nsw i32 %sub, %1
%rem = srem i32 %add, 26
%3 = trunc i32 %rem to i8
%conv7 = add nsw i8 %3, 65
store i8 %conv7, ptr %arrayidx17, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [10001 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %4, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body, %entry
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 10001, ptr nonnull %s) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int a[100];
int n,i,k=0,j=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%1d",&a[i]);
if(a[i]==0)
k++;
else
j++;
}
if(k==j)
{
printf("2\n%d ",a[0]);
for(i=1;i<n;i++)
{
printf("%d",a[i]);
}
printf("\n");
}
else
{
printf("1\n%d",a[0]);
for(i=1;i<n;i++)
{
printf("%d",a[i]);
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25353/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25353/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%1d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"2\0A%d \00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"1\0A%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #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
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, label %for.body, label %if.then8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%j.050 = phi i32 [ %j.1, %for.body ], [ 0, %entry ]
%k.049 = phi i32 [ %k.1, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp4 = icmp eq i32 %1, 0
%inc = zext i1 %cmp4 to i32
%k.1 = add nuw nsw i32 %k.049, %inc
%not.cmp4 = xor i1 %cmp4, true
%inc5 = zext i1 %not.cmp4 to i32
%j.1 = add nuw nsw i32 %j.050, %inc5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp7 = icmp eq i32 %k.1, %j.1
br i1 %cmp7, label %if.then8, label %if.else21
if.then8: ; preds = %entry, %for.end
%4 = load i32, ptr %a, align 16, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp1254 = icmp sgt i32 %5, 1
br i1 %cmp1254, label %for.body13, label %if.end34
for.body13: ; preds = %if.then8, %for.body13
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.body13 ], [ 1, %if.then8 ]
%arrayidx15 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv60
%6 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp12 = icmp slt i64 %indvars.iv.next61, %8
br i1 %cmp12, label %for.body13, label %if.end34, !llvm.loop !11
if.else21: ; preds = %for.end
%9 = load i32, ptr %a, align 16, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %9)
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp2552 = icmp sgt i32 %10, 1
br i1 %cmp2552, label %for.body26, label %if.end34
for.body26: ; preds = %if.else21, %for.body26
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.body26 ], [ 1, %if.else21 ]
%arrayidx28 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv57
%11 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp25 = icmp slt i64 %indvars.iv.next58, %13
br i1 %cmp25, label %for.body26, label %if.end34, !llvm.loop !12
if.end34: ; preds = %for.body26, %for.body13, %if.else21, %if.then8
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
char S[10001],a[10001];
int N,i,j;
scanf("%d", &N);
scanf("%s", S);
for(i=0;S[i]!='\0';i++)
{
a[i]=S[i]+N;
if(a[i]>'Z')
{
a[i]=a[i]-26;
}
}
a[i]='\0';
printf("%s\n", a);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253573/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253573/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [10001 x i8], align 16
%a = alloca [10001 x i8], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 10001, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 10001, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i8, ptr %S, align 16, !tbaa !5
%cmp.not31 = icmp eq i8 %0, 0
br i1 %cmp.not31, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %N, align 4, !tbaa !8
%2 = trunc i32 %1 to i8
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%3 = phi i8 [ %0, %for.body.lr.ph ], [ %4, %for.body ]
%conv6 = add i8 %3, %2
%arrayidx8 = getelementptr inbounds [10001 x i8], ptr %a, i64 0, i64 %indvars.iv
%cmp12 = icmp sgt i8 %conv6, 90
%sub = add i8 %conv6, -26
%spec.select = select i1 %cmp12, i8 %sub, i8 %conv6
store i8 %spec.select, ptr %arrayidx8, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [10001 x i8], ptr %S, i64 0, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %4, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body, %entry
%idxprom.lcssa = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%arrayidx21 = getelementptr inbounds [10001 x i8], ptr %a, i64 0, i64 %idxprom.lcssa
store i8 0, ptr %arrayidx21, align 1, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %a)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 10001, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 10001, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void){
int n;
scanf("%d", &n);
char s[10010];
scanf("%s", s);
int len;
len = strlen(s);
for(int i=0; i<len; i++){
char c = s[i] + n;
if(c <= 90){
s[i] = c;
}else{
s[i] = c % 91 + 65;
}
}
printf("%s", s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253623/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253623/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [10010 x i8], align 16
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)
call void @llvm.lifetime.start.p0(i64 10010, ptr nonnull %s) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%conv = trunc i64 %call3 to i32
%cmp25 = icmp sgt i32 %conv, 0
br i1 %cmp25, label %iter.check, label %for.cond.cleanup
iter.check: ; preds = %entry
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = trunc i32 %0 to i8
%wide.trip.count = and i64 %call3, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check28 = icmp ult i64 %wide.trip.count, 32
br i1 %min.iters.check28, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.mod.vf = and i64 %call3, 31
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
%broadcast.splatinsert = insertelement <16 x i8> poison, i8 %1, i64 0
%broadcast.splat = shufflevector <16 x i8> %broadcast.splatinsert, <16 x i8> poison, <16 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%2 = getelementptr inbounds [10010 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <16 x i8>, ptr %2, align 16, !tbaa !9
%3 = getelementptr inbounds i8, ptr %2, i64 16
%wide.load29 = load <16 x i8>, ptr %3, align 16, !tbaa !9
%4 = add <16 x i8> %wide.load, %broadcast.splat
%5 = add <16 x i8> %wide.load29, %broadcast.splat
%6 = icmp slt <16 x i8> %4, <i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91>
%7 = icmp slt <16 x i8> %5, <i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91>
%8 = add <16 x i8> %4, <i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26>
%9 = add <16 x i8> %5, <i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26>
%10 = select <16 x i1> %6, <16 x i8> %4, <16 x i8> %8
%11 = select <16 x i1> %7, <16 x i8> %5, <16 x i8> %9
store <16 x i8> %10, ptr %2, align 16, !tbaa !9
store <16 x i8> %11, ptr %3, align 16, !tbaa !9
%index.next = add nuw i64 %index, 32
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.cond.cleanup, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%min.epilog.iters.check = icmp ult i64 %n.mod.vf, 8
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.mod.vf30 = and i64 %call3, 7
%n.vec31 = sub nsw i64 %wide.trip.count, %n.mod.vf30
%broadcast.splatinsert35 = insertelement <8 x i8> poison, i8 %1, i64 0
%broadcast.splat36 = shufflevector <8 x i8> %broadcast.splatinsert35, <8 x i8> poison, <8 x i32> zeroinitializer
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index33 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next37, %vec.epilog.vector.body ]
%13 = getelementptr inbounds [10010 x i8], ptr %s, i64 0, i64 %index33
%wide.load34 = load <8 x i8>, ptr %13, align 1, !tbaa !9
%14 = add <8 x i8> %wide.load34, %broadcast.splat36
%15 = icmp slt <8 x i8> %14, <i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91, i8 91>
%16 = add <8 x i8> %14, <i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26, i8 -26>
%17 = select <8 x i1> %15, <8 x i8> %14, <8 x i8> %16
store <8 x i8> %17, ptr %13, align 1, !tbaa !9
%index.next37 = add nuw i64 %index33, 8
%18 = icmp eq i64 %index.next37, %n.vec31
br i1 %18, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !14
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n32 = icmp eq i64 %n.mod.vf30, 0
br i1 %cmp.n32, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec31, %vec.epilog.middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %vec.epilog.middle.block, %entry
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 10010, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader ]
%arrayidx = getelementptr inbounds [10010 x i8], ptr %s, i64 0, i64 %indvars.iv
%19 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv6 = add i8 %19, %1
%cmp8 = icmp slt i8 %conv6, 91
%conv14 = add i8 %conv6, -26
%storemerge = select i1 %cmp8, i8 %conv6, i8 %conv14
store i8 %storemerge, ptr %arrayidx, align 1, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !12, !13}
!15 = distinct !{!15, !11, !13, !12}
|
#include<stdio.h>
#include<string.h>
int main(){
int N,i=1;
scanf("%d",&N);
//printf("%d\n",N);
char S[10000];
scanf("%s",S);
//printf("%s\n",S);
for (i = 0; i < strlen(S);i++){
//printf("OK\n");
S[i] += N;
if(S[i] >= 91) S[i] -= 26;
}
for (i = 0; i < strlen(S); i++){
//printf("Go\n");
printf("%c",S[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253674/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253674/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%S = alloca [10000 x i8], 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 10000, ptr nonnull %S) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%char0 = load i8, ptr %S, align 16
%cmp38.not = icmp eq i8 %char0, 0
br i1 %cmp38.not, label %for.end29, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = trunc i32 %0 to i8
br label %for.body
for.cond16.preheader: ; preds = %for.body
%char045.pre = load i8, ptr %S, align 16
%2 = icmp eq i8 %char045.pre, 0
br i1 %2, label %for.end29, label %for.body22
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds [10000 x i8], ptr %S, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv6 = add i8 %3, %1
%cmp10 = icmp sgt i8 %conv6, 90
%sub = add i8 %conv6, -26
%spec.select = select i1 %cmp10, i8 %sub, i8 %conv6
store i8 %spec.select, ptr %arrayidx, align 1, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #6
%cmp = icmp ugt i64 %call3, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond16.preheader, !llvm.loop !10
for.body22: ; preds = %for.cond16.preheader, %for.body22
%indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.body22 ], [ 0, %for.cond16.preheader ]
%arrayidx24 = getelementptr inbounds [10000 x i8], ptr %S, i64 0, i64 %indvars.iv47
%4 = load i8, ptr %arrayidx24, align 1, !tbaa !9
%conv25 = sext i8 %4 to i32
%putchar = call i32 @putchar(i32 %conv25)
%indvars.iv.next48 = add nuw i64 %indvars.iv47, 1
%call19 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #6
%cmp20 = icmp ugt i64 %call19, %indvars.iv.next48
br i1 %cmp20, label %for.body22, label %for.end29, !llvm.loop !12
for.end29: ; preds = %for.body22, %entry, %for.cond16.preheader
call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %S) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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 @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 nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int
main()
{
int n;
char c;
scanf("%d\n", &n);
while (1) {
c = getc(stdin);
if ((c < 'A') || (c > 'Z'))
break;
printf("%c", ((c - 'A') + n) % 26 + 'A');
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253724/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253724/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = 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
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 ptr, ptr @stdin, align 8, !tbaa !5
%call112 = call i32 @getc(ptr noundef %0)
%sext13 = shl i32 %call112, 24
%1 = add i32 %sext13, -1509949441
%or.cond14 = icmp ult i32 %1, -419430401
br i1 %or.cond14, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%call115 = phi i32 [ %call1, %if.end ], [ %call112, %entry ]
%conv2 = and i32 %call115, 255
%sub = add nsw i32 %conv2, -65
%2 = load i32, ptr %n, align 4, !tbaa !9
%add = add nsw i32 %sub, %2
%rem = srem i32 %add, 26
%add8 = add nsw i32 %rem, 65
%putchar = call i32 @putchar(i32 %add8)
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call1 = call i32 @getc(ptr noundef %3)
%sext = shl i32 %call1, 24
%4 = add i32 %sext, -1509949441
%or.cond = icmp ult i32 %4, -419430401
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
|
#include<stdio.h>
int main(void){
int n,m,c,i,j;
int a,b[20];
int sum[20],cnt=0;
scanf("%d %d %d",&n,&m,&c);
for(i=0;i<m;i++){
scanf("%d",&b[i]);
}
for(i=0;i<n;i++){
sum[i]=c;
for(j=0;j<m;j++){
scanf("%d",&a);
sum[i]+=a*b[j];
}
}
for(i=0;i<n;i++){
if(0<sum[i]){
cnt++;
}
}
printf("%d",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253782/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253782/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; 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
%c = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca [20 x i32], align 16
%sum = alloca [20 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %sum) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %c)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp44 = icmp sgt i32 %0, 0
br i1 %cmp44, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %8, %for.body ]
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp348 = icmp sgt i32 %2, 0
br i1 %cmp348, label %for.body4.lr.ph, label %for.end30
for.body4.lr.ph: ; preds = %for.cond2.preheader
%3 = icmp sgt i32 %1, 0
br i1 %3, label %for.body4, label %for.body4.lr.ph.split.us
for.body4.lr.ph.split.us: ; preds = %for.body4.lr.ph
%4 = load i32, ptr %c, align 4, !tbaa !5
%wide.trip.count = zext i32 %2 to i64
%min.iters.check = icmp ult i32 %2, 8
br i1 %min.iters.check, label %for.body4.us.preheader, label %vector.ph
vector.ph: ; preds = %for.body4.lr.ph.split.us
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %4, 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 ]
%5 = getelementptr inbounds [20 x i32], ptr %sum, i64 0, i64 %index
store <4 x i32> %broadcast.splat, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
store <4 x i32> %broadcast.splat, ptr %6, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond21.preheader, label %for.body4.us.preheader
for.body4.us.preheader: ; preds = %for.body4.lr.ph.split.us, %middle.block
%indvars.iv57.ph = phi i64 [ 0, %for.body4.lr.ph.split.us ], [ %n.vec, %middle.block ]
br label %for.body4.us
for.body4.us: ; preds = %for.body4.us.preheader, %for.body4.us
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.body4.us ], [ %indvars.iv57.ph, %for.body4.us.preheader ]
%arrayidx6.us = getelementptr inbounds [20 x i32], ptr %sum, i64 0, i64 %indvars.iv57
store i32 %4, ptr %arrayidx6.us, align 4, !tbaa !5
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond.not = icmp eq i64 %indvars.iv.next58, %wide.trip.count
br i1 %exitcond.not, label %for.cond21.preheader, label %for.body4.us, !llvm.loop !13
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %b, 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
%8 = load i32, ptr %m, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !14
for.cond21.preheader: ; preds = %for.body4.us, %for.inc18, %middle.block
%.lcssa = phi i32 [ %2, %middle.block ], [ %28, %for.inc18 ], [ %2, %for.body4.us ]
%cmp2250 = icmp sgt i32 %.lcssa, 0
br i1 %cmp2250, label %for.body23.preheader, label %for.end30
for.body23.preheader: ; preds = %for.cond21.preheader
%wide.trip.count69 = zext i32 %.lcssa to i64
%min.iters.check83 = icmp ult i32 %.lcssa, 8
br i1 %min.iters.check83, label %for.body23.preheader94, label %vector.ph84
vector.ph84: ; preds = %for.body23.preheader
%n.vec86 = and i64 %wide.trip.count69, 4294967288
br label %vector.body89
vector.body89: ; preds = %vector.body89, %vector.ph84
%index90 = phi i64 [ 0, %vector.ph84 ], [ %index.next93, %vector.body89 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph84 ], [ %16, %vector.body89 ]
%vec.phi91 = phi <4 x i32> [ zeroinitializer, %vector.ph84 ], [ %17, %vector.body89 ]
%10 = getelementptr inbounds [20 x i32], ptr %sum, i64 0, i64 %index90
%wide.load = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load92 = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = icmp sgt <4 x i32> %wide.load, zeroinitializer
%13 = icmp sgt <4 x i32> %wide.load92, 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> %vec.phi, %14
%17 = add <4 x i32> %vec.phi91, %15
%index.next93 = add nuw i64 %index90, 8
%18 = icmp eq i64 %index.next93, %n.vec86
br i1 %18, label %middle.block81, label %vector.body89, !llvm.loop !15
middle.block81: ; preds = %vector.body89
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n88 = icmp eq i64 %n.vec86, %wide.trip.count69
br i1 %cmp.n88, label %for.end30, label %for.body23.preheader94
for.body23.preheader94: ; preds = %for.body23.preheader, %middle.block81
%indvars.iv66.ph = phi i64 [ 0, %for.body23.preheader ], [ %n.vec86, %middle.block81 ]
%cnt.052.ph = phi i32 [ 0, %for.body23.preheader ], [ %19, %middle.block81 ]
br label %for.body23
for.body4: ; preds = %for.body4.lr.ph, %for.inc18
%20 = phi i32 [ %28, %for.inc18 ], [ %2, %for.body4.lr.ph ]
%21 = phi i32 [ %29, %for.inc18 ], [ %1, %for.body4.lr.ph ]
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.inc18 ], [ 0, %for.body4.lr.ph ]
%22 = load i32, ptr %c, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [20 x i32], ptr %sum, i64 0, i64 %indvars.iv63
store i32 %22, ptr %arrayidx6, align 4, !tbaa !5
%cmp846 = icmp sgt i32 %21, 0
br i1 %cmp846, label %for.body9, label %for.inc18
for.body9: ; preds = %for.body4, %for.body9
%23 = phi i32 [ %add, %for.body9 ], [ %22, %for.body4 ]
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.body9 ], [ 0, %for.body4 ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%24 = load i32, ptr %a, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv60
%25 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%mul = mul nsw i32 %25, %24
%add = add nsw i32 %23, %mul
store i32 %add, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%26 = load i32, ptr %m, align 4, !tbaa !5
%27 = sext i32 %26 to i64
%cmp8 = icmp slt i64 %indvars.iv.next61, %27
br i1 %cmp8, label %for.body9, label %for.inc18.loopexit, !llvm.loop !16
for.inc18.loopexit: ; preds = %for.body9
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc18
for.inc18: ; preds = %for.inc18.loopexit, %for.body4
%28 = phi i32 [ %.pre, %for.inc18.loopexit ], [ %20, %for.body4 ]
%29 = phi i32 [ %26, %for.inc18.loopexit ], [ %21, %for.body4 ]
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%30 = sext i32 %28 to i64
%cmp3 = icmp slt i64 %indvars.iv.next64, %30
br i1 %cmp3, label %for.body4, label %for.cond21.preheader, !llvm.loop !17
for.body23: ; preds = %for.body23.preheader94, %for.body23
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body23 ], [ %indvars.iv66.ph, %for.body23.preheader94 ]
%cnt.052 = phi i32 [ %spec.select, %for.body23 ], [ %cnt.052.ph, %for.body23.preheader94 ]
%arrayidx25 = getelementptr inbounds [20 x i32], ptr %sum, i64 0, i64 %indvars.iv66
%31 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %31, 0
%inc27 = zext i1 %cmp26 to i32
%spec.select = add nuw nsw i32 %cnt.052, %inc27
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.end30, label %for.body23, !llvm.loop !19
for.end30: ; preds = %for.body23, %middle.block81, %for.cond2.preheader, %for.cond21.preheader
%cnt.0.lcssa = phi i32 [ 0, %for.cond21.preheader ], [ 0, %for.cond2.preheader ], [ %19, %middle.block81 ], [ %spec.select, %for.body23 ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %sum) #4
call void @llvm.lifetime.end.p0(i64 80, 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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
!19 = distinct !{!19, !10, !12, !11}
|
#include <stdio.h>
#include <math.h>
int abs(int n){
if(n > 0){
return n;
} else {
return -n;
}
}
int main(){
int n, m, c;
scanf("%d %d %d", &n, &m, &c);
int b[m];
for(int i = 0; i < m; i++){
scanf("%d", &b[i]);
}
int a[n][m];
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
scanf("%d", &a[i][j]);
}
}
int count = 0;
int sum;
for(int i = 0; i < n; i++){
sum = 0;
for(int j = 0; j < m; j++){
sum += a[i][j]*b[j];
}
//sum += c;
if(sum+c > 0){
count++;
}
}
printf("%d", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253825/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253825/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @abs(i32 noundef %n) local_unnamed_addr #0 {
entry:
%retval.0 = tail call i32 @llvm.abs.i32(i32 %n, i1 true)
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %c)
%0 = load i32, ptr %m, 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 %m, align 4, !tbaa !5
%cmp63 = icmp sgt i32 %3, 0
br i1 %cmp63, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%4 = phi i32 [ %3, %entry ], [ %11, %for.body ]
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = zext i32 %5 to i64
%7 = zext i32 %4 to i64
%8 = mul nuw i64 %6, %7
%vla2 = alloca i32, i64 %8, align 16
%cmp567 = icmp sgt i32 %5, 0
br i1 %cmp567, label %for.cond8.preheader.lr.ph, label %for.cond.cleanup26
for.cond8.preheader.lr.ph: ; preds = %for.cond.cleanup
%9 = icmp sgt i32 %4, 0
br i1 %9, label %for.cond8.preheader, label %for.cond29.preheader.lr.ph.thread
for.cond29.preheader.lr.ph.thread: ; preds = %for.cond8.preheader.lr.ph
%10 = load i32, ptr %c, align 4, !tbaa !5
br label %for.cond29.preheader.lr.ph.split
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 %m, 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 !9
for.cond8.preheader: ; preds = %for.cond8.preheader.lr.ph, %for.cond.cleanup10
%13 = phi i32 [ %32, %for.cond.cleanup10 ], [ %5, %for.cond8.preheader.lr.ph ]
%14 = phi i32 [ %33, %for.cond.cleanup10 ], [ %4, %for.cond8.preheader.lr.ph ]
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.cond.cleanup10 ], [ 0, %for.cond8.preheader.lr.ph ]
%cmp965 = icmp sgt i32 %14, 0
br i1 %cmp965, label %for.body11.lr.ph, label %for.cond.cleanup10
for.body11.lr.ph: ; preds = %for.cond8.preheader
%15 = mul nuw nsw i64 %indvars.iv87, %7
%arrayidx13 = getelementptr inbounds i32, ptr %vla2, i64 %15
br label %for.body11
for.cond24.preheader: ; preds = %for.cond.cleanup10
%cmp2574 = icmp sgt i32 %32, 0
br i1 %cmp2574, label %for.cond29.preheader.lr.ph, label %for.cond.cleanup26
for.cond29.preheader.lr.ph: ; preds = %for.cond24.preheader
%cmp3070 = icmp sgt i32 %33, 0
%16 = load i32, ptr %c, align 4, !tbaa !5
br i1 %cmp3070, label %for.cond29.preheader.us.preheader, label %for.cond29.preheader.lr.ph.split
for.cond29.preheader.us.preheader: ; preds = %for.cond29.preheader.lr.ph
%wide.trip.count96 = zext i32 %32 to i64
%wide.trip.count = zext i32 %33 to i64
%min.iters.check = icmp ult i32 %33, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond29.preheader.us
for.cond29.preheader.us: ; preds = %for.cond29.preheader.us.preheader, %for.cond29.for.cond.cleanup31_crit_edge.us
%indvars.iv93 = phi i64 [ 0, %for.cond29.preheader.us.preheader ], [ %indvars.iv.next94, %for.cond29.for.cond.cleanup31_crit_edge.us ]
%count.075.us = phi i32 [ 0, %for.cond29.preheader.us.preheader ], [ %spec.select.us, %for.cond29.for.cond.cleanup31_crit_edge.us ]
%17 = mul nuw nsw i64 %indvars.iv93, %7
%arrayidx34.us = getelementptr inbounds i32, ptr %vla2, i64 %17
br i1 %min.iters.check, label %for.body32.us.preheader, label %vector.body
vector.body: ; preds = %for.cond29.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond29.preheader.us ]
%vec.phi = phi <4 x i32> [ %24, %vector.body ], [ zeroinitializer, %for.cond29.preheader.us ]
%vec.phi113 = phi <4 x i32> [ %25, %vector.body ], [ zeroinitializer, %for.cond29.preheader.us ]
%18 = getelementptr inbounds i32, ptr %arrayidx34.us, i64 %index
%wide.load = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds i32, ptr %18, i64 4
%wide.load114 = load <4 x i32>, ptr %19, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load115 = load <4 x i32>, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds i32, ptr %20, i64 4
%wide.load116 = load <4 x i32>, ptr %21, align 16, !tbaa !5
%22 = mul nsw <4 x i32> %wide.load115, %wide.load
%23 = mul nsw <4 x i32> %wide.load116, %wide.load114
%24 = add <4 x i32> %22, %vec.phi
%25 = add <4 x i32> %23, %vec.phi113
%index.next = add nuw i64 %index, 8
%26 = icmp eq i64 %index.next, %n.vec
br i1 %26, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %25, %24
%27 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond29.for.cond.cleanup31_crit_edge.us, label %for.body32.us.preheader
for.body32.us.preheader: ; preds = %for.cond29.preheader.us, %middle.block
%indvars.iv90.ph = phi i64 [ 0, %for.cond29.preheader.us ], [ %n.vec, %middle.block ]
%sum.071.us.ph = phi i32 [ 0, %for.cond29.preheader.us ], [ %27, %middle.block ]
br label %for.body32.us
for.body32.us: ; preds = %for.body32.us.preheader, %for.body32.us
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.body32.us ], [ %indvars.iv90.ph, %for.body32.us.preheader ]
%sum.071.us = phi i32 [ %add.us, %for.body32.us ], [ %sum.071.us.ph, %for.body32.us.preheader ]
%arrayidx36.us = getelementptr inbounds i32, ptr %arrayidx34.us, i64 %indvars.iv90
%28 = load i32, ptr %arrayidx36.us, align 4, !tbaa !5
%arrayidx38.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv90
%29 = load i32, ptr %arrayidx38.us, align 4, !tbaa !5
%mul.us = mul nsw i32 %29, %28
%add.us = add nsw i32 %mul.us, %sum.071.us
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%exitcond.not = icmp eq i64 %indvars.iv.next91, %wide.trip.count
br i1 %exitcond.not, label %for.cond29.for.cond.cleanup31_crit_edge.us, label %for.body32.us, !llvm.loop !14
for.cond29.for.cond.cleanup31_crit_edge.us: ; preds = %for.body32.us, %middle.block
%add.us.lcssa = phi i32 [ %27, %middle.block ], [ %add.us, %for.body32.us ]
%add42.us = add nsw i32 %16, %add.us.lcssa
%cmp43.us = icmp sgt i32 %add42.us, 0
%inc44.us = zext i1 %cmp43.us to i32
%spec.select.us = add nuw nsw i32 %count.075.us, %inc44.us
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%exitcond97.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count96
br i1 %exitcond97.not, label %for.cond.cleanup26, label %for.cond29.preheader.us, !llvm.loop !15
for.cond29.preheader.lr.ph.split: ; preds = %for.cond29.preheader.lr.ph.thread, %for.cond29.preheader.lr.ph
%30 = phi i32 [ %10, %for.cond29.preheader.lr.ph.thread ], [ %16, %for.cond29.preheader.lr.ph ]
%.lcssa100106 = phi i32 [ %5, %for.cond29.preheader.lr.ph.thread ], [ %32, %for.cond29.preheader.lr.ph ]
%cmp43 = icmp sgt i32 %30, 0
%31 = select i1 %cmp43, i32 %.lcssa100106, i32 0
br label %for.cond.cleanup26
for.cond.cleanup10.loopexit: ; preds = %for.body11
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond.cleanup10
for.cond.cleanup10: ; preds = %for.cond.cleanup10.loopexit, %for.cond8.preheader
%32 = phi i32 [ %.pre, %for.cond.cleanup10.loopexit ], [ %13, %for.cond8.preheader ]
%33 = phi i32 [ %35, %for.cond.cleanup10.loopexit ], [ %14, %for.cond8.preheader ]
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%34 = sext i32 %32 to i64
%cmp5 = icmp slt i64 %indvars.iv.next88, %34
br i1 %cmp5, label %for.cond8.preheader, label %for.cond24.preheader, !llvm.loop !16
for.body11: ; preds = %for.body11.lr.ph, %for.body11
%indvars.iv84 = phi i64 [ 0, %for.body11.lr.ph ], [ %indvars.iv.next85, %for.body11 ]
%arrayidx15 = getelementptr inbounds i32, ptr %arrayidx13, i64 %indvars.iv84
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx15)
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%35 = load i32, ptr %m, align 4, !tbaa !5
%36 = sext i32 %35 to i64
%cmp9 = icmp slt i64 %indvars.iv.next85, %36
br i1 %cmp9, label %for.body11, label %for.cond.cleanup10.loopexit, !llvm.loop !18
for.cond.cleanup26: ; preds = %for.cond29.for.cond.cleanup31_crit_edge.us, %for.cond.cleanup, %for.cond29.preheader.lr.ph.split, %for.cond24.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond24.preheader ], [ %31, %for.cond29.preheader.lr.ph.split ], [ 0, %for.cond.cleanup ], [ %spec.select.us, %for.cond29.for.cond.cleanup31_crit_edge.us ]
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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 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.abs.i32(i32, i1 immarg) #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(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree 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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
!18 = distinct !{!18, !10}
|
#include <stdio.h>
int main() {
int i, j, n, m, c, count = 0;
int b[20], a[21][21];
scanf("%d %d %d", &n, &m, &c);
for (i = 0; i < m; i++) scanf("%d", &b[i]);
for (j = 0; j < n; j++) {
for (i = 0; i < m; i++) {
scanf("%d", &a[j][i]);
}
a[j][20] = 0;
}
for (j = 0; j < n; j++) {
for (i = 0; i < m; i++) {
a[j][20] = a[j][20] + b[i] * a[j][i];
}
a[j][20] += c;
if (a[j][20] > 0) count++;
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253869/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253869/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%c = alloca i32, align 4
%b = alloca [20 x i32], align 16
%a = alloca [21 x [21 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 1764, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %c)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %5, %for.body ]
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp380 = icmp sgt i32 %2, 0
br i1 %cmp380, label %for.cond5.preheader.lr.ph, label %for.end54
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%3 = icmp sgt i32 %1, 0
br i1 %3, label %for.cond5.preheader, label %for.cond5.preheader.lr.ph.split.us
for.cond5.preheader.lr.ph.split.us: ; preds = %for.cond5.preheader.lr.ph
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%4 = icmp ult i32 %2, 4
br i1 %4, label %for.cond22.preheader.loopexit135.unr-lcssa, label %for.cond5.preheader.lr.ph.split.us.new
for.cond5.preheader.lr.ph.split.us.new: ; preds = %for.cond5.preheader.lr.ph.split.us
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us, %for.cond5.preheader.lr.ph.split.us.new
%indvars.iv93 = phi i64 [ 0, %for.cond5.preheader.lr.ph.split.us.new ], [ %indvars.iv.next94.3, %for.cond5.preheader.us ]
%niter = phi i64 [ 0, %for.cond5.preheader.lr.ph.split.us.new ], [ %niter.next.3, %for.cond5.preheader.us ]
%arrayidx18.us = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv93, i64 20
store i32 0, ptr %arrayidx18.us, align 16, !tbaa !5
%indvars.iv.next94 = or i64 %indvars.iv93, 1
%arrayidx18.us.1 = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv.next94, i64 20
store i32 0, ptr %arrayidx18.us.1, align 4, !tbaa !5
%indvars.iv.next94.1 = or i64 %indvars.iv93, 2
%arrayidx18.us.2 = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv.next94.1, i64 20
store i32 0, ptr %arrayidx18.us.2, align 8, !tbaa !5
%indvars.iv.next94.2 = or i64 %indvars.iv93, 3
%arrayidx18.us.3 = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv.next94.2, i64 20
store i32 0, ptr %arrayidx18.us.3, align 4, !tbaa !5
%indvars.iv.next94.3 = add nuw nsw i64 %indvars.iv93, 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.cond22.preheader.loopexit135.unr-lcssa, label %for.cond5.preheader.us, !llvm.loop !9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %b, 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
%5 = load i32, ptr %m, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !11
for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.end15
%7 = phi i32 [ %22, %for.end15 ], [ %2, %for.cond5.preheader.lr.ph ]
%8 = phi i32 [ %23, %for.end15 ], [ %1, %for.cond5.preheader.lr.ph ]
%indvars.iv99 = phi i64 [ %indvars.iv.next100, %for.end15 ], [ 0, %for.cond5.preheader.lr.ph ]
%cmp678 = icmp sgt i32 %8, 0
br i1 %cmp678, label %for.body7, label %for.end15
for.cond22.preheader.loopexit135.unr-lcssa: ; preds = %for.cond5.preheader.us, %for.cond5.preheader.lr.ph.split.us
%indvars.iv93.unr = phi i64 [ 0, %for.cond5.preheader.lr.ph.split.us ], [ %indvars.iv.next94.3, %for.cond5.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond22.preheader, label %for.cond5.preheader.us.epil
for.cond5.preheader.us.epil: ; preds = %for.cond22.preheader.loopexit135.unr-lcssa, %for.cond5.preheader.us.epil
%indvars.iv93.epil = phi i64 [ %indvars.iv.next94.epil, %for.cond5.preheader.us.epil ], [ %indvars.iv93.unr, %for.cond22.preheader.loopexit135.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond5.preheader.us.epil ], [ 0, %for.cond22.preheader.loopexit135.unr-lcssa ]
%arrayidx18.us.epil = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv93.epil, i64 20
store i32 0, ptr %arrayidx18.us.epil, align 4, !tbaa !5
%indvars.iv.next94.epil = add nuw nsw i64 %indvars.iv93.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.cond22.preheader, label %for.cond5.preheader.us.epil, !llvm.loop !12
for.cond22.preheader: ; preds = %for.cond22.preheader.loopexit135.unr-lcssa, %for.cond5.preheader.us.epil, %for.end15
%9 = phi i32 [ %23, %for.end15 ], [ %1, %for.cond5.preheader.us.epil ], [ %1, %for.cond22.preheader.loopexit135.unr-lcssa ]
%.lcssa = phi i32 [ %22, %for.end15 ], [ %2, %for.cond5.preheader.us.epil ], [ %2, %for.cond22.preheader.loopexit135.unr-lcssa ]
%cmp2384 = icmp sgt i32 %.lcssa, 0
br i1 %cmp2384, label %for.cond25.preheader.lr.ph, label %for.end54
for.cond25.preheader.lr.ph: ; preds = %for.cond22.preheader
%cmp2682 = icmp sgt i32 %9, 0
%10 = load i32, ptr %c, align 4, !tbaa !5
%wide.trip.count115 = zext i32 %.lcssa to i64
br i1 %cmp2682, label %for.cond25.preheader.us.preheader, label %for.cond25.preheader.preheader
for.cond25.preheader.preheader: ; preds = %for.cond25.preheader.lr.ph
%xtraiter137 = and i64 %wide.trip.count115, 1
%11 = icmp eq i32 %.lcssa, 1
br i1 %11, label %for.end54.loopexit131.unr-lcssa, label %for.cond25.preheader.preheader.new
for.cond25.preheader.preheader.new: ; preds = %for.cond25.preheader.preheader
%unroll_iter141 = and i64 %wide.trip.count115, 4294967294
br label %for.cond25.preheader
for.cond25.preheader.us.preheader: ; preds = %for.cond25.preheader.lr.ph
%wide.trip.count110 = zext i32 %9 to i64
%xtraiter143 = and i64 %wide.trip.count110, 1
%12 = icmp eq i32 %9, 1
%unroll_iter147 = and i64 %wide.trip.count110, 4294967294
%lcmp.mod145.not = icmp eq i64 %xtraiter143, 0
br label %for.cond25.preheader.us
for.cond25.preheader.us: ; preds = %for.cond25.preheader.us.preheader, %for.cond25.for.end42_crit_edge.us
%indvars.iv112 = phi i64 [ 0, %for.cond25.preheader.us.preheader ], [ %indvars.iv.next113, %for.cond25.for.end42_crit_edge.us ]
%count.086.us = phi i32 [ 0, %for.cond25.preheader.us.preheader ], [ %spec.select.us, %for.cond25.for.end42_crit_edge.us ]
%arrayidx30.us = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv112, i64 20
%arrayidx30.promoted.us = load i32, ptr %arrayidx30.us, align 4, !tbaa !5
br i1 %12, label %for.cond25.for.end42_crit_edge.us.unr-lcssa, label %for.body27.us
for.body27.us: ; preds = %for.cond25.preheader.us, %for.body27.us
%indvars.iv107 = phi i64 [ %indvars.iv.next108.1, %for.body27.us ], [ 0, %for.cond25.preheader.us ]
%13 = phi i32 [ %add.us.1, %for.body27.us ], [ %arrayidx30.promoted.us, %for.cond25.preheader.us ]
%niter148 = phi i64 [ %niter148.next.1, %for.body27.us ], [ 0, %for.cond25.preheader.us ]
%arrayidx32.us = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv107
%14 = load i32, ptr %arrayidx32.us, align 8, !tbaa !5
%arrayidx36.us = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv112, i64 %indvars.iv107
%15 = load i32, ptr %arrayidx36.us, align 4, !tbaa !5
%mul.us = mul nsw i32 %15, %14
%add.us = add nsw i32 %mul.us, %13
store i32 %add.us, ptr %arrayidx30.us, align 4, !tbaa !5
%indvars.iv.next108 = or i64 %indvars.iv107, 1
%arrayidx32.us.1 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv.next108
%16 = load i32, ptr %arrayidx32.us.1, align 4, !tbaa !5
%arrayidx36.us.1 = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv112, i64 %indvars.iv.next108
%17 = load i32, ptr %arrayidx36.us.1, align 4, !tbaa !5
%mul.us.1 = mul nsw i32 %17, %16
%add.us.1 = add nsw i32 %mul.us.1, %add.us
store i32 %add.us.1, ptr %arrayidx30.us, align 4, !tbaa !5
%indvars.iv.next108.1 = add nuw nsw i64 %indvars.iv107, 2
%niter148.next.1 = add i64 %niter148, 2
%niter148.ncmp.1 = icmp eq i64 %niter148.next.1, %unroll_iter147
br i1 %niter148.ncmp.1, label %for.cond25.for.end42_crit_edge.us.unr-lcssa, label %for.body27.us, !llvm.loop !14
for.cond25.for.end42_crit_edge.us.unr-lcssa: ; preds = %for.body27.us, %for.cond25.preheader.us
%add.us.lcssa.ph = phi i32 [ undef, %for.cond25.preheader.us ], [ %add.us.1, %for.body27.us ]
%indvars.iv107.unr = phi i64 [ 0, %for.cond25.preheader.us ], [ %indvars.iv.next108.1, %for.body27.us ]
%.unr = phi i32 [ %arrayidx30.promoted.us, %for.cond25.preheader.us ], [ %add.us.1, %for.body27.us ]
br i1 %lcmp.mod145.not, label %for.cond25.for.end42_crit_edge.us, label %for.body27.us.epil
for.body27.us.epil: ; preds = %for.cond25.for.end42_crit_edge.us.unr-lcssa
%arrayidx32.us.epil = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv107.unr
%18 = load i32, ptr %arrayidx32.us.epil, align 4, !tbaa !5
%arrayidx36.us.epil = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv112, i64 %indvars.iv107.unr
%19 = load i32, ptr %arrayidx36.us.epil, align 4, !tbaa !5
%mul.us.epil = mul nsw i32 %19, %18
%add.us.epil = add nsw i32 %mul.us.epil, %.unr
store i32 %add.us.epil, ptr %arrayidx30.us, align 4, !tbaa !5
br label %for.cond25.for.end42_crit_edge.us
for.cond25.for.end42_crit_edge.us: ; preds = %for.cond25.for.end42_crit_edge.us.unr-lcssa, %for.body27.us.epil
%add.us.lcssa = phi i32 [ %add.us.lcssa.ph, %for.cond25.for.end42_crit_edge.us.unr-lcssa ], [ %add.us.epil, %for.body27.us.epil ]
%add46.us = add nsw i32 %add.us.lcssa, %10
store i32 %add46.us, ptr %arrayidx30.us, align 4, !tbaa !5
%cmp50.us = icmp sgt i32 %add46.us, 0
%inc51.us = zext i1 %cmp50.us to i32
%spec.select.us = add nuw nsw i32 %count.086.us, %inc51.us
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%exitcond116.not = icmp eq i64 %indvars.iv.next113, %wide.trip.count115
br i1 %exitcond116.not, label %for.end54, label %for.cond25.preheader.us, !llvm.loop !15
for.body7: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv96 = phi i64 [ %indvars.iv.next97, %for.body7 ], [ 0, %for.cond5.preheader ]
%arrayidx11 = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv99, i64 %indvars.iv96
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11)
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%20 = load i32, ptr %m, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp6 = icmp slt i64 %indvars.iv.next97, %21
br i1 %cmp6, label %for.body7, label %for.end15.loopexit, !llvm.loop !16
for.end15.loopexit: ; preds = %for.body7
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.end15
for.end15: ; preds = %for.end15.loopexit, %for.cond5.preheader
%22 = phi i32 [ %.pre, %for.end15.loopexit ], [ %7, %for.cond5.preheader ]
%23 = phi i32 [ %20, %for.end15.loopexit ], [ %8, %for.cond5.preheader ]
%arrayidx18 = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv99, i64 20
store i32 0, ptr %arrayidx18, align 4, !tbaa !5
%indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
%24 = sext i32 %22 to i64
%cmp3 = icmp slt i64 %indvars.iv.next100, %24
br i1 %cmp3, label %for.cond5.preheader, label %for.cond22.preheader, !llvm.loop !17
for.cond25.preheader: ; preds = %for.cond25.preheader, %for.cond25.preheader.preheader.new
%indvars.iv102 = phi i64 [ 0, %for.cond25.preheader.preheader.new ], [ %indvars.iv.next103.1, %for.cond25.preheader ]
%count.086 = phi i32 [ 0, %for.cond25.preheader.preheader.new ], [ %spec.select.1, %for.cond25.preheader ]
%niter142 = phi i64 [ 0, %for.cond25.preheader.preheader.new ], [ %niter142.next.1, %for.cond25.preheader ]
%arrayidx45 = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv102, i64 20
%25 = load i32, ptr %arrayidx45, align 8, !tbaa !5
%add46 = add nsw i32 %25, %10
store i32 %add46, ptr %arrayidx45, align 8, !tbaa !5
%cmp50 = icmp sgt i32 %add46, 0
%inc51 = zext i1 %cmp50 to i32
%spec.select = add nuw nsw i32 %count.086, %inc51
%indvars.iv.next103 = or i64 %indvars.iv102, 1
%arrayidx45.1 = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv.next103, i64 20
%26 = load i32, ptr %arrayidx45.1, align 4, !tbaa !5
%add46.1 = add nsw i32 %26, %10
store i32 %add46.1, ptr %arrayidx45.1, align 4, !tbaa !5
%cmp50.1 = icmp sgt i32 %add46.1, 0
%inc51.1 = zext i1 %cmp50.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc51.1
%indvars.iv.next103.1 = add nuw nsw i64 %indvars.iv102, 2
%niter142.next.1 = add i64 %niter142, 2
%niter142.ncmp.1 = icmp eq i64 %niter142.next.1, %unroll_iter141
br i1 %niter142.ncmp.1, label %for.end54.loopexit131.unr-lcssa, label %for.cond25.preheader, !llvm.loop !15
for.end54.loopexit131.unr-lcssa: ; preds = %for.cond25.preheader, %for.cond25.preheader.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.cond25.preheader.preheader ], [ %spec.select.1, %for.cond25.preheader ]
%indvars.iv102.unr = phi i64 [ 0, %for.cond25.preheader.preheader ], [ %indvars.iv.next103.1, %for.cond25.preheader ]
%count.086.unr = phi i32 [ 0, %for.cond25.preheader.preheader ], [ %spec.select.1, %for.cond25.preheader ]
%lcmp.mod139.not = icmp eq i64 %xtraiter137, 0
br i1 %lcmp.mod139.not, label %for.end54, label %for.cond25.preheader.epil
for.cond25.preheader.epil: ; preds = %for.end54.loopexit131.unr-lcssa
%arrayidx45.epil = getelementptr inbounds [21 x [21 x i32]], ptr %a, i64 0, i64 %indvars.iv102.unr, i64 20
%27 = load i32, ptr %arrayidx45.epil, align 4, !tbaa !5
%add46.epil = add nsw i32 %27, %10
store i32 %add46.epil, ptr %arrayidx45.epil, align 4, !tbaa !5
%cmp50.epil = icmp sgt i32 %add46.epil, 0
%inc51.epil = zext i1 %cmp50.epil to i32
%spec.select.epil = add nuw nsw i32 %count.086.unr, %inc51.epil
br label %for.end54
for.end54: ; preds = %for.cond25.preheader.epil, %for.end54.loopexit131.unr-lcssa, %for.cond25.for.end42_crit_edge.us, %for.cond2.preheader, %for.cond22.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ 0, %for.cond2.preheader ], [ %spec.select.us, %for.cond25.for.end42_crit_edge.us ], [ %spec.select.lcssa.ph, %for.end54.loopexit131.unr-lcssa ], [ %spec.select.epil, %for.cond25.preheader.epil ]
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1764, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include <stdio.h>
int main(void)
{
int N, M, i, A[10000][20], B[10000], C, j, s, count;
scanf("%d%d%d",&N,&M,&C);
for(i=0;i<M;i++) scanf("%d",&B[i]);
for(i=0;i<N;i++)
for(j=0;j<M;j++) scanf("%d",&A[i][j]);
count=0;
for(i=0;i<N;i++){
s=0;
for(j=0;j<M;j++) s = s + A[i][j] * B[j];
if((s + C) > 0) count++;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253911/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253911/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%A = alloca [10000 x [20 x i32]], align 16
%B = alloca [10000 x i32], align 16
%C = 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 %M) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 40000, 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 %N, ptr noundef nonnull %M, ptr noundef nonnull %C)
%0 = load i32, ptr %M, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %5, %for.body ]
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp361 = icmp sgt i32 %2, 0
br i1 %cmp361, label %for.cond5.preheader.lr.ph, label %for.end39
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%3 = icmp sgt i32 %1, 0
br i1 %3, label %for.cond5.preheader, label %for.cond22.preheader.lr.ph.thread
for.cond22.preheader.lr.ph.thread: ; preds = %for.cond5.preheader.lr.ph
%4 = load i32, ptr %C, align 4, !tbaa !5
br label %for.cond22.preheader.lr.ph.split
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %B, 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
%5 = load i32, ptr %M, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc16
%7 = phi i32 [ %26, %for.inc16 ], [ %2, %for.cond5.preheader.lr.ph ]
%8 = phi i32 [ %27, %for.inc16 ], [ %1, %for.cond5.preheader.lr.ph ]
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.inc16 ], [ 0, %for.cond5.preheader.lr.ph ]
%cmp659 = icmp sgt i32 %8, 0
br i1 %cmp659, label %for.body7, label %for.inc16
for.cond19.preheader: ; preds = %for.inc16
%cmp2067 = icmp sgt i32 %26, 0
br i1 %cmp2067, label %for.cond22.preheader.lr.ph, label %for.end39
for.cond22.preheader.lr.ph: ; preds = %for.cond19.preheader
%cmp2363 = icmp sgt i32 %27, 0
%9 = load i32, ptr %C, align 4, !tbaa !5
br i1 %cmp2363, label %for.cond22.preheader.us.preheader, label %for.cond22.preheader.lr.ph.split
for.cond22.preheader.us.preheader: ; preds = %for.cond22.preheader.lr.ph
%wide.trip.count88 = zext i32 %26 to i64
%wide.trip.count = zext i32 %27 to i64
%min.iters.check = icmp ult i32 %27, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond22.preheader.us
for.cond22.preheader.us: ; preds = %for.cond22.preheader.us.preheader, %for.cond22.for.end33_crit_edge.us
%indvars.iv85 = phi i64 [ 0, %for.cond22.preheader.us.preheader ], [ %indvars.iv.next86, %for.cond22.for.end33_crit_edge.us ]
%count.069.us = phi i32 [ 0, %for.cond22.preheader.us.preheader ], [ %spec.select.us, %for.cond22.for.end33_crit_edge.us ]
br i1 %min.iters.check, label %for.body24.us.preheader, label %vector.body
vector.body: ; preds = %for.cond22.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond22.preheader.us ]
%vec.phi = phi <4 x i32> [ %16, %vector.body ], [ zeroinitializer, %for.cond22.preheader.us ]
%vec.phi105 = phi <4 x i32> [ %17, %vector.body ], [ zeroinitializer, %for.cond22.preheader.us ]
%10 = getelementptr inbounds [10000 x [20 x i32]], ptr %A, i64 0, i64 %indvars.iv85, i64 %index
%wide.load = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load106 = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds [10000 x i32], ptr %B, i64 0, i64 %index
%wide.load107 = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load108 = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = mul nsw <4 x i32> %wide.load107, %wide.load
%15 = mul nsw <4 x i32> %wide.load108, %wide.load106
%16 = add <4 x i32> %14, %vec.phi
%17 = add <4 x i32> %15, %vec.phi105
%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)
br i1 %cmp.n, label %for.cond22.for.end33_crit_edge.us, label %for.body24.us.preheader
for.body24.us.preheader: ; preds = %for.cond22.preheader.us, %middle.block
%indvars.iv82.ph = phi i64 [ 0, %for.cond22.preheader.us ], [ %n.vec, %middle.block ]
%s.065.us.ph = phi i32 [ 0, %for.cond22.preheader.us ], [ %19, %middle.block ]
br label %for.body24.us
for.body24.us: ; preds = %for.body24.us.preheader, %for.body24.us
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.body24.us ], [ %indvars.iv82.ph, %for.body24.us.preheader ]
%s.065.us = phi i32 [ %add.us, %for.body24.us ], [ %s.065.us.ph, %for.body24.us.preheader ]
%arrayidx28.us = getelementptr inbounds [10000 x [20 x i32]], ptr %A, i64 0, i64 %indvars.iv85, i64 %indvars.iv82
%20 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%arrayidx30.us = getelementptr inbounds [10000 x i32], ptr %B, i64 0, i64 %indvars.iv82
%21 = load i32, ptr %arrayidx30.us, align 4, !tbaa !5
%mul.us = mul nsw i32 %21, %20
%add.us = add nsw i32 %mul.us, %s.065.us
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%exitcond.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.for.end33_crit_edge.us, label %for.body24.us, !llvm.loop !14
for.cond22.for.end33_crit_edge.us: ; preds = %for.body24.us, %middle.block
%add.us.lcssa = phi i32 [ %19, %middle.block ], [ %add.us, %for.body24.us ]
%add34.us = add nsw i32 %9, %add.us.lcssa
%cmp35.us = icmp sgt i32 %add34.us, 0
%inc36.us = zext i1 %cmp35.us to i32
%spec.select.us = add nuw nsw i32 %count.069.us, %inc36.us
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%exitcond89.not = icmp eq i64 %indvars.iv.next86, %wide.trip.count88
br i1 %exitcond89.not, label %for.end39, label %for.cond22.preheader.us, !llvm.loop !15
for.cond22.preheader.lr.ph.split: ; preds = %for.cond22.preheader.lr.ph.thread, %for.cond22.preheader.lr.ph
%22 = phi i32 [ %4, %for.cond22.preheader.lr.ph.thread ], [ %9, %for.cond22.preheader.lr.ph ]
%.lcssa9298 = phi i32 [ %2, %for.cond22.preheader.lr.ph.thread ], [ %26, %for.cond22.preheader.lr.ph ]
%cmp35 = icmp sgt i32 %22, 0
%23 = select i1 %cmp35, i32 %.lcssa9298, i32 0
br label %for.end39
for.body7: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body7 ], [ 0, %for.cond5.preheader ]
%arrayidx11 = getelementptr inbounds [10000 x [20 x i32]], ptr %A, i64 0, i64 %indvars.iv79, i64 %indvars.iv76
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11)
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%24 = load i32, ptr %M, align 4, !tbaa !5
%25 = sext i32 %24 to i64
%cmp6 = icmp slt i64 %indvars.iv.next77, %25
br i1 %cmp6, label %for.body7, label %for.inc16.loopexit, !llvm.loop !16
for.inc16.loopexit: ; preds = %for.body7
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc16
for.inc16: ; preds = %for.inc16.loopexit, %for.cond5.preheader
%26 = phi i32 [ %.pre, %for.inc16.loopexit ], [ %7, %for.cond5.preheader ]
%27 = phi i32 [ %24, %for.inc16.loopexit ], [ %8, %for.cond5.preheader ]
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%28 = sext i32 %26 to i64
%cmp3 = icmp slt i64 %indvars.iv.next80, %28
br i1 %cmp3, label %for.cond5.preheader, label %for.cond19.preheader, !llvm.loop !17
for.end39: ; preds = %for.cond22.for.end33_crit_edge.us, %for.cond2.preheader, %for.cond22.preheader.lr.ph.split, %for.cond19.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond19.preheader ], [ %23, %for.cond22.preheader.lr.ph.split ], [ 0, %for.cond2.preheader ], [ %spec.select.us, %for.cond22.for.end33_crit_edge.us ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
int main(void){
int i,j,n,m,c,sum,ans=0;
scanf("%d %d %d",&n,&m,&c);
int b[m];
int a[n][m];
for(i=0;i<m;i++) scanf("%d",&b[i]);
for(i=0;i<n;i++){
sum=0;
for(j=0;j<m;j++){
scanf("%d",&a[i][j]);
sum+=a[i][j]*b[j];
}
if(sum+c>0) ans++;
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253955/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253955/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%c = 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 %m) #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 %n, ptr noundef nonnull %m, ptr noundef nonnull %c)
%0 = load i32, ptr %m, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%5 = load i32, ptr %m, align 4, !tbaa !5
%6 = zext i32 %5 to i64
%7 = mul nuw i64 %6, %4
%vla1 = alloca i32, i64 %7, align 16
%cmp42 = icmp sgt i32 %5, 0
br i1 %cmp42, label %for.body, label %for.cond3.preheader
for.cond3.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond3.preheader.loopexit, %entry
%8 = phi i32 [ %13, %for.cond3.preheader.loopexit ], [ %5, %entry ]
%9 = phi i32 [ %.pre, %for.cond3.preheader.loopexit ], [ %3, %entry ]
%cmp447 = icmp sgt i32 %9, 0
br i1 %cmp447, label %for.cond6.preheader.lr.ph, label %for.end28
for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader
%10 = icmp sgt i32 %8, 0
br i1 %10, label %for.cond6.preheader, label %for.cond6.preheader.lr.ph.split.us
for.cond6.preheader.lr.ph.split.us: ; preds = %for.cond6.preheader.lr.ph
%11 = load i32, ptr %c, align 4, !tbaa !5
%cmp24.us = icmp sgt i32 %11, 0
%12 = select i1 %cmp24.us, i32 %9, i32 0
br label %for.end28
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.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%13 = load i32, ptr %m, 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.cond3.preheader.loopexit, !llvm.loop !9
for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %for.end22
%15 = phi i32 [ %22, %for.end22 ], [ %9, %for.cond6.preheader.lr.ph ]
%16 = phi i32 [ %23, %for.end22 ], [ %8, %for.cond6.preheader.lr.ph ]
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.end22 ], [ 0, %for.cond6.preheader.lr.ph ]
%ans.048 = phi i32 [ %spec.select, %for.end22 ], [ 0, %for.cond6.preheader.lr.ph ]
%cmp744 = icmp sgt i32 %16, 0
br i1 %cmp744, label %for.body8.lr.ph, label %for.end22
for.body8.lr.ph: ; preds = %for.cond6.preheader
%17 = mul nuw nsw i64 %indvars.iv56, %6
%arrayidx10 = getelementptr inbounds i32, ptr %vla1, i64 %17
br label %for.body8
for.body8: ; preds = %for.body8.lr.ph, %for.body8
%indvars.iv53 = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next54, %for.body8 ]
%sum.045 = phi i32 [ 0, %for.body8.lr.ph ], [ %add, %for.body8 ]
%arrayidx12 = getelementptr inbounds i32, ptr %arrayidx10, i64 %indvars.iv53
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx12)
%18 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv53
%19 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%mul = mul nsw i32 %19, %18
%add = add nsw i32 %mul, %sum.045
%indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
%20 = load i32, ptr %m, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp7 = icmp slt i64 %indvars.iv.next54, %21
br i1 %cmp7, label %for.body8, label %for.end22.loopexit, !llvm.loop !11
for.end22.loopexit: ; preds = %for.body8
%.pre59 = load i32, ptr %n, align 4, !tbaa !5
br label %for.end22
for.end22: ; preds = %for.end22.loopexit, %for.cond6.preheader
%22 = phi i32 [ %15, %for.cond6.preheader ], [ %.pre59, %for.end22.loopexit ]
%23 = phi i32 [ %16, %for.cond6.preheader ], [ %20, %for.end22.loopexit ]
%sum.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ %add, %for.end22.loopexit ]
%24 = load i32, ptr %c, align 4, !tbaa !5
%add23 = add nsw i32 %24, %sum.0.lcssa
%cmp24 = icmp sgt i32 %add23, 0
%inc25 = zext i1 %cmp24 to i32
%spec.select = add nuw nsw i32 %ans.048, %inc25
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%25 = sext i32 %22 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %25
br i1 %cmp4, label %for.cond6.preheader, label %for.end28, !llvm.loop !12
for.end28: ; preds = %for.end22, %for.cond6.preheader.lr.ph.split.us, %for.cond3.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ %12, %for.cond6.preheader.lr.ph.split.us ], [ %spec.select, %for.end22 ]
%call29 = 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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include <stdio.h>
#define N_MAX 20
#define M_MAX 20
int main(){
int N, M;
int A[N_MAX][M_MAX] = {0};
int B[M_MAX] = {0};
int C;
int i, j, k;
int sum = 0;
int cnt = 0;
// 入力
scanf("%d %d %d", &N, &M, &C);
//printf("%d %d %d\n", N, M, C);
for(i=0 ; i<M ; i++){
scanf("%d", &B[i]);
//printf("%d ", B[i]);
}
//printf("\n");
for(i=0 ; i<N ; i++){
for(j=0 ; j<M ; j++){
scanf("%d", &A[i][j]);
//printf("%d ", A[i][j]);
}
//printf("\n");
}
for(i=0 ; i<N ; i++){
sum = 0;
for(j=0 ; j<M ; j++){
sum += (A[i][j]*B[j]);
}
sum += C;
if(sum > 0){
cnt++;
}
}
printf("%d", cnt);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254004/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254004/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%A = alloca [20 x [20 x i32]], align 16
%B = alloca [20 x i32], align 16
%C = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %A) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600) %A, i8 0, i64 1600, i1 false)
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %B) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) %B, i8 0, i64 80, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M, ptr noundef nonnull %C)
%0 = load i32, ptr %M, align 4, !tbaa !5
%cmp58 = icmp sgt i32 %0, 0
br i1 %cmp58, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %5, %for.body ]
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp362 = icmp sgt i32 %2, 0
br i1 %cmp362, label %for.cond5.preheader.lr.ph, label %for.end39
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%3 = icmp sgt i32 %1, 0
br i1 %3, label %for.cond5.preheader, label %for.cond22.preheader.lr.ph.thread
for.cond22.preheader.lr.ph.thread: ; preds = %for.cond5.preheader.lr.ph
%4 = load i32, ptr %C, align 4, !tbaa !5
br label %for.cond22.preheader.lr.ph.split
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %B, 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
%5 = load i32, ptr %M, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc16
%7 = phi i32 [ %26, %for.inc16 ], [ %2, %for.cond5.preheader.lr.ph ]
%8 = phi i32 [ %27, %for.inc16 ], [ %1, %for.cond5.preheader.lr.ph ]
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.inc16 ], [ 0, %for.cond5.preheader.lr.ph ]
%cmp660 = icmp sgt i32 %8, 0
br i1 %cmp660, label %for.body7, label %for.inc16
for.cond19.preheader: ; preds = %for.inc16
%cmp2068 = icmp sgt i32 %26, 0
br i1 %cmp2068, label %for.cond22.preheader.lr.ph, label %for.end39
for.cond22.preheader.lr.ph: ; preds = %for.cond19.preheader
%cmp2364 = icmp sgt i32 %27, 0
%9 = load i32, ptr %C, align 4, !tbaa !5
br i1 %cmp2364, label %for.cond22.preheader.us.preheader, label %for.cond22.preheader.lr.ph.split
for.cond22.preheader.us.preheader: ; preds = %for.cond22.preheader.lr.ph
%wide.trip.count89 = zext i32 %26 to i64
%wide.trip.count = zext i32 %27 to i64
%min.iters.check = icmp ult i32 %27, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond22.preheader.us
for.cond22.preheader.us: ; preds = %for.cond22.preheader.us.preheader, %for.cond22.for.end33_crit_edge.us
%indvars.iv86 = phi i64 [ 0, %for.cond22.preheader.us.preheader ], [ %indvars.iv.next87, %for.cond22.for.end33_crit_edge.us ]
%cnt.070.us = phi i32 [ 0, %for.cond22.preheader.us.preheader ], [ %spec.select.us, %for.cond22.for.end33_crit_edge.us ]
br i1 %min.iters.check, label %for.body24.us.preheader, label %vector.body
vector.body: ; preds = %for.cond22.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond22.preheader.us ]
%vec.phi = phi <4 x i32> [ %16, %vector.body ], [ zeroinitializer, %for.cond22.preheader.us ]
%vec.phi106 = phi <4 x i32> [ %17, %vector.body ], [ zeroinitializer, %for.cond22.preheader.us ]
%10 = getelementptr inbounds [20 x [20 x i32]], ptr %A, i64 0, i64 %indvars.iv86, i64 %index
%wide.load = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load107 = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds [20 x i32], ptr %B, i64 0, i64 %index
%wide.load108 = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load109 = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = mul nsw <4 x i32> %wide.load108, %wide.load
%15 = mul nsw <4 x i32> %wide.load109, %wide.load107
%16 = add <4 x i32> %14, %vec.phi
%17 = add <4 x i32> %15, %vec.phi106
%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)
br i1 %cmp.n, label %for.cond22.for.end33_crit_edge.us, label %for.body24.us.preheader
for.body24.us.preheader: ; preds = %for.cond22.preheader.us, %middle.block
%indvars.iv83.ph = phi i64 [ 0, %for.cond22.preheader.us ], [ %n.vec, %middle.block ]
%sum.066.us.ph = phi i32 [ 0, %for.cond22.preheader.us ], [ %19, %middle.block ]
br label %for.body24.us
for.body24.us: ; preds = %for.body24.us.preheader, %for.body24.us
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body24.us ], [ %indvars.iv83.ph, %for.body24.us.preheader ]
%sum.066.us = phi i32 [ %add.us, %for.body24.us ], [ %sum.066.us.ph, %for.body24.us.preheader ]
%arrayidx28.us = getelementptr inbounds [20 x [20 x i32]], ptr %A, i64 0, i64 %indvars.iv86, i64 %indvars.iv83
%20 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%arrayidx30.us = getelementptr inbounds [20 x i32], ptr %B, i64 0, i64 %indvars.iv83
%21 = load i32, ptr %arrayidx30.us, align 4, !tbaa !5
%mul.us = mul nsw i32 %21, %20
%add.us = add nsw i32 %mul.us, %sum.066.us
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%exitcond.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.for.end33_crit_edge.us, label %for.body24.us, !llvm.loop !14
for.cond22.for.end33_crit_edge.us: ; preds = %for.body24.us, %middle.block
%add.us.lcssa = phi i32 [ %19, %middle.block ], [ %add.us, %for.body24.us ]
%add34.us = add nsw i32 %9, %add.us.lcssa
%cmp35.us = icmp sgt i32 %add34.us, 0
%inc36.us = zext i1 %cmp35.us to i32
%spec.select.us = add nuw nsw i32 %cnt.070.us, %inc36.us
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%exitcond90.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count89
br i1 %exitcond90.not, label %for.end39, label %for.cond22.preheader.us, !llvm.loop !15
for.cond22.preheader.lr.ph.split: ; preds = %for.cond22.preheader.lr.ph.thread, %for.cond22.preheader.lr.ph
%22 = phi i32 [ %4, %for.cond22.preheader.lr.ph.thread ], [ %9, %for.cond22.preheader.lr.ph ]
%.lcssa9399 = phi i32 [ %2, %for.cond22.preheader.lr.ph.thread ], [ %26, %for.cond22.preheader.lr.ph ]
%cmp35 = icmp sgt i32 %22, 0
%23 = select i1 %cmp35, i32 %.lcssa9399, i32 0
br label %for.end39
for.body7: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body7 ], [ 0, %for.cond5.preheader ]
%arrayidx11 = getelementptr inbounds [20 x [20 x i32]], ptr %A, i64 0, i64 %indvars.iv80, i64 %indvars.iv77
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11)
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%24 = load i32, ptr %M, align 4, !tbaa !5
%25 = sext i32 %24 to i64
%cmp6 = icmp slt i64 %indvars.iv.next78, %25
br i1 %cmp6, label %for.body7, label %for.inc16.loopexit, !llvm.loop !16
for.inc16.loopexit: ; preds = %for.body7
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc16
for.inc16: ; preds = %for.inc16.loopexit, %for.cond5.preheader
%26 = phi i32 [ %.pre, %for.inc16.loopexit ], [ %7, %for.cond5.preheader ]
%27 = phi i32 [ %24, %for.inc16.loopexit ], [ %8, %for.cond5.preheader ]
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%28 = sext i32 %26 to i64
%cmp3 = icmp slt i64 %indvars.iv.next81, %28
br i1 %cmp3, label %for.cond5.preheader, label %for.cond19.preheader, !llvm.loop !17
for.end39: ; preds = %for.cond22.for.end33_crit_edge.us, %for.cond2.preheader, %for.cond22.preheader.lr.ph.split, %for.cond19.preheader
%cnt.0.lcssa = phi i32 [ 0, %for.cond19.preheader ], [ %23, %for.cond22.preheader.lr.ph.split ], [ 0, %for.cond2.preheader ], [ %spec.select.us, %for.cond22.for.end33_crit_edge.us ]
%call40 = 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 %C) #5
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
#include<stdlib.h>
int main(void) {
int n, m, c, i, j, ans, count=0;
int *b;
int **a;
scanf("%d", &n); scanf("%d", &m); scanf("%d", &c);
b = (int*)malloc(m*sizeof(int));
a = (int**)malloc(n*sizeof(int*));
for(i=0; i<n; i++) {
a[i] = (int*)malloc(m*sizeof(int));
}
for(i=0; i<m; i++) {
scanf("%d", &b[i]);
}
for(i=0; i<n; i++) {
for(j=0; j<m; j++) {
scanf("%d", &a[i][j]);
}
}
for(i=0; i<n; i++) {
ans = 0;
for(j=0; j<m; j++) {
ans += a[i][j] * b[j];
}
if(ans + c > 0) {
count++;
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254048/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254048/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%m = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i32, ptr %m, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call3 = call noalias ptr @malloc(i64 noundef %mul) #6
%1 = load i32, ptr %n, align 4, !tbaa !5
%conv4 = sext i32 %1 to i64
%mul5 = shl nsw i64 %conv4, 3
%call6 = call noalias ptr @malloc(i64 noundef %mul5) #6
%cmp88 = icmp sgt i32 %1, 0
br i1 %cmp88, label %for.body.preheader, label %for.cond11.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %1 to i64
br label %for.body
for.cond11.preheader: ; preds = %for.body, %entry
%cmp1290 = icmp sgt i32 %0, 0
br i1 %cmp1290, label %for.body14, label %for.cond21.preheader
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call10 = call noalias ptr @malloc(i64 noundef %mul) #6
%arrayidx = getelementptr inbounds ptr, ptr %call6, i64 %indvars.iv
store ptr %call10, ptr %arrayidx, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond11.preheader, label %for.body, !llvm.loop !11
for.cond21.preheader.loopexit: ; preds = %for.body14
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.cond21.preheader.loopexit, %for.cond11.preheader
%2 = phi i32 [ %6, %for.cond21.preheader.loopexit ], [ %0, %for.cond11.preheader ]
%3 = phi i32 [ %.pre, %for.cond21.preheader.loopexit ], [ %1, %for.cond11.preheader ]
%cmp2294 = icmp sgt i32 %3, 0
br i1 %cmp2294, label %for.cond25.preheader.lr.ph, label %for.end64
for.cond25.preheader.lr.ph: ; preds = %for.cond21.preheader
%4 = icmp sgt i32 %2, 0
br i1 %4, label %for.cond25.preheader, label %for.cond44.preheader.lr.ph.thread
for.cond44.preheader.lr.ph.thread: ; preds = %for.cond25.preheader.lr.ph
%5 = load i32, ptr %c, align 4, !tbaa !5
br label %for.cond44.preheader.lr.ph.split
for.body14: ; preds = %for.cond11.preheader, %for.body14
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.body14 ], [ 0, %for.cond11.preheader ]
%arrayidx16 = getelementptr inbounds i32, ptr %call3, i64 %indvars.iv109
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx16)
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp12 = icmp slt i64 %indvars.iv.next110, %7
br i1 %cmp12, label %for.body14, label %for.cond21.preheader.loopexit, !llvm.loop !13
for.cond25.preheader: ; preds = %for.cond25.preheader.lr.ph, %for.inc37
%8 = phi i32 [ %29, %for.inc37 ], [ %3, %for.cond25.preheader.lr.ph ]
%9 = phi i32 [ %30, %for.inc37 ], [ %2, %for.cond25.preheader.lr.ph ]
%indvars.iv115 = phi i64 [ %indvars.iv.next116, %for.inc37 ], [ 0, %for.cond25.preheader.lr.ph ]
%cmp2692 = icmp sgt i32 %9, 0
br i1 %cmp2692, label %for.body28.lr.ph, label %for.inc37
for.body28.lr.ph: ; preds = %for.cond25.preheader
%arrayidx30 = getelementptr inbounds ptr, ptr %call6, i64 %indvars.iv115
%10 = load ptr, ptr %arrayidx30, align 8, !tbaa !9
br label %for.body28
for.cond40.preheader: ; preds = %for.inc37
%cmp41100 = icmp sgt i32 %29, 0
br i1 %cmp41100, label %for.cond44.preheader.lr.ph, label %for.end64
for.cond44.preheader.lr.ph: ; preds = %for.cond40.preheader
%cmp4596 = icmp sgt i32 %30, 0
%11 = load i32, ptr %c, align 4, !tbaa !5
br i1 %cmp4596, label %for.cond44.preheader.us.preheader, label %for.cond44.preheader.lr.ph.split
for.cond44.preheader.us.preheader: ; preds = %for.cond44.preheader.lr.ph
%wide.trip.count126 = zext i32 %29 to i64
%wide.trip.count121 = zext i32 %30 to i64
%min.iters.check = icmp ult i32 %30, 8
%n.vec = and i64 %wide.trip.count121, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count121
br label %for.cond44.preheader.us
for.cond44.preheader.us: ; preds = %for.cond44.preheader.us.preheader, %for.cond44.for.end57_crit_edge.us
%indvars.iv123 = phi i64 [ 0, %for.cond44.preheader.us.preheader ], [ %indvars.iv.next124, %for.cond44.for.end57_crit_edge.us ]
%count.0101.us = phi i32 [ 0, %for.cond44.preheader.us.preheader ], [ %spec.select.us, %for.cond44.for.end57_crit_edge.us ]
%arrayidx49.us = getelementptr inbounds ptr, ptr %call6, i64 %indvars.iv123
%12 = load ptr, ptr %arrayidx49.us, align 8, !tbaa !9
br i1 %min.iters.check, label %for.body47.us.preheader, label %vector.body
vector.body: ; preds = %for.cond44.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond44.preheader.us ]
%vec.phi = phi <4 x i32> [ %19, %vector.body ], [ zeroinitializer, %for.cond44.preheader.us ]
%vec.phi144 = phi <4 x i32> [ %20, %vector.body ], [ zeroinitializer, %for.cond44.preheader.us ]
%13 = getelementptr inbounds i32, ptr %12, i64 %index
%wide.load = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load145 = load <4 x i32>, ptr %14, align 4, !tbaa !5
%15 = getelementptr inbounds i32, ptr %call3, i64 %index
%wide.load146 = load <4 x i32>, ptr %15, align 4, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load147 = load <4 x i32>, ptr %16, align 4, !tbaa !5
%17 = mul nsw <4 x i32> %wide.load146, %wide.load
%18 = mul nsw <4 x i32> %wide.load147, %wide.load145
%19 = add <4 x i32> %17, %vec.phi
%20 = add <4 x i32> %18, %vec.phi144
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %20, %19
%22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond44.for.end57_crit_edge.us, label %for.body47.us.preheader
for.body47.us.preheader: ; preds = %for.cond44.preheader.us, %middle.block
%indvars.iv118.ph = phi i64 [ 0, %for.cond44.preheader.us ], [ %n.vec, %middle.block ]
%ans.097.us.ph = phi i32 [ 0, %for.cond44.preheader.us ], [ %22, %middle.block ]
br label %for.body47.us
for.body47.us: ; preds = %for.body47.us.preheader, %for.body47.us
%indvars.iv118 = phi i64 [ %indvars.iv.next119, %for.body47.us ], [ %indvars.iv118.ph, %for.body47.us.preheader ]
%ans.097.us = phi i32 [ %add.us, %for.body47.us ], [ %ans.097.us.ph, %for.body47.us.preheader ]
%arrayidx51.us = getelementptr inbounds i32, ptr %12, i64 %indvars.iv118
%23 = load i32, ptr %arrayidx51.us, align 4, !tbaa !5
%arrayidx53.us = getelementptr inbounds i32, ptr %call3, i64 %indvars.iv118
%24 = load i32, ptr %arrayidx53.us, align 4, !tbaa !5
%mul54.us = mul nsw i32 %24, %23
%add.us = add nsw i32 %mul54.us, %ans.097.us
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%exitcond122.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count121
br i1 %exitcond122.not, label %for.cond44.for.end57_crit_edge.us, label %for.body47.us, !llvm.loop !17
for.cond44.for.end57_crit_edge.us: ; preds = %for.body47.us, %middle.block
%add.us.lcssa = phi i32 [ %22, %middle.block ], [ %add.us, %for.body47.us ]
%add58.us = add nsw i32 %11, %add.us.lcssa
%cmp59.us = icmp sgt i32 %add58.us, 0
%inc61.us = zext i1 %cmp59.us to i32
%spec.select.us = add nuw nsw i32 %count.0101.us, %inc61.us
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%exitcond127.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count126
br i1 %exitcond127.not, label %for.end64, label %for.cond44.preheader.us, !llvm.loop !18
for.cond44.preheader.lr.ph.split: ; preds = %for.cond44.preheader.lr.ph.thread, %for.cond44.preheader.lr.ph
%25 = phi i32 [ %5, %for.cond44.preheader.lr.ph.thread ], [ %11, %for.cond44.preheader.lr.ph ]
%.lcssa131137 = phi i32 [ %3, %for.cond44.preheader.lr.ph.thread ], [ %29, %for.cond44.preheader.lr.ph ]
%cmp59 = icmp sgt i32 %25, 0
%26 = select i1 %cmp59, i32 %.lcssa131137, i32 0
br label %for.end64
for.body28: ; preds = %for.body28.lr.ph, %for.body28
%indvars.iv112 = phi i64 [ 0, %for.body28.lr.ph ], [ %indvars.iv.next113, %for.body28 ]
%arrayidx32 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv112
%call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx32)
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%27 = load i32, ptr %m, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp26 = icmp slt i64 %indvars.iv.next113, %28
br i1 %cmp26, label %for.body28, label %for.inc37.loopexit, !llvm.loop !19
for.inc37.loopexit: ; preds = %for.body28
%.pre128 = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc37
for.inc37: ; preds = %for.inc37.loopexit, %for.cond25.preheader
%29 = phi i32 [ %.pre128, %for.inc37.loopexit ], [ %8, %for.cond25.preheader ]
%30 = phi i32 [ %27, %for.inc37.loopexit ], [ %9, %for.cond25.preheader ]
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%31 = sext i32 %29 to i64
%cmp22 = icmp slt i64 %indvars.iv.next116, %31
br i1 %cmp22, label %for.cond25.preheader, label %for.cond40.preheader, !llvm.loop !20
for.end64: ; preds = %for.cond44.for.end57_crit_edge.us, %for.cond21.preheader, %for.cond44.preheader.lr.ph.split, %for.cond40.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond40.preheader ], [ %26, %for.cond44.preheader.lr.ph.split ], [ 0, %for.cond21.preheader ], [ %spec.select.us, %for.cond44.for.end57_crit_edge.us ]
%call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !12, !16, !15}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12, !21}
!21 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
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);}
typedef struct{
ll aa;
ll bb;
}frequent;
int main(void){
// char ;
ll n,ans=0;
scanf("%lld",&n);
char s[n][15];
rep(i,0,n){
scanf("%s",s[i]);
}
ll a=0,b=0,l,c=0;
rep(i,0,n){
l=strlen(s[i]);
if(s[i][0]=='B') b++;
if(s[i][l-1]=='A') a++;
if(s[i][l-1]=='A' && s[i][0]=='B') c++;
rep(j,0,l-1){
if(s[i][j]=='A'&&s[i][j+1]=='B'){
ans++;
j++;
}
}
}
// printf("%lld %lld ",a,b);
if(a==b && b==c &&a>0){
a--;
}
ans+=min2(a,b);
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254091/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254091/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %a, %b
%cmp1.not = icmp sgt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smin.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #2 {
entry:
%cmp.not = icmp slt i64 %a, %b
%cmp1.not = icmp slt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smax.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @minn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #3 {
entry:
%cmp5 = icmp sgt i64 %n, 0
br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi8 = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load9 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi8, <2 x i64> %wide.load9)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.06.ph = phi i64 [ 1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ 1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader10 ]
%b.06 = phi i64 [ %cond.i, %for.body ], [ %b.06.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.07
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smin.i64(i64 %b.06, i64 %6)
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @maxn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #3 {
entry:
%cmp5 = icmp sgt i64 %n, 0
br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi8 = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load9 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi8, <2 x i64> %wide.load9)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.06.ph = phi i64 [ -1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ -1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader10 ]
%b.06 = phi i64 [ %cond.i, %for.body ], [ %b.06.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.07
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %b.06, i64 %6)
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @ABS(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.abs.i64(i64 %a, i1 true)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @POW(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%c.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%c.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %c.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %c.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !16
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%c.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %c.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%c.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %c.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod(i64 noundef %n) local_unnamed_addr #5 {
entry:
%rem = srem i64 %n, 1000000007
ret i64 %rem
}
; 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) #6 {
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) #6 {
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 #7 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #13
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #7 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #13
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #13
%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 [15 x i8], i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp107 = icmp sgt i64 %2, 0
br i1 %cmp107, label %for.body, label %land.lhs.true66
for.cond3.preheader: ; preds = %for.body
%cmp4113 = icmp sgt i64 %3, 0
br i1 %cmp4113, label %for.body6, label %land.lhs.true66
for.body: ; preds = %entry, %for.body
%i.0108 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [15 x i8], ptr %vla, i64 %i.0108
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.0108, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !19
for.cond.cleanup5: ; preds = %for.cond.cleanup41
%cmp64 = icmp eq i64 %a.1, %spec.select
br i1 %cmp64, label %land.lhs.true66, label %if.end73
for.body6: ; preds = %for.cond3.preheader, %for.cond.cleanup41
%i2.0118 = phi i64 [ %inc62, %for.cond.cleanup41 ], [ 0, %for.cond3.preheader ]
%c.0117 = phi i64 [ %c.1, %for.cond.cleanup41 ], [ 0, %for.cond3.preheader ]
%b.0116 = phi i64 [ %spec.select, %for.cond.cleanup41 ], [ 0, %for.cond3.preheader ]
%a.0115 = phi i64 [ %a.1, %for.cond.cleanup41 ], [ 0, %for.cond3.preheader ]
%ans.0114 = phi i64 [ %ans.1.lcssa, %for.cond.cleanup41 ], [ 0, %for.cond3.preheader ]
%arrayidx7 = getelementptr inbounds [15 x i8], ptr %vla, i64 %i2.0118
%call9 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx7) #14
%4 = load i8, ptr %arrayidx7, align 1, !tbaa !20
%cmp12 = icmp eq i8 %4, 66
%inc14 = zext i1 %cmp12 to i64
%spec.select = add nuw nsw i64 %b.0116, %inc14
%sub = add nsw i64 %call9, -1
%arrayidx16 = getelementptr inbounds [15 x i8], ptr %vla, i64 %i2.0118, i64 %sub
%5 = load i8, ptr %arrayidx16, align 1, !tbaa !20
%cmp18 = icmp eq i8 %5, 65
%inc21 = zext i1 %cmp18 to i64
%a.1 = add nuw nsw i64 %a.0115, %inc21
%narrow = select i1 %cmp18, i1 %cmp12, i1 false
%spec.select103 = zext i1 %narrow to i64
%c.1 = add nuw nsw i64 %c.0117, %spec.select103
%cmp39109 = icmp sgt i64 %call9, 1
br i1 %cmp39109, label %for.body42, label %for.cond.cleanup41
for.cond.cleanup41: ; preds = %for.inc58, %for.body6
%ans.1.lcssa = phi i64 [ %ans.0114, %for.body6 ], [ %ans.2, %for.inc58 ]
%inc62 = add nuw nsw i64 %i2.0118, 1
%exitcond.not = icmp eq i64 %inc62, %3
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !21
for.body42: ; preds = %for.body6, %for.inc58
%j.0111 = phi i64 [ %inc59, %for.inc58 ], [ 0, %for.body6 ]
%ans.1110 = phi i64 [ %ans.2, %for.inc58 ], [ %ans.0114, %for.body6 ]
%arrayidx44 = getelementptr inbounds [15 x i8], ptr %vla, i64 %i2.0118, i64 %j.0111
%6 = load i8, ptr %arrayidx44, align 1, !tbaa !20
%cmp46 = icmp eq i8 %6, 65
br i1 %cmp46, label %land.lhs.true48, label %for.inc58
land.lhs.true48: ; preds = %for.body42
%add = add nsw i64 %j.0111, 1
%arrayidx50 = getelementptr inbounds [15 x i8], ptr %vla, i64 %i2.0118, i64 %add
%7 = load i8, ptr %arrayidx50, align 1, !tbaa !20
%cmp52 = icmp eq i8 %7, 66
%inc55 = zext i1 %cmp52 to i64
%spec.select104 = add nsw i64 %ans.1110, %inc55
%spec.select105 = select i1 %cmp52, i64 %add, i64 %j.0111
br label %for.inc58
for.inc58: ; preds = %land.lhs.true48, %for.body42
%ans.2 = phi i64 [ %ans.1110, %for.body42 ], [ %spec.select104, %land.lhs.true48 ]
%j.1 = phi i64 [ %j.0111, %for.body42 ], [ %spec.select105, %land.lhs.true48 ]
%inc59 = add nsw i64 %j.1, 1
%cmp39 = icmp slt i64 %inc59, %sub
br i1 %cmp39, label %for.body42, label %for.cond.cleanup41, !llvm.loop !22
land.lhs.true66: ; preds = %entry, %for.cond3.preheader, %for.cond.cleanup5
%c.0.lcssa136 = phi i64 [ %c.1, %for.cond.cleanup5 ], [ 0, %for.cond3.preheader ], [ 0, %entry ]
%b.0.lcssa135 = phi i64 [ %spec.select, %for.cond.cleanup5 ], [ 0, %for.cond3.preheader ], [ 0, %entry ]
%a.0.lcssa133 = phi i64 [ %a.1, %for.cond.cleanup5 ], [ 0, %for.cond3.preheader ], [ 0, %entry ]
%ans.0.lcssa132 = phi i64 [ %ans.1.lcssa, %for.cond.cleanup5 ], [ 0, %for.cond3.preheader ], [ 0, %entry ]
%cmp67 = icmp eq i64 %a.0.lcssa133, %c.0.lcssa136
%cmp70 = icmp sgt i64 %a.0.lcssa133, 0
%or.cond = and i1 %cmp67, %cmp70
%dec = sext i1 %or.cond to i64
%spec.select106 = add nsw i64 %a.0.lcssa133, %dec
br label %if.end73
if.end73: ; preds = %land.lhs.true66, %for.cond.cleanup5
%b.0.lcssa134 = phi i64 [ %spec.select, %for.cond.cleanup5 ], [ %b.0.lcssa135, %land.lhs.true66 ]
%ans.0.lcssa131 = phi i64 [ %ans.1.lcssa, %for.cond.cleanup5 ], [ %ans.0.lcssa132, %land.lhs.true66 ]
%a.2 = phi i64 [ %a.1, %for.cond.cleanup5 ], [ %spec.select106, %land.lhs.true66 ]
%cond.i = call i64 @llvm.smin.i64(i64 %a.2, i64 %b.0.lcssa134)
%add75 = add nsw i64 %cond.i, %ans.0.lcssa131
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add75)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #13
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #10
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #11
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #12
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree 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 #5 = { 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #11 = { 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 #12 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #13 = { nounwind }
attributes #14 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
#include <string.h>
#define min(x, y) ((x<y) ? (x) : (y))
int main(){
int N, i, j, ans = 0;
scanf("%d", &N);
int SN[N];
char S[N][10];
for (i=0; i<N; i++){
scanf("%s", &S[i]);
SN[i] = strlen(S[i]);
}
int A=0, B=0, AB=0;
for (i=0; i<N; i++){
if (S[i][0] == 'B' && S[i][SN[i]-1] == 'A'){
AB++;
continue;
}
if (S[i][0] == 'B'){
B++;
continue;
}
if (S[i][SN[i]-1] == 'A'){
A++;
continue;
}
}
for (i=0; i<N; i++){
for (j=0; j<SN[i]-1; j++){
if (S[i][j] == 'A' && S[i][j+1] == 'B'){
ans++;
}
}
}
if (AB>0) ans += AB-1;
if (AB>0 && A>0){
A--;
ans++;
}
if (AB>0 && B>0){
B--;
ans++;
}
ans += min(A, B);
printf("%d", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254134/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254134/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%4 = zext i32 %3 to i64
%vla1 = alloca [10 x i8], i64 %4, align 16
%cmp154 = icmp sgt i32 %3, 0
br i1 %cmp154, label %for.body, label %for.end87
for.cond8.preheader: ; preds = %for.body
%cmp9156 = icmp sgt i32 %5, 0
br i1 %cmp9156, label %for.body11.preheader, label %for.end87
for.body11.preheader: ; preds = %for.cond8.preheader
%wide.trip.count = zext i32 %5 to i64
br label %for.body11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx) #7
%conv = trunc i64 %call5 to i32
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
store i32 %conv, ptr %arrayidx7, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond53.preheader: ; preds = %for.inc50
br i1 %cmp9156, label %for.cond57.preheader.preheader, label %for.end87
for.cond57.preheader.preheader: ; preds = %for.cond53.preheader
%wide.trip.count186 = zext i32 %5 to i64
br label %for.cond57.preheader
for.body11: ; preds = %for.body11.preheader, %for.inc50
%indvars.iv174 = phi i64 [ 0, %for.body11.preheader ], [ %indvars.iv.next175, %for.inc50 ]
%AB.0160 = phi i32 [ 0, %for.body11.preheader ], [ %AB.1, %for.inc50 ]
%B.0159 = phi i32 [ 0, %for.body11.preheader ], [ %B.1, %for.inc50 ]
%A.0158 = phi i32 [ 0, %for.body11.preheader ], [ %A.1, %for.inc50 ]
%arrayidx13 = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv174
%7 = load i8, ptr %arrayidx13, align 2, !tbaa !11
%cmp16 = icmp eq i8 %7, 66
%arrayidx21 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv174
%8 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%sub = add nsw i32 %8, -1
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv174, i64 %idxprom22
%9 = load i8, ptr %arrayidx23, align 1, !tbaa !11
%cmp25 = icmp eq i8 %9, 65
br i1 %cmp16, label %land.lhs.true, label %if.end36
land.lhs.true: ; preds = %for.body11
br i1 %cmp25, label %if.then, label %if.then34
if.then: ; preds = %land.lhs.true
%inc27 = add nsw i32 %AB.0160, 1
br label %for.inc50
if.then34: ; preds = %land.lhs.true
%inc35 = add nsw i32 %B.0159, 1
br label %for.inc50
if.end36: ; preds = %for.body11
%inc48 = zext i1 %cmp25 to i32
%spec.select = add nsw i32 %A.0158, %inc48
br label %for.inc50
for.inc50: ; preds = %if.end36, %if.then34, %if.then
%A.1 = phi i32 [ %A.0158, %if.then ], [ %A.0158, %if.then34 ], [ %spec.select, %if.end36 ]
%B.1 = phi i32 [ %B.0159, %if.then ], [ %inc35, %if.then34 ], [ %B.0159, %if.end36 ]
%AB.1 = phi i32 [ %inc27, %if.then ], [ %AB.0160, %if.then34 ], [ %AB.0160, %if.end36 ]
%indvars.iv.next175 = add nuw nsw i64 %indvars.iv174, 1
%exitcond.not = icmp eq i64 %indvars.iv.next175, %wide.trip.count
br i1 %exitcond.not, label %for.cond53.preheader, label %for.body11, !llvm.loop !12
for.cond57.preheader: ; preds = %for.cond57.preheader.preheader, %for.inc85
%indvars.iv183 = phi i64 [ 0, %for.cond57.preheader.preheader ], [ %indvars.iv.next184, %for.inc85 ]
%ans.0169 = phi i32 [ 0, %for.cond57.preheader.preheader ], [ %ans.1.lcssa, %for.inc85 ]
%arrayidx59 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv183
%10 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%cmp61164 = icmp sgt i32 %10, 1
br i1 %cmp61164, label %for.body63.preheader, label %for.inc85
for.body63.preheader: ; preds = %for.cond57.preheader
%sub60 = add i32 %10, -1
%wide.trip.count181 = zext i32 %sub60 to i64
%xtraiter = and i64 %wide.trip.count181, 1
%11 = icmp eq i32 %sub60, 1
br i1 %11, label %for.inc85.loopexit.unr-lcssa, label %for.body63.preheader.new
for.body63.preheader.new: ; preds = %for.body63.preheader
%unroll_iter = and i64 %wide.trip.count181, 4294967294
br label %for.body63
for.body63: ; preds = %for.inc82.1, %for.body63.preheader.new
%indvars.iv177 = phi i64 [ 0, %for.body63.preheader.new ], [ %16, %for.inc82.1 ]
%ans.1165 = phi i32 [ %ans.0169, %for.body63.preheader.new ], [ %ans.2.1, %for.inc82.1 ]
%niter = phi i64 [ 0, %for.body63.preheader.new ], [ %niter.next.1, %for.inc82.1 ]
%arrayidx67 = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv183, i64 %indvars.iv177
%12 = load i8, ptr %arrayidx67, align 2, !tbaa !11
%cmp69 = icmp eq i8 %12, 65
%13 = or i64 %indvars.iv177, 1
br i1 %cmp69, label %land.lhs.true71, label %for.inc82
land.lhs.true71: ; preds = %for.body63
%arrayidx75 = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv183, i64 %13
%14 = load i8, ptr %arrayidx75, align 1, !tbaa !11
%cmp77 = icmp eq i8 %14, 66
%inc80 = zext i1 %cmp77 to i32
%spec.select153 = add nsw i32 %ans.1165, %inc80
br label %for.inc82
for.inc82: ; preds = %for.body63, %land.lhs.true71
%ans.2 = phi i32 [ %spec.select153, %land.lhs.true71 ], [ %ans.1165, %for.body63 ]
%arrayidx67.1 = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv183, i64 %13
%15 = load i8, ptr %arrayidx67.1, align 1, !tbaa !11
%cmp69.1 = icmp eq i8 %15, 65
%16 = add nuw nsw i64 %indvars.iv177, 2
br i1 %cmp69.1, label %land.lhs.true71.1, label %for.inc82.1
land.lhs.true71.1: ; preds = %for.inc82
%arrayidx75.1 = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv183, i64 %16
%17 = load i8, ptr %arrayidx75.1, align 2, !tbaa !11
%cmp77.1 = icmp eq i8 %17, 66
%inc80.1 = zext i1 %cmp77.1 to i32
%spec.select153.1 = add nsw i32 %ans.2, %inc80.1
br label %for.inc82.1
for.inc82.1: ; preds = %land.lhs.true71.1, %for.inc82
%ans.2.1 = phi i32 [ %spec.select153.1, %land.lhs.true71.1 ], [ %ans.2, %for.inc82 ]
%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.inc85.loopexit.unr-lcssa, label %for.body63, !llvm.loop !13
for.inc85.loopexit.unr-lcssa: ; preds = %for.inc82.1, %for.body63.preheader
%ans.2.lcssa.ph = phi i32 [ undef, %for.body63.preheader ], [ %ans.2.1, %for.inc82.1 ]
%indvars.iv177.unr = phi i64 [ 0, %for.body63.preheader ], [ %16, %for.inc82.1 ]
%ans.1165.unr = phi i32 [ %ans.0169, %for.body63.preheader ], [ %ans.2.1, %for.inc82.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc85, label %for.body63.epil
for.body63.epil: ; preds = %for.inc85.loopexit.unr-lcssa
%arrayidx67.epil = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv183, i64 %indvars.iv177.unr
%18 = load i8, ptr %arrayidx67.epil, align 1, !tbaa !11
%cmp69.epil = icmp eq i8 %18, 65
br i1 %cmp69.epil, label %land.lhs.true71.epil, label %for.inc85
land.lhs.true71.epil: ; preds = %for.body63.epil
%19 = add nuw nsw i64 %indvars.iv177.unr, 1
%arrayidx75.epil = getelementptr inbounds [10 x i8], ptr %vla1, i64 %indvars.iv183, i64 %19
%20 = load i8, ptr %arrayidx75.epil, align 1, !tbaa !11
%cmp77.epil = icmp eq i8 %20, 66
%inc80.epil = zext i1 %cmp77.epil to i32
%spec.select153.epil = add nsw i32 %ans.1165.unr, %inc80.epil
br label %for.inc85
for.inc85: ; preds = %for.inc85.loopexit.unr-lcssa, %land.lhs.true71.epil, %for.body63.epil, %for.cond57.preheader
%ans.1.lcssa = phi i32 [ %ans.0169, %for.cond57.preheader ], [ %ans.2.lcssa.ph, %for.inc85.loopexit.unr-lcssa ], [ %spec.select153.epil, %land.lhs.true71.epil ], [ %ans.1165.unr, %for.body63.epil ]
%indvars.iv.next184 = add nuw nsw i64 %indvars.iv183, 1
%exitcond187.not = icmp eq i64 %indvars.iv.next184, %wide.trip.count186
br i1 %exitcond187.not, label %for.end87, label %for.cond57.preheader, !llvm.loop !14
for.end87: ; preds = %for.inc85, %entry, %for.cond8.preheader, %for.cond53.preheader
%AB.0.lcssa199 = phi i32 [ %AB.1, %for.cond53.preheader ], [ 0, %for.cond8.preheader ], [ 0, %entry ], [ %AB.1, %for.inc85 ]
%B.0.lcssa198 = phi i32 [ %B.1, %for.cond53.preheader ], [ 0, %for.cond8.preheader ], [ 0, %entry ], [ %B.1, %for.inc85 ]
%A.0.lcssa197 = phi i32 [ %A.1, %for.cond53.preheader ], [ 0, %for.cond8.preheader ], [ 0, %entry ], [ %A.1, %for.inc85 ]
%ans.0.lcssa = phi i32 [ 0, %for.cond53.preheader ], [ 0, %for.cond8.preheader ], [ 0, %entry ], [ %ans.1.lcssa, %for.inc85 ]
%cmp88 = icmp sgt i32 %AB.0.lcssa199, 0
%sub91 = add nsw i32 %AB.0.lcssa199, -1
%add92 = select i1 %cmp88, i32 %sub91, i32 0
%cmp97 = icmp sgt i32 %A.0.lcssa197, 0
%or.cond = select i1 %cmp88, i1 %cmp97, i1 false
%inc100 = zext i1 %or.cond to i32
%dec = sext i1 %or.cond to i32
%A.2 = add nsw i32 %A.0.lcssa197, %dec
%cmp105 = icmp sgt i32 %B.0.lcssa198, 0
%or.cond115 = select i1 %cmp88, i1 %cmp105, i1 false
%inc109 = zext i1 %or.cond115 to i32
%dec108 = sext i1 %or.cond115 to i32
%B.2 = add nsw i32 %B.0.lcssa198, %dec108
%cond = call i32 @llvm.smin.i32(i32 %A.2, i32 %B.2)
%ans.3 = add nsw i32 %add92, %inc100
%ans.4 = add i32 %ans.3, %inc109
%ans.5 = add i32 %ans.4, %cond
%add113 = add i32 %ans.5, %ans.0.lcssa
%call114 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add113)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <string.h>
int T, P, R;
struct team{
int tID;
int correct_n;
int wrong[11];
int penalty;
};
struct team teams[51];
void sort_c(struct team teams[], int n)
{
int i, j;
for(i = 0; i < n - 1; i++){
for(j = 1; j < n; j++){
if(!(teams[j].correct_n < teams[j - 1].correct_n)){
struct team t = teams[j];
teams[j] = teams[j - 1];
teams[j - 1] = t;
}
}
}
}
void sort_p(struct team teams[], int n)
{
int i, j;
for(i = 0; i < n - 1; i++){
for(j = 1; j < n; j++){
if(!(teams[j].penalty > teams[j - 1].penalty)){
struct team t = teams[j];
teams[j] = teams[j - 1];
teams[j - 1] = t;
}
}
}
}
void sort_t(struct team teams[], int n)
{
int i, j;
for(i = 0; i < n - 1; i++){
for(j = 1; j < n; j++){
if(!(teams[j].tID > teams[j - 1].tID)){
struct team t = teams[j];
teams[j] = teams[j - 1];
teams[j - 1] = t;
}
}
}
}
int main(void)
{
while(1){
int i, j;
scanf("%d %d %d", &T, &P, &R);
if(T == 0 && P == 0 && R == 0)
break;
for(i = 1; i <= T; i++){
teams[i].tID = i;
teams[i].correct_n = 0;
for(j = 0; j <= 10; j++){
teams[i].wrong[j] = 0;
}
teams[i].penalty = 0;
}
for(i = 1; i <= R; i++){
int tID, pID, time;
char message[8];
scanf("%d %d %d %s", &tID, &pID, &time, message);
if(strcmp(message, "CORRECT") == 0){
teams[tID].correct_n++;
teams[tID].penalty += (teams[tID].wrong[pID] * 1200 + time);
}else if(strcmp(message, "WRONG") == 0){
teams[tID].wrong[pID]++;
}
}
sort_c(teams + 1, T);
teams[T + 1].correct_n = -1;
i = 1;
while(1){
j = i;
while(teams[i].correct_n == teams[j].correct_n){
j++;
}
sort_p(teams + i, j - i);
if(j > T + 1)
break;
i = j;
}
teams[T + 1].penalty = -1;
i = 1;
while(1){
j = i;
while(teams[i].penalty == teams[j].penalty){
j++;
}
sort_t(teams + i, j - i);
if(j > T + 1)
break;
i = j;
}
for(i = 1; i <= T; i++){
printf("%d %d %d\n", teams[i].tID, teams[i].correct_n, teams[i].penalty);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254192/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254192/source.c"
target datalayout = "e-m:e-p270: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.team = type { i32, i32, [11 x i32], i32 }
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@T = dso_local global i32 0, align 4
@P = dso_local global i32 0, align 4
@R = dso_local global i32 0, align 4
@teams = dso_local local_unnamed_addr global [51 x %struct.team] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [12 x i8] c"%d %d %d %s\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"CORRECT\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"WRONG\00", align 1
@.str.4 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort_c(ptr nocapture noundef %teams, i32 noundef %n) local_unnamed_addr #0 {
entry:
%t = alloca %struct.team, align 4
%cmp38 = icmp sgt i32 %n, 1
br i1 %cmp38, label %for.cond1.preheader.us.preheader, label %for.end21
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%0 = add i32 %n, -2
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc19_crit_edge.us
%i.039.us = phi i32 [ %inc20.us, %for.cond1.for.inc19_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ]
br label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.inc.us
%indvars.iv = phi i64 [ 1, %for.cond1.preheader.us ], [ %indvars.iv.next, %for.inc.us ]
%correct_n.us = getelementptr inbounds %struct.team, ptr %teams, i64 %indvars.iv, i32 1
%1 = load i32, ptr %correct_n.us, align 4, !tbaa !5
%2 = add nsw i64 %indvars.iv, -1
%correct_n7.us = getelementptr inbounds %struct.team, ptr %teams, i64 %2, i32 1
%3 = load i32, ptr %correct_n7.us, align 4, !tbaa !5
%cmp8.us = icmp slt i32 %1, %3
br i1 %cmp8.us, label %for.inc.us, label %if.then.us
if.then.us: ; preds = %for.body3.us
%arrayidx6.us = getelementptr inbounds %struct.team, ptr %teams, i64 %2
%arrayidx.us = getelementptr inbounds %struct.team, ptr %teams, i64 %indvars.iv
call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %t)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %t, ptr noundef nonnull align 4 dereferenceable(56) %arrayidx.us, i64 56, i1 false), !tbaa.struct !10
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %arrayidx.us, ptr noundef nonnull align 4 dereferenceable(56) %arrayidx6.us, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %arrayidx6.us, ptr noundef nonnull align 4 dereferenceable(56) %t, i64 56, i1 false), !tbaa.struct !10
call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %t)
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body3.us
%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.cond1.for.inc19_crit_edge.us, label %for.body3.us, !llvm.loop !13
for.cond1.for.inc19_crit_edge.us: ; preds = %for.inc.us
%inc20.us = add nuw nsw i32 %i.039.us, 1
%exitcond43.not = icmp eq i32 %i.039.us, %0
br i1 %exitcond43.not, label %for.end21, label %for.cond1.preheader.us, !llvm.loop !15
for.end21: ; preds = %for.cond1.for.inc19_crit_edge.us, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort_p(ptr nocapture noundef %teams, i32 noundef %n) local_unnamed_addr #0 {
entry:
%t = alloca %struct.team, align 4
%cmp38 = icmp sgt i32 %n, 1
br i1 %cmp38, label %for.cond1.preheader.us.preheader, label %for.end21
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%0 = add i32 %n, -2
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc19_crit_edge.us
%i.039.us = phi i32 [ %inc20.us, %for.cond1.for.inc19_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ]
br label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.inc.us
%indvars.iv = phi i64 [ 1, %for.cond1.preheader.us ], [ %indvars.iv.next, %for.inc.us ]
%penalty.us = getelementptr inbounds %struct.team, ptr %teams, i64 %indvars.iv, i32 3
%1 = load i32, ptr %penalty.us, align 4, !tbaa !16
%2 = add nsw i64 %indvars.iv, -1
%penalty7.us = getelementptr inbounds %struct.team, ptr %teams, i64 %2, i32 3
%3 = load i32, ptr %penalty7.us, align 4, !tbaa !16
%cmp8.us = icmp sgt i32 %1, %3
br i1 %cmp8.us, label %for.inc.us, label %if.then.us
if.then.us: ; preds = %for.body3.us
%arrayidx6.us = getelementptr inbounds %struct.team, ptr %teams, i64 %2
%arrayidx.us = getelementptr inbounds %struct.team, ptr %teams, i64 %indvars.iv
call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %t)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %t, ptr noundef nonnull align 4 dereferenceable(56) %arrayidx.us, i64 56, i1 false), !tbaa.struct !10
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %arrayidx.us, ptr noundef nonnull align 4 dereferenceable(56) %arrayidx6.us, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %arrayidx6.us, ptr noundef nonnull align 4 dereferenceable(56) %t, i64 56, i1 false), !tbaa.struct !10
call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %t)
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body3.us
%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.cond1.for.inc19_crit_edge.us, label %for.body3.us, !llvm.loop !17
for.cond1.for.inc19_crit_edge.us: ; preds = %for.inc.us
%inc20.us = add nuw nsw i32 %i.039.us, 1
%exitcond43.not = icmp eq i32 %i.039.us, %0
br i1 %exitcond43.not, label %for.end21, label %for.cond1.preheader.us, !llvm.loop !18
for.end21: ; preds = %for.cond1.for.inc19_crit_edge.us, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort_t(ptr nocapture noundef %teams, i32 noundef %n) local_unnamed_addr #0 {
entry:
%t = alloca %struct.team, align 4
%cmp38 = icmp sgt i32 %n, 1
br i1 %cmp38, label %for.cond1.preheader.us.preheader, label %for.end21
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%invariant.gep = getelementptr %struct.team, ptr %teams, i64 -1
%0 = add i32 %n, -2
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc19_crit_edge.us
%i.039.us = phi i32 [ %inc20.us, %for.cond1.for.inc19_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ]
br label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.inc.us
%indvars.iv = phi i64 [ 1, %for.cond1.preheader.us ], [ %indvars.iv.next, %for.inc.us ]
%arrayidx.us = getelementptr inbounds %struct.team, ptr %teams, i64 %indvars.iv
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !19
%gep = getelementptr %struct.team, ptr %invariant.gep, i64 %indvars.iv
%2 = load i32, ptr %gep, align 4, !tbaa !19
%cmp8.us = icmp sgt i32 %1, %2
br i1 %cmp8.us, label %for.inc.us, label %if.then.us
if.then.us: ; preds = %for.body3.us
call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %t)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %t, ptr noundef nonnull align 4 dereferenceable(56) %arrayidx.us, i64 56, i1 false), !tbaa.struct !10
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %arrayidx.us, ptr noundef nonnull align 4 dereferenceable(56) %gep, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %gep, ptr noundef nonnull align 4 dereferenceable(56) %t, i64 56, i1 false), !tbaa.struct !10
call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %t)
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body3.us
%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.cond1.for.inc19_crit_edge.us, label %for.body3.us, !llvm.loop !20
for.cond1.for.inc19_crit_edge.us: ; preds = %for.inc.us
%inc20.us = add nuw nsw i32 %i.039.us, 1
%exitcond43.not = icmp eq i32 %i.039.us, %0
br i1 %exitcond43.not, label %for.end21, label %for.cond1.preheader.us, !llvm.loop !21
for.end21: ; preds = %for.cond1.for.inc19_crit_edge.us, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%t.i173 = alloca %struct.team, align 4
%t.i155 = alloca %struct.team, align 4
%t.i = alloca %struct.team, align 4
%tID22 = alloca i32, align 4
%pID = alloca i32, align 4
%time = alloca i32, align 4
%message = alloca [8 x i8], align 1
%call199 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @T, ptr noundef nonnull @P, ptr noundef nonnull @R)
%0 = load i32, ptr @T, align 4, !tbaa !11
%cmp200 = icmp eq i32 %0, 0
%1 = load i32, ptr @P, align 4
%cmp1201 = icmp eq i32 %1, 0
%or.cond202 = select i1 %cmp200, i1 %cmp1201, i1 false
%2 = load i32, ptr @R, align 4
%cmp3203 = icmp eq i32 %2, 0
%or.cond120204 = select i1 %or.cond202, i1 %cmp3203, i1 false
br i1 %or.cond120204, label %while.end119, label %for.cond.preheader
while.body.loopexit: ; preds = %for.body104, %for.cond102.preheader
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @T, ptr noundef nonnull @P, ptr noundef nonnull @R)
%3 = load i32, ptr @T, align 4, !tbaa !11
%cmp = icmp eq i32 %3, 0
%4 = load i32, ptr @P, align 4
%cmp1 = icmp eq i32 %4, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%5 = load i32, ptr @R, align 4
%cmp3 = icmp eq i32 %5, 0
%or.cond120 = select i1 %or.cond, i1 %cmp3, i1 false
br i1 %or.cond120, label %while.end119, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %while.body.loopexit
%6 = phi i32 [ %5, %while.body.loopexit ], [ %2, %entry ]
%7 = phi i32 [ %3, %while.body.loopexit ], [ %0, %entry ]
%cmp4.not193 = icmp slt i32 %7, 1
br i1 %cmp4.not193, label %for.cond19.preheader, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count, 1
%8 = icmp eq i32 %7, 1
br i1 %8, label %for.cond19.preheader.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.cond19.preheader.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%indvar.unr = phi i64 [ 0, %for.body.preheader ], [ %indvar.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond19.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond19.preheader.loopexit.unr-lcssa
%9 = mul nuw nsw i64 %indvar.unr, 56
%gep.epil = getelementptr i8, ptr getelementptr inbounds ([51 x %struct.team], ptr @teams, i64 0, i64 1, i32 2, i64 0), i64 %9
%arrayidx.epil = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv.unr
%10 = trunc i64 %indvars.iv.unr to i32
store i32 %10, ptr %arrayidx.epil, align 8, !tbaa !19
%correct_n.epil = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv.unr, i32 1
store i32 0, ptr %correct_n.epil, align 4, !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(44) %gep.epil, i8 0, i64 44, i1 false), !tbaa !11
%penalty.epil = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv.unr, i32 3
store i32 0, ptr %penalty.epil, align 4, !tbaa !16
br label %for.cond19.preheader
for.cond19.preheader: ; preds = %for.body.epil, %for.cond19.preheader.loopexit.unr-lcssa, %for.cond.preheader
%cmp20.not195 = icmp slt i32 %6, 1
br i1 %cmp20.not195, label %for.end55, label %for.body21
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%indvar = phi i64 [ 0, %for.body.preheader.new ], [ %indvar.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%11 = mul nuw nsw i64 %indvar, 56
%gep = getelementptr i8, ptr getelementptr inbounds ([51 x %struct.team], ptr @teams, i64 0, i64 1, i32 2, i64 0), i64 %11
%arrayidx = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv
%12 = trunc i64 %indvars.iv to i32
store i32 %12, ptr %arrayidx, align 8, !tbaa !19
%correct_n = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv, i32 1
store i32 0, ptr %correct_n, align 4, !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(44) %gep, i8 0, i64 44, i1 false), !tbaa !11
%penalty = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv, i32 3
store i32 0, ptr %penalty, align 4, !tbaa !16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%13 = mul nuw i64 %indvar, 56
%gep217 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([51 x %struct.team], ptr @teams, i64 0, i64 1, i32 2, i64 0), i64 56), i64 %13
%arrayidx.1 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv.next
%14 = trunc i64 %indvars.iv.next to i32
store i32 %14, ptr %arrayidx.1, align 8, !tbaa !19
%correct_n.1 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv.next, i32 1
store i32 0, ptr %correct_n.1, align 4, !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(44) %gep217, i8 0, i64 44, i1 false), !tbaa !11
%penalty.1 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv.next, i32 3
store i32 0, ptr %penalty.1, align 4, !tbaa !16
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%indvar.next.1 = add nuw nsw i64 %indvar, 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.cond19.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !22
for.body21: ; preds = %for.cond19.preheader, %if.end52
%i.1196 = phi i32 [ %inc54, %if.end52 ], [ 1, %for.cond19.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tID22) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %pID) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %time) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %message) #7
%call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %tID22, ptr noundef nonnull %pID, ptr noundef nonnull %time, ptr noundef nonnull %message)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(8) %message, ptr noundef nonnull dereferenceable(8) @.str.2, i64 8)
%cmp26 = icmp eq i32 %bcmp, 0
br i1 %cmp26, label %if.then27, label %if.else
if.then27: ; preds = %for.body21
%15 = load i32, ptr %tID22, align 4, !tbaa !11
%idxprom28 = sext i32 %15 to i64
%correct_n30 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %idxprom28, i32 1
%16 = load i32, ptr %correct_n30, align 4, !tbaa !5
%inc31 = add nsw i32 %16, 1
store i32 %inc31, ptr %correct_n30, align 4, !tbaa !5
%17 = load i32, ptr %pID, align 4, !tbaa !11
%idxprom35 = sext i32 %17 to i64
%arrayidx36 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %idxprom28, i32 2, i64 %idxprom35
%18 = load i32, ptr %arrayidx36, align 4, !tbaa !11
%mul = mul nsw i32 %18, 1200
%19 = load i32, ptr %time, align 4, !tbaa !11
%add = add nsw i32 %mul, %19
%penalty39 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %idxprom28, i32 3
%20 = load i32, ptr %penalty39, align 4, !tbaa !16
br label %if.end52.sink.split
if.else: ; preds = %for.body21
%bcmp154 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %message, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6)
%cmp43 = icmp eq i32 %bcmp154, 0
br i1 %cmp43, label %if.then44, label %if.end52
if.then44: ; preds = %if.else
%21 = load i32, ptr %tID22, align 4, !tbaa !11
%idxprom45 = sext i32 %21 to i64
%22 = load i32, ptr %pID, align 4, !tbaa !11
%idxprom48 = sext i32 %22 to i64
%arrayidx49 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %idxprom45, i32 2, i64 %idxprom48
%23 = load i32, ptr %arrayidx49, align 4, !tbaa !11
br label %if.end52.sink.split
if.end52.sink.split: ; preds = %if.then27, %if.then44
%.sink216 = phi i32 [ 1, %if.then44 ], [ %20, %if.then27 ]
%.sink = phi i32 [ %23, %if.then44 ], [ %add, %if.then27 ]
%arrayidx49.sink = phi ptr [ %arrayidx49, %if.then44 ], [ %penalty39, %if.then27 ]
%inc50 = add nsw i32 %.sink, %.sink216
store i32 %inc50, ptr %arrayidx49.sink, align 4, !tbaa !11
br label %if.end52
if.end52: ; preds = %if.end52.sink.split, %if.else
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %message) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %time) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %pID) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tID22) #7
%inc54 = add nuw nsw i32 %i.1196, 1
%24 = load i32, ptr @R, align 4, !tbaa !11
%cmp20.not.not = icmp slt i32 %i.1196, %24
br i1 %cmp20.not.not, label %for.body21, label %for.end55.loopexit, !llvm.loop !23
for.end55.loopexit: ; preds = %if.end52
%.pre = load i32, ptr @T, align 4, !tbaa !11
br label %for.end55
for.end55: ; preds = %for.end55.loopexit, %for.cond19.preheader
%25 = phi i32 [ %.pre, %for.end55.loopexit ], [ %7, %for.cond19.preheader ]
%cmp38.i = icmp sgt i32 %25, 1
br i1 %cmp38.i, label %for.cond1.preheader.us.preheader.i, label %sort_c.exit
for.cond1.preheader.us.preheader.i: ; preds = %for.end55
%wide.trip.count.i = zext i32 %25 to i64
%26 = add nsw i32 %25, -2
br label %for.cond1.preheader.us.i
for.cond1.preheader.us.i: ; preds = %for.cond1.for.inc19_crit_edge.us.i, %for.cond1.preheader.us.preheader.i
%i.039.us.i = phi i32 [ %inc20.us.i, %for.cond1.for.inc19_crit_edge.us.i ], [ 0, %for.cond1.preheader.us.preheader.i ]
br label %for.body3.us.i
for.body3.us.i: ; preds = %for.inc.us.i, %for.cond1.preheader.us.i
%indvars.iv.i = phi i64 [ 1, %for.cond1.preheader.us.i ], [ %indvars.iv.next.i, %for.inc.us.i ]
%correct_n.us.i = getelementptr inbounds %struct.team, ptr getelementptr inbounds ([51 x %struct.team], ptr @teams, i64 0, i64 1), i64 %indvars.iv.i, i32 1
%27 = load i32, ptr %correct_n.us.i, align 4, !tbaa !5
%correct_n7.us.i = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv.i, i32 1
%28 = load i32, ptr %correct_n7.us.i, align 4, !tbaa !5
%cmp8.us.i = icmp slt i32 %27, %28
br i1 %cmp8.us.i, label %for.inc.us.i, label %if.then.us.i
if.then.us.i: ; preds = %for.body3.us.i
%arrayidx6.us.i = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv.i
%arrayidx.us.i = getelementptr inbounds %struct.team, ptr getelementptr inbounds ([51 x %struct.team], ptr @teams, i64 0, i64 1), i64 %indvars.iv.i
call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %t.i)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %t.i, ptr noundef nonnull align 8 dereferenceable(56) %arrayidx.us.i, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %arrayidx.us.i, ptr noundef nonnull align 8 dereferenceable(56) %arrayidx6.us.i, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %arrayidx6.us.i, ptr noundef nonnull align 4 dereferenceable(56) %t.i, i64 56, i1 false), !tbaa.struct !10
call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %t.i)
br label %for.inc.us.i
for.inc.us.i: ; preds = %if.then.us.i, %for.body3.us.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 %for.cond1.for.inc19_crit_edge.us.i, label %for.body3.us.i, !llvm.loop !13
for.cond1.for.inc19_crit_edge.us.i: ; preds = %for.inc.us.i
%inc20.us.i = add nuw nsw i32 %i.039.us.i, 1
%exitcond43.not.i = icmp eq i32 %i.039.us.i, %26
br i1 %exitcond43.not.i, label %sort_c.exit, label %for.cond1.preheader.us.i, !llvm.loop !15
sort_c.exit: ; preds = %for.cond1.for.inc19_crit_edge.us.i, %for.end55
%add56 = add nsw i32 %25, 1
%idxprom57 = sext i32 %add56 to i64
%correct_n59 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %idxprom57, i32 1
store i32 -1, ptr %correct_n59, align 4, !tbaa !5
br label %while.cond60
while.cond60: ; preds = %sort_p.exit, %sort_c.exit
%i.2 = phi i32 [ 1, %sort_c.exit ], [ %31, %sort_p.exit ]
%idxprom63 = sext i32 %i.2 to i64
%correct_n65 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %idxprom63, i32 1
%29 = load i32, ptr %correct_n65, align 4, !tbaa !5
br label %while.cond62
while.cond62: ; preds = %while.cond62, %while.cond60
%indvars.iv207 = phi i64 [ %indvars.iv.next208, %while.cond62 ], [ %idxprom63, %while.cond60 ]
%correct_n68 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv207, i32 1
%30 = load i32, ptr %correct_n68, align 4, !tbaa !5
%cmp69 = icmp eq i32 %29, %30
%indvars.iv.next208 = add i64 %indvars.iv207, 1
br i1 %cmp69, label %while.cond62, label %while.end, !llvm.loop !24
while.end: ; preds = %while.cond62
%31 = trunc i64 %indvars.iv207 to i32
%add.ptr = getelementptr inbounds %struct.team, ptr @teams, i64 %idxprom63
%sub = sub nsw i32 %31, %i.2
%cmp38.i156 = icmp sgt i32 %sub, 1
br i1 %cmp38.i156, label %for.cond1.preheader.us.preheader.i157, label %sort_p.exit
for.cond1.preheader.us.preheader.i157: ; preds = %while.end
%wide.trip.count.i158 = zext i32 %sub to i64
%32 = add nsw i32 %sub, -2
br label %for.cond1.preheader.us.i159
for.cond1.preheader.us.i159: ; preds = %for.cond1.for.inc19_crit_edge.us.i170, %for.cond1.preheader.us.preheader.i157
%i.039.us.i160 = phi i32 [ %inc20.us.i171, %for.cond1.for.inc19_crit_edge.us.i170 ], [ 0, %for.cond1.preheader.us.preheader.i157 ]
br label %for.body3.us.i161
for.body3.us.i161: ; preds = %for.inc.us.i167, %for.cond1.preheader.us.i159
%indvars.iv.i162 = phi i64 [ 1, %for.cond1.preheader.us.i159 ], [ %indvars.iv.next.i168, %for.inc.us.i167 ]
%penalty.us.i = getelementptr inbounds %struct.team, ptr %add.ptr, i64 %indvars.iv.i162, i32 3
%33 = load i32, ptr %penalty.us.i, align 4, !tbaa !16
%34 = add nsw i64 %indvars.iv.i162, -1
%penalty7.us.i = getelementptr inbounds %struct.team, ptr %add.ptr, i64 %34, i32 3
%35 = load i32, ptr %penalty7.us.i, align 4, !tbaa !16
%cmp8.us.i163 = icmp sgt i32 %33, %35
br i1 %cmp8.us.i163, label %for.inc.us.i167, label %if.then.us.i164
if.then.us.i164: ; preds = %for.body3.us.i161
%arrayidx6.us.i165 = getelementptr inbounds %struct.team, ptr %add.ptr, i64 %34
%arrayidx.us.i166 = getelementptr inbounds %struct.team, ptr %add.ptr, i64 %indvars.iv.i162
call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %t.i155)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %t.i155, ptr noundef nonnull align 8 dereferenceable(56) %arrayidx.us.i166, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %arrayidx.us.i166, ptr noundef nonnull align 8 dereferenceable(56) %arrayidx6.us.i165, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %arrayidx6.us.i165, ptr noundef nonnull align 4 dereferenceable(56) %t.i155, i64 56, i1 false), !tbaa.struct !10
call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %t.i155)
br label %for.inc.us.i167
for.inc.us.i167: ; preds = %if.then.us.i164, %for.body3.us.i161
%indvars.iv.next.i168 = add nuw nsw i64 %indvars.iv.i162, 1
%exitcond.not.i169 = icmp eq i64 %indvars.iv.next.i168, %wide.trip.count.i158
br i1 %exitcond.not.i169, label %for.cond1.for.inc19_crit_edge.us.i170, label %for.body3.us.i161, !llvm.loop !17
for.cond1.for.inc19_crit_edge.us.i170: ; preds = %for.inc.us.i167
%inc20.us.i171 = add nuw nsw i32 %i.039.us.i160, 1
%exitcond43.not.i172 = icmp eq i32 %i.039.us.i160, %32
br i1 %exitcond43.not.i172, label %sort_p.exit, label %for.cond1.preheader.us.i159, !llvm.loop !18
sort_p.exit: ; preds = %for.cond1.for.inc19_crit_edge.us.i170, %while.end
%cmp73 = icmp slt i32 %add56, %31
br i1 %cmp73, label %while.end76, label %while.cond60
while.end76: ; preds = %sort_p.exit
%penalty80 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %idxprom57, i32 3
store i32 -1, ptr %penalty80, align 4, !tbaa !16
br label %while.cond81
while.cond81: ; preds = %sort_t.exit, %while.end76
%i.3 = phi i32 [ 1, %while.end76 ], [ %38, %sort_t.exit ]
%idxprom84 = sext i32 %i.3 to i64
%penalty86 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %idxprom84, i32 3
%36 = load i32, ptr %penalty86, align 4, !tbaa !16
br label %while.cond83
while.cond83: ; preds = %while.cond83, %while.cond81
%indvars.iv210 = phi i64 [ %indvars.iv.next211, %while.cond83 ], [ %idxprom84, %while.cond81 ]
%penalty89 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv210, i32 3
%37 = load i32, ptr %penalty89, align 4, !tbaa !16
%cmp90 = icmp eq i32 %36, %37
%indvars.iv.next211 = add i64 %indvars.iv210, 1
br i1 %cmp90, label %while.cond83, label %while.end93, !llvm.loop !25
while.end93: ; preds = %while.cond83
%38 = trunc i64 %indvars.iv210 to i32
%add.ptr95 = getelementptr inbounds %struct.team, ptr @teams, i64 %idxprom84
%sub96 = sub nsw i32 %38, %i.3
%cmp38.i174 = icmp sgt i32 %sub96, 1
br i1 %cmp38.i174, label %for.cond1.preheader.us.preheader.i175, label %sort_t.exit
for.cond1.preheader.us.preheader.i175: ; preds = %while.end93
%wide.trip.count.i176 = zext i32 %sub96 to i64
%invariant.gep.i = getelementptr %struct.team, ptr %add.ptr95, i64 -1
%39 = add nsw i32 %sub96, -2
br label %for.cond1.preheader.us.i177
for.cond1.preheader.us.i177: ; preds = %for.cond1.for.inc19_crit_edge.us.i187, %for.cond1.preheader.us.preheader.i175
%i.039.us.i178 = phi i32 [ %inc20.us.i188, %for.cond1.for.inc19_crit_edge.us.i187 ], [ 0, %for.cond1.preheader.us.preheader.i175 ]
br label %for.body3.us.i179
for.body3.us.i179: ; preds = %for.inc.us.i184, %for.cond1.preheader.us.i177
%indvars.iv.i180 = phi i64 [ 1, %for.cond1.preheader.us.i177 ], [ %indvars.iv.next.i185, %for.inc.us.i184 ]
%arrayidx.us.i181 = getelementptr inbounds %struct.team, ptr %add.ptr95, i64 %indvars.iv.i180
%40 = load i32, ptr %arrayidx.us.i181, align 8, !tbaa !19
%gep.i = getelementptr %struct.team, ptr %invariant.gep.i, i64 %indvars.iv.i180
%41 = load i32, ptr %gep.i, align 8, !tbaa !19
%cmp8.us.i182 = icmp sgt i32 %40, %41
br i1 %cmp8.us.i182, label %for.inc.us.i184, label %if.then.us.i183
if.then.us.i183: ; preds = %for.body3.us.i179
call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %t.i173)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(56) %t.i173, ptr noundef nonnull align 8 dereferenceable(56) %arrayidx.us.i181, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %arrayidx.us.i181, ptr noundef nonnull align 8 dereferenceable(56) %gep.i, i64 56, i1 false), !tbaa.struct !10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %gep.i, ptr noundef nonnull align 4 dereferenceable(56) %t.i173, i64 56, i1 false), !tbaa.struct !10
call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %t.i173)
br label %for.inc.us.i184
for.inc.us.i184: ; preds = %if.then.us.i183, %for.body3.us.i179
%indvars.iv.next.i185 = add nuw nsw i64 %indvars.iv.i180, 1
%exitcond.not.i186 = icmp eq i64 %indvars.iv.next.i185, %wide.trip.count.i176
br i1 %exitcond.not.i186, label %for.cond1.for.inc19_crit_edge.us.i187, label %for.body3.us.i179, !llvm.loop !20
for.cond1.for.inc19_crit_edge.us.i187: ; preds = %for.inc.us.i184
%inc20.us.i188 = add nuw nsw i32 %i.039.us.i178, 1
%exitcond43.not.i189 = icmp eq i32 %i.039.us.i178, %39
br i1 %exitcond43.not.i189, label %sort_t.exit, label %for.cond1.preheader.us.i177, !llvm.loop !21
sort_t.exit: ; preds = %for.cond1.for.inc19_crit_edge.us.i187, %while.end93
%cmp98 = icmp slt i32 %add56, %38
br i1 %cmp98, label %for.cond102.preheader, label %while.cond81
for.cond102.preheader: ; preds = %sort_t.exit
%cmp103.not197 = icmp slt i32 %25, 1
br i1 %cmp103.not197, label %while.body.loopexit, label %for.body104
for.body104: ; preds = %for.cond102.preheader, %for.body104
%indvars.iv213 = phi i64 [ %indvars.iv.next214, %for.body104 ], [ 1, %for.cond102.preheader ]
%arrayidx106 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv213
%42 = load i32, ptr %arrayidx106, align 8, !tbaa !19
%correct_n110 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv213, i32 1
%43 = load i32, ptr %correct_n110, align 4, !tbaa !5
%penalty113 = getelementptr inbounds [51 x %struct.team], ptr @teams, i64 0, i64 %indvars.iv213, i32 3
%44 = load i32, ptr %penalty113, align 4, !tbaa !16
%call114 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %42, i32 noundef %43, i32 noundef %44)
%indvars.iv.next214 = add nuw nsw i64 %indvars.iv213, 1
%45 = load i32, ptr @T, align 4, !tbaa !11
%46 = sext i32 %45 to i64
%cmp103.not.not = icmp slt i64 %indvars.iv213, %46
br i1 %cmp103.not.not, label %for.body104, label %while.body.loopexit, !llvm.loop !26
while.end119: ; preds = %while.body.loopexit, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5
; 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 = { 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 nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind willreturn memory(argmem: read) }
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, !7, i64 4}
!6 = !{!"team", !7, i64 0, !7, i64 4, !8, i64 8, !7, i64 52}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 44, !12, i64 52, i64 4, !11}
!11 = !{!7, !7, i64 0}
!12 = !{!8, !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!6, !7, i64 52}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = !{!6, !7, i64 0}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}
|
#include "stdio.h"
int main(){
int i,j,c1,c2,c3,c4,b=1;
scanf("%d%d%d%d",&c1,&c2,&c3,&c4);
if(c1!=c4) b=0;
if(c3!=0&&c1==0&&c4==0) b=0;
if(b) printf("1");
else printf("0");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25425/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25425/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c1 = alloca i32, align 4
%c2 = alloca i32, align 4
%c3 = alloca i32, align 4
%c4 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c3) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c4) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c1, ptr noundef nonnull %c2, ptr noundef nonnull %c3, ptr noundef nonnull %c4)
%0 = load i32, ptr %c1, align 4
%1 = load i32, ptr %c4, align 4
%cmp.not = icmp ne i32 %0, %1
%2 = load i32, ptr %c3, align 4, !tbaa !5
%cmp1 = icmp ne i32 %2, 0
%cmp2 = icmp eq i32 %0, 0
%or.cond.not.not = select i1 %cmp1, i1 %cmp2, i1 false
%cmp4 = icmp eq i32 %1, 0
%or.cond11 = select i1 %or.cond.not.not, i1 %cmp4, i1 false
%narrow = select i1 %or.cond11, i1 true, i1 %cmp.not
%. = select i1 %narrow, i32 48, i32 49
%putchar = call i32 @putchar(i32 %.)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c4) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c3) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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"}
|
#include <stdio.h>
#include <math.h>
int main(void){
int x;
scanf("%d",&x);
for(int i=-1000; i<1000; i++){
for(int j=-1000; j<1000; j++){
if(pow(i,5)-pow(j,5)==x){
printf("%d %d\n",i,j);
return 0;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254293/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254293/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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)
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc12
%i.029 = phi i32 [ -1000, %entry ], [ %inc13, %for.inc12 ]
%conv = sitofp i32 %i.029 to double
br label %for.body4
for.body4: ; preds = %for.inc.1, %for.cond1.preheader
%j.028 = phi i32 [ -1000, %for.cond1.preheader ], [ %inc.1, %for.inc.1 ]
%call5 = call double @pow(double noundef %conv, double noundef 5.000000e+00) #4
%conv6 = sitofp i32 %j.028 to double
%call7 = call double @pow(double noundef %conv6, double noundef 5.000000e+00) #4
%sub = fsub double %call5, %call7
%0 = load i32, ptr %x, align 4, !tbaa !5
%conv8 = sitofp i32 %0 to double
%cmp9 = fcmp oeq double %sub, %conv8
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.inc, %for.body4
%j.028.lcssa = phi i32 [ %j.028, %for.body4 ], [ %inc, %for.inc ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.029, i32 noundef %j.028.lcssa)
br label %cleanup17
for.inc: ; preds = %for.body4
%inc = or i32 %j.028, 1
%call5.1 = call double @pow(double noundef %conv, double noundef 5.000000e+00) #4
%conv6.1 = sitofp i32 %inc to double
%call7.1 = call double @pow(double noundef %conv6.1, double noundef 5.000000e+00) #4
%sub.1 = fsub double %call5.1, %call7.1
%1 = load i32, ptr %x, align 4, !tbaa !5
%conv8.1 = sitofp i32 %1 to double
%cmp9.1 = fcmp oeq double %sub.1, %conv8.1
br i1 %cmp9.1, label %if.then, label %for.inc.1
for.inc.1: ; preds = %for.inc
%inc.1 = add nsw i32 %j.028, 2
%exitcond.1 = icmp eq i32 %inc.1, 1000
br i1 %exitcond.1, label %for.inc12, label %for.body4, !llvm.loop !9
for.inc12: ; preds = %for.inc.1
%inc13 = add nsw i32 %i.029, 1
%exitcond32 = icmp eq i32 %inc13, 1000
br i1 %exitcond32, label %cleanup17, label %for.cond1.preheader, !llvm.loop !11
cleanup17: ; preds = %for.inc12, %if.then
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 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
int i, j, n, a, b;
long long int x, c[2000];
scanf("%d", &x);
for( i = 0; i < 2000; i++ ){
c[i] = pow(i, 5.0);
}
for( i = 0; i < 2000; i++ ){
for( j = 0; j <= i; j++ ){
if( c[i] - c[j] == x ){
printf("%d %d\n", i, j);
return 0;
}
}
}
for( i = 0; i < 2000; i++ ){
for( j = 0; j < 2000; j++ ){
if( c[i] + c[j] == x ){
printf("%d %d\n", i, -1*j);
return 0;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254336/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254336/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
%c = alloca [2000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 16000, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
br label %for.body
for.cond3.preheader: ; preds = %for.body
%0 = load i64, ptr %x, align 8, !tbaa !5
br label %for.cond7.preheader
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body ]
%1 = trunc i64 %indvars.iv to i32
%conv = sitofp i32 %1 to double
%call1 = call double @pow(double noundef %conv, double noundef 5.000000e+00) #4
%conv2 = fptosi double %call1 to i64
%arrayidx = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv
store i64 %conv2, ptr %arrayidx, align 16, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%2 = trunc i64 %indvars.iv.next to i32
%conv.1 = sitofp i32 %2 to double
%call1.1 = call double @pow(double noundef %conv.1, double noundef 5.000000e+00) #4
%conv2.1 = fptosi double %call1.1 to i64
%arrayidx.1 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv.next
store i64 %conv2.1, ptr %arrayidx.1, align 8, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%3 = trunc i64 %indvars.iv.next.1 to i32
%conv.2 = sitofp i32 %3 to double
%call1.2 = call double @pow(double noundef %conv.2, double noundef 5.000000e+00) #4
%conv2.2 = fptosi double %call1.2 to i64
%arrayidx.2 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv.next.1
store i64 %conv2.2, ptr %arrayidx.2, align 16, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%4 = trunc i64 %indvars.iv.next.2 to i32
%conv.3 = sitofp i32 %4 to double
%call1.3 = call double @pow(double noundef %conv.3, double noundef 5.000000e+00) #4
%conv2.3 = fptosi double %call1.3 to i64
%arrayidx.3 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv.next.2
store i64 %conv2.3, ptr %arrayidx.3, align 8, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 2000
br i1 %exitcond.not.3, label %for.cond3.preheader, label %for.body, !llvm.loop !9
for.cond7.preheader: ; preds = %for.inc21.1, %for.cond3.preheader
%indvars.iv94 = phi i64 [ 0, %for.cond3.preheader ], [ %indvars.iv.next95.1, %for.inc21.1 ]
%indvars.iv92 = phi i64 [ 1, %for.cond3.preheader ], [ %indvars.iv.next93.1, %for.inc21.1 ]
%arrayidx12 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv94
%5 = load i64, ptr %arrayidx12, align 16, !tbaa !5
br label %for.body10
for.body10: ; preds = %for.cond7.preheader, %for.inc18
%indvars.iv86 = phi i64 [ 0, %for.cond7.preheader ], [ %indvars.iv.next87, %for.inc18 ]
%arrayidx14 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv86
%6 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%sub = sub nsw i64 %5, %6
%cmp15 = icmp eq i64 %sub, %0
br i1 %cmp15, label %if.then, label %for.inc18
if.then: ; preds = %for.body10.1, %for.body10
%indvars.iv94.lcssa = phi i64 [ %indvars.iv94, %for.body10 ], [ %indvars.iv.next95, %for.body10.1 ]
%indvars.iv86.lcssa = phi i64 [ %indvars.iv86, %for.body10 ], [ %indvars.iv86.1, %for.body10.1 ]
%7 = trunc i64 %indvars.iv94.lcssa to i32
%8 = trunc i64 %indvars.iv86.lcssa to i32
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7, i32 noundef %8)
br label %cleanup
for.inc18: ; preds = %for.body10
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%exitcond91.not = icmp eq i64 %indvars.iv.next87, %indvars.iv92
br i1 %exitcond91.not, label %for.inc21, label %for.body10, !llvm.loop !11
for.inc21: ; preds = %for.inc18
%indvars.iv.next95 = or i64 %indvars.iv94, 1
%arrayidx12.1 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv.next95
%9 = load i64, ptr %arrayidx12.1, align 8, !tbaa !5
br label %for.body10.1
for.body10.1: ; preds = %for.inc18.1, %for.inc21
%indvars.iv86.1 = phi i64 [ 0, %for.inc21 ], [ %indvars.iv.next87.1, %for.inc18.1 ]
%arrayidx14.1 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv86.1
%10 = load i64, ptr %arrayidx14.1, align 8, !tbaa !5
%sub.1 = sub nsw i64 %9, %10
%cmp15.1 = icmp eq i64 %sub.1, %0
br i1 %cmp15.1, label %if.then, label %for.inc18.1
for.inc18.1: ; preds = %for.body10.1
%indvars.iv.next87.1 = add nuw nsw i64 %indvars.iv86.1, 1
%exitcond91.not.1 = icmp eq i64 %indvars.iv86.1, %indvars.iv92
br i1 %exitcond91.not.1, label %for.inc21.1, label %for.body10.1, !llvm.loop !11
for.inc21.1: ; preds = %for.inc18.1
%indvars.iv.next95.1 = add nuw nsw i64 %indvars.iv94, 2
%indvars.iv.next93.1 = add nuw nsw i64 %indvars.iv92, 2
%exitcond99.not.1 = icmp eq i64 %indvars.iv.next95.1, 2000
br i1 %exitcond99.not.1, label %for.cond28.preheader, label %for.cond7.preheader, !llvm.loop !12
for.cond28.preheader: ; preds = %for.inc21.1, %for.inc44
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.inc44 ], [ 0, %for.inc21.1 ]
%arrayidx33 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv104
%11 = load i64, ptr %arrayidx33, align 8, !tbaa !5
br label %for.body31
for.body31: ; preds = %for.inc41.4, %for.cond28.preheader
%indvars.iv100 = phi i64 [ 0, %for.cond28.preheader ], [ %indvars.iv.next101.4, %for.inc41.4 ]
%arrayidx35 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv100
%12 = load i64, ptr %arrayidx35, align 8, !tbaa !5
%add = add nsw i64 %12, %11
%cmp36 = icmp eq i64 %add, %0
br i1 %cmp36, label %if.then38, label %for.inc41
if.then38: ; preds = %for.inc41.3, %for.inc41.2, %for.inc41.1, %for.inc41, %for.body31
%indvars.iv100.lcssa = phi i64 [ %indvars.iv100, %for.body31 ], [ %indvars.iv.next101, %for.inc41 ], [ %indvars.iv.next101.1, %for.inc41.1 ], [ %indvars.iv.next101.2, %for.inc41.2 ], [ %indvars.iv.next101.3, %for.inc41.3 ]
%13 = trunc i64 %indvars.iv104 to i32
%14 = trunc i64 %indvars.iv100.lcssa to i32
%mul = sub nsw i32 0, %14
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13, i32 noundef %mul)
br label %cleanup
for.inc41: ; preds = %for.body31
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%arrayidx35.1 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv.next101
%15 = load i64, ptr %arrayidx35.1, align 8, !tbaa !5
%add.1 = add nsw i64 %15, %11
%cmp36.1 = icmp eq i64 %add.1, %0
br i1 %cmp36.1, label %if.then38, label %for.inc41.1
for.inc41.1: ; preds = %for.inc41
%indvars.iv.next101.1 = add nuw nsw i64 %indvars.iv100, 2
%arrayidx35.2 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv.next101.1
%16 = load i64, ptr %arrayidx35.2, align 8, !tbaa !5
%add.2 = add nsw i64 %16, %11
%cmp36.2 = icmp eq i64 %add.2, %0
br i1 %cmp36.2, label %if.then38, label %for.inc41.2
for.inc41.2: ; preds = %for.inc41.1
%indvars.iv.next101.2 = add nuw nsw i64 %indvars.iv100, 3
%arrayidx35.3 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv.next101.2
%17 = load i64, ptr %arrayidx35.3, align 8, !tbaa !5
%add.3 = add nsw i64 %17, %11
%cmp36.3 = icmp eq i64 %add.3, %0
br i1 %cmp36.3, label %if.then38, label %for.inc41.3
for.inc41.3: ; preds = %for.inc41.2
%indvars.iv.next101.3 = add nuw nsw i64 %indvars.iv100, 4
%arrayidx35.4 = getelementptr inbounds [2000 x i64], ptr %c, i64 0, i64 %indvars.iv.next101.3
%18 = load i64, ptr %arrayidx35.4, align 8, !tbaa !5
%add.4 = add nsw i64 %18, %11
%cmp36.4 = icmp eq i64 %add.4, %0
br i1 %cmp36.4, label %if.then38, label %for.inc41.4
for.inc41.4: ; preds = %for.inc41.3
%indvars.iv.next101.4 = add nuw nsw i64 %indvars.iv100, 5
%exitcond103.not.4 = icmp eq i64 %indvars.iv.next101.4, 2000
br i1 %exitcond103.not.4, label %for.inc44, label %for.body31, !llvm.loop !13
for.inc44: ; preds = %for.inc41.4
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%exitcond107.not = icmp eq i64 %indvars.iv.next105, 2000
br i1 %exitcond107.not, label %cleanup, label %for.cond28.preheader, !llvm.loop !14
cleanup: ; preds = %for.inc44, %if.then38, %if.then
call void @llvm.lifetime.end.p0(i64 16000, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main()
{
int i, N, K;
long long a[100001];
scanf("%d %d", &N, &K);
for (i = 1; i <= N; i++) scanf("%lld", &(a[i]));
long long sum[2][100001], max = 0, tmp;
for (i = 1, sum[0][0] = 0, sum[1][0] = 0; i <= N; i++) {
sum[0][i] = sum[0][i-1] + a[i];
sum[1][i] = sum[1][i-1] + ((a[i] > 0)? a[i]: 0);
}
for (i = 1; i <= N - K + 1; i++) {
tmp = (sum[0][i+K-1] > sum[0][i-1])? sum[0][i+K-1] - sum[0][i-1]: 0;
if (sum[1][i-1] + sum[1][N] - sum[1][i+K-1] + tmp > max) max = sum[1][i-1] + sum[1][N] - sum[1][i+K-1] + tmp;
}
printf("%lld\n", max);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254408/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\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
%K = alloca i32, align 4
%a = alloca [100001 x i64], align 16
%sum = alloca [2 x [100001 x i64]], 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 800008, 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
%cmp.not125 = icmp slt i32 %0, 1
br i1 %cmp.not125, label %for.end.thread, label %for.body
for.end.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 1600016, ptr nonnull %sum) #4
store i64 0, ptr %sum, align 16, !tbaa !9
%arrayidx4147 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1
store i64 0, ptr %arrayidx4147, align 8, !tbaa !9
br label %for.end.for.cond33.preheader_crit_edge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100001 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
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 1600016, ptr nonnull %sum) #4
store i64 0, ptr %sum, align 16, !tbaa !9
%arrayidx4 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1
store i64 0, ptr %arrayidx4, align 8, !tbaa !9
%cmp7.not127 = icmp slt i32 %1, 1
br i1 %cmp7.not127, label %for.end.for.cond33.preheader_crit_edge, label %for.body8.preheader
for.end.for.cond33.preheader_crit_edge: ; preds = %for.end.thread, %for.end
%.lcssa150 = phi i32 [ %0, %for.end.thread ], [ %1, %for.end ]
%.pre = add nsw i32 %.lcssa150, 1
br label %for.cond33.preheader
for.body8.preheader: ; preds = %for.end
%3 = add nuw i32 %1, 1
%4 = zext i32 %1 to i64
%xtraiter = and i64 %4, 1
%5 = icmp eq i32 %3, 2
br i1 %5, label %for.cond33.preheader.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %4, 4294967294
br label %for.body8
for.cond33.preheader.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%.unr = phi i64 [ 0, %for.body8.preheader ], [ %add26.1, %for.body8 ]
%.unr161 = phi i64 [ 0, %for.body8.preheader ], [ %add.1, %for.body8 ]
%indvars.iv135.unr = phi i64 [ 1, %for.body8.preheader ], [ %indvars.iv.next136.1, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond33.preheader, label %for.body8.epil
for.body8.epil: ; preds = %for.cond33.preheader.loopexit.unr-lcssa
%arrayidx13.epil = getelementptr inbounds [100001 x i64], ptr %a, i64 0, i64 %indvars.iv135.unr
%6 = load i64, ptr %arrayidx13.epil, align 8, !tbaa !9
%add.epil = add nsw i64 %6, %.unr161
%arrayidx16.epil = getelementptr inbounds [100001 x i64], ptr %sum, i64 0, i64 %indvars.iv135.unr
store i64 %add.epil, ptr %arrayidx16.epil, align 8, !tbaa !9
%spec.select.epil = call i64 @llvm.smax.i64(i64 %6, i64 0)
%add26.epil = add nuw nsw i64 %.unr, %spec.select.epil
%arrayidx29.epil = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1, i64 %indvars.iv135.unr
store i64 %add26.epil, ptr %arrayidx29.epil, align 8, !tbaa !9
br label %for.cond33.preheader
for.cond33.preheader: ; preds = %for.body8.epil, %for.cond33.preheader.loopexit.unr-lcssa, %for.end.for.cond33.preheader_crit_edge
%.lcssa149 = phi i32 [ %.lcssa150, %for.end.for.cond33.preheader_crit_edge ], [ %1, %for.cond33.preheader.loopexit.unr-lcssa ], [ %1, %for.body8.epil ]
%sub34.pre-phi = phi i32 [ %.pre, %for.end.for.cond33.preheader_crit_edge ], [ %3, %for.cond33.preheader.loopexit.unr-lcssa ], [ %3, %for.body8.epil ]
%7 = load i32, ptr %K, align 4, !tbaa !5
%add35 = sub i32 %sub34.pre-phi, %7
%cmp36.not129 = icmp slt i32 %add35, 1
br i1 %cmp36.not129, label %for.end95, label %for.body37.lr.ph
for.body37.lr.ph: ; preds = %for.cond33.preheader
%idxprom67 = sext i32 %.lcssa149 to i64
%arrayidx68 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1, i64 %idxprom67
%8 = load i64, ptr %arrayidx68, align 8, !tbaa !9
%9 = add i32 %.lcssa149, 2
%10 = sub i32 %9, %7
%wide.trip.count144 = zext i32 %10 to i64
%11 = add nsw i64 %wide.trip.count144, -1
%min.iters.check = icmp ult i64 %11, 4
br i1 %min.iters.check, label %for.body37.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body37.lr.ph
%12 = add nsw i64 %wide.trip.count144, -2
%13 = trunc i64 %12 to i32
%14 = add i32 %7, %13
%15 = icmp slt i32 %14, %7
%16 = icmp ugt i64 %12, 4294967295
%17 = or i1 %15, %16
br i1 %17, label %for.body37.preheader, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %11, -4
%ind.end = or i64 %n.vec, 1
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %8, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %41, %vector.body ]
%vec.phi151 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %42, %vector.body ]
%18 = trunc i64 %index to i32
%19 = add i32 %7, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [100001 x i64], ptr %sum, i64 0, i64 %20
%wide.load = load <2 x i64>, ptr %21, align 8, !tbaa !9
%22 = getelementptr inbounds i64, ptr %21, i64 2
%wide.load152 = load <2 x i64>, ptr %22, align 8, !tbaa !9
%23 = getelementptr inbounds [100001 x i64], ptr %sum, i64 0, i64 %index
%wide.load153 = load <2 x i64>, ptr %23, align 16, !tbaa !9
%24 = getelementptr inbounds i64, ptr %23, i64 2
%wide.load154 = load <2 x i64>, ptr %24, align 16, !tbaa !9
%25 = icmp sgt <2 x i64> %wide.load, %wide.load153
%26 = icmp sgt <2 x i64> %wide.load152, %wide.load154
%27 = sub nsw <2 x i64> %wide.load, %wide.load153
%28 = sub nsw <2 x i64> %wide.load152, %wide.load154
%29 = select <2 x i1> %25, <2 x i64> %27, <2 x i64> zeroinitializer
%30 = select <2 x i1> %26, <2 x i64> %28, <2 x i64> zeroinitializer
%31 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1, i64 %index
%wide.load155 = load <2 x i64>, ptr %31, align 8, !tbaa !9
%32 = getelementptr inbounds i64, ptr %31, i64 2
%wide.load156 = load <2 x i64>, ptr %32, align 8, !tbaa !9
%33 = add nsw <2 x i64> %broadcast.splat, %wide.load155
%34 = add nsw <2 x i64> %broadcast.splat, %wide.load156
%35 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1, i64 %20
%wide.load157 = load <2 x i64>, ptr %35, align 8, !tbaa !9
%36 = getelementptr inbounds i64, ptr %35, i64 2
%wide.load158 = load <2 x i64>, ptr %36, align 8, !tbaa !9
%37 = add <2 x i64> %33, %29
%38 = add <2 x i64> %34, %30
%39 = sub <2 x i64> %37, %wide.load157
%40 = sub <2 x i64> %38, %wide.load158
%41 = call <2 x i64> @llvm.smax.v2i64(<2 x i64> %39, <2 x i64> %vec.phi)
%42 = call <2 x i64> @llvm.smax.v2i64(<2 x i64> %40, <2 x i64> %vec.phi151)
%index.next = add nuw i64 %index, 4
%43 = icmp eq i64 %index.next, %n.vec
br i1 %43, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%rdx.minmax = call <2 x i64> @llvm.smax.v2i64(<2 x i64> %41, <2 x i64> %42)
%44 = call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %11, %n.vec
br i1 %cmp.n, label %for.end95, label %for.body37.preheader
for.body37.preheader: ; preds = %vector.scevcheck, %for.body37.lr.ph, %middle.block
%indvars.iv139.ph = phi i64 [ 1, %vector.scevcheck ], [ 1, %for.body37.lr.ph ], [ %ind.end, %middle.block ]
%max.0130.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %for.body37.lr.ph ], [ %44, %middle.block ]
br label %for.body37
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%45 = phi i64 [ 0, %for.body8.preheader.new ], [ %add26.1, %for.body8 ]
%46 = phi i64 [ 0, %for.body8.preheader.new ], [ %add.1, %for.body8 ]
%indvars.iv135 = phi i64 [ 1, %for.body8.preheader.new ], [ %indvars.iv.next136.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.1, %for.body8 ]
%arrayidx13 = getelementptr inbounds [100001 x i64], ptr %a, i64 0, i64 %indvars.iv135
%47 = load i64, ptr %arrayidx13, align 8, !tbaa !9
%add = add nsw i64 %47, %46
%arrayidx16 = getelementptr inbounds [100001 x i64], ptr %sum, i64 0, i64 %indvars.iv135
store i64 %add, ptr %arrayidx16, align 8, !tbaa !9
%spec.select = call i64 @llvm.smax.i64(i64 %47, i64 0)
%add26 = add nuw nsw i64 %45, %spec.select
%arrayidx29 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1, i64 %indvars.iv135
store i64 %add26, ptr %arrayidx29, align 8, !tbaa !9
%indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
%arrayidx13.1 = getelementptr inbounds [100001 x i64], ptr %a, i64 0, i64 %indvars.iv.next136
%48 = load i64, ptr %arrayidx13.1, align 8, !tbaa !9
%add.1 = add nsw i64 %48, %add
%arrayidx16.1 = getelementptr inbounds [100001 x i64], ptr %sum, i64 0, i64 %indvars.iv.next136
store i64 %add.1, ptr %arrayidx16.1, align 8, !tbaa !9
%spec.select.1 = call i64 @llvm.smax.i64(i64 %48, i64 0)
%add26.1 = add nuw nsw i64 %add26, %spec.select.1
%arrayidx29.1 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1, i64 %indvars.iv.next136
store i64 %add26.1, ptr %arrayidx29.1, align 8, !tbaa !9
%indvars.iv.next136.1 = add nuw nsw i64 %indvars.iv135, 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.cond33.preheader.loopexit.unr-lcssa, label %for.body8, !llvm.loop !16
for.body37: ; preds = %for.body37.preheader, %for.body37
%indvars.iv139 = phi i64 [ %indvars.iv.next140, %for.body37 ], [ %indvars.iv139.ph, %for.body37.preheader ]
%max.0130 = phi i64 [ %max.1, %for.body37 ], [ %max.0130.ph, %for.body37.preheader ]
%49 = add nsw i64 %indvars.iv139, -1
%50 = trunc i64 %49 to i32
%sub40 = add i32 %7, %50
%idxprom41 = sext i32 %sub40 to i64
%arrayidx42 = getelementptr inbounds [100001 x i64], ptr %sum, i64 0, i64 %idxprom41
%51 = load i64, ptr %arrayidx42, align 8, !tbaa !9
%arrayidx46 = getelementptr inbounds [100001 x i64], ptr %sum, i64 0, i64 %49
%52 = load i64, ptr %arrayidx46, align 8, !tbaa !9
%cmp47 = icmp sgt i64 %51, %52
%sub58 = sub nsw i64 %51, %52
%spec.select123 = select i1 %cmp47, i64 %sub58, i64 0
%arrayidx65 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1, i64 %49
%53 = load i64, ptr %arrayidx65, align 8, !tbaa !9
%add69 = add nsw i64 %8, %53
%arrayidx74 = getelementptr inbounds [2 x [100001 x i64]], ptr %sum, i64 0, i64 1, i64 %idxprom41
%54 = load i64, ptr %arrayidx74, align 8, !tbaa !9
%sub75 = add i64 %add69, %spec.select123
%add76 = sub i64 %sub75, %54
%max.1 = call i64 @llvm.smax.i64(i64 %add76, i64 %max.0130)
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%exitcond145.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count144
br i1 %exitcond145.not, label %for.end95, label %for.body37, !llvm.loop !17
for.end95: ; preds = %for.body37, %middle.block, %for.cond33.preheader
%max.0.lcssa = phi i64 [ 0, %for.cond33.preheader ], [ %44, %middle.block ], [ %max.1, %for.body37 ]
%call96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %max.0.lcssa)
%55 = load ptr, ptr @stdout, align 8, !tbaa !18
%call97 = call i32 @fflush(ptr noundef %55)
call void @llvm.lifetime.end.p0(i64 1600016, ptr nonnull %sum) #4
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %a) #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: 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !14}
!18 = !{!19, !19, i64 0}
!19 = !{!"any pointer", !7, i64 0}
|
#include<stdio.h>
#include<math.h>
int main(){
int x, h;
double s;
while(1){
scanf("%d %d", &x, &h);
if(x == 0 && h == 0) break;
s = x * x * 1.0;
s += hypot(x/2.0, h) * x * 2;
printf("%f\n", s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254451/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254451/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %h)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp12 = icmp eq i32 %0, 0
%1 = load i32, ptr %h, align 4
%cmp113 = icmp eq i32 %1, 0
%or.cond14 = select i1 %cmp12, i1 %cmp113, i1 false
br i1 %or.cond14, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%2 = phi i32 [ %7, %if.end ], [ %1, %entry ]
%3 = phi i32 [ %6, %if.end ], [ %0, %entry ]
%mul = mul nsw i32 %3, %3
%conv = sitofp i32 %mul to double
%conv3 = sitofp i32 %3 to double
%div = fmul double %conv3, 5.000000e-01
%conv4 = sitofp i32 %2 to double
%call5 = call double @hypot(double noundef %div, double noundef %conv4) #5
%4 = load i32, ptr %x, align 4, !tbaa !5
%conv6 = sitofp i32 %4 to double
%mul7 = fmul double %call5, %conv6
%5 = call double @llvm.fmuladd.f64(double %mul7, double 2.000000e+00, double %conv)
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %5)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %h)
%6 = load i32, ptr %x, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %h, align 4
%cmp1 = icmp eq i32 %7, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind
declare double @hypot(double noundef, double noundef) local_unnamed_addr #3
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 "no-trapping-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>
#include <math.h>
int main(void) {
int x,h;
double s;
double th;
while(1) {
scanf("%d",&x);
scanf("%d",&h);
if(x==0 && h==0)break;
th=sqrt(h*h+((double)x/2)*((double)x/2));
s=th*(double)x*4.0/2.0+(double)x*(double)x;
printf("%f\n",s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254495/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254495/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%call117 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp18 = icmp eq i32 %0, 0
%1 = load i32, ptr %h, align 4
%cmp219 = icmp eq i32 %1, 0
%or.cond20 = select i1 %cmp18, i1 %cmp219, i1 false
br i1 %or.cond20, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%2 = phi i32 [ %8, %if.end ], [ %1, %entry ]
%3 = phi i32 [ %7, %if.end ], [ %0, %entry ]
%mul = mul nsw i32 %2, %2
%conv = sitofp i32 %mul to double
%conv3 = sitofp i32 %3 to double
%div = fmul double %conv3, 5.000000e-01
%4 = call double @llvm.fmuladd.f64(double %div, double %div, double %conv)
%call7 = call double @sqrt(double noundef %4) #5
%5 = load i32, ptr %x, align 4, !tbaa !5
%conv8 = sitofp i32 %5 to double
%mul9 = fmul double %call7, %conv8
%mul10 = fmul double %mul9, 4.000000e+00
%div11 = fmul double %mul10, 5.000000e-01
%6 = call double @llvm.fmuladd.f64(double %conv8, double %conv8, double %div11)
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %6)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%7 = load i32, ptr %x, align 4, !tbaa !5
%cmp = icmp eq i32 %7, 0
%8 = load i32, ptr %h, align 4
%cmp2 = icmp eq i32 %8, 0
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; 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 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 = { 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 SR(int v)
{
int t;
for (t = 1; t * t < v; t++);
return t;
}
int main()
{
int i;
int T;
int n;
int t;
int temp;
char R;
scanf("%d", &T);
while (T--)
{
scanf("%d", &n);
R = 0;
for (i = 0; i < n; i++)
{
scanf("%d", &temp);
t = SR(temp);
if (t * t > temp)
{
R = 1;
}
}
if (R)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25456/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25456/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @SR(i32 noundef %v) local_unnamed_addr #0 {
entry:
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%t.0 = phi i32 [ 1, %entry ], [ %inc, %for.cond ]
%mul = mul nsw i32 %t.0, %t.0
%cmp = icmp slt i32 %mul, %v
%inc = add nuw nsw i32 %t.0, 1
br i1 %cmp, label %for.cond, label %for.end, !llvm.loop !5
for.end: ; preds = %for.cond
ret i32 %t.0
}
; 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:
%T = alloca i32, align 4
%n = alloca i32, align 4
%temp = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%0 = load i32, ptr %T, align 4, !tbaa !7
%dec16 = add nsw i32 %0, -1
store i32 %dec16, ptr %T, align 4, !tbaa !7
%tobool.not17 = icmp eq i32 %0, 0
br i1 %tobool.not17, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end9
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !7
%cmp13 = icmp sgt i32 %1, 0
br i1 %cmp13, label %for.body, label %if.else
for.body: ; preds = %while.body, %SR.exit
%R.015 = phi i8 [ %spec.select, %SR.exit ], [ 0, %while.body ]
%i.014 = phi i32 [ %inc, %SR.exit ], [ 0, %while.body ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %temp)
%2 = load i32, ptr %temp, align 4, !tbaa !7
br label %for.cond.i
for.cond.i: ; preds = %for.cond.i, %for.body
%t.0.i = phi i32 [ 1, %for.body ], [ %inc.i, %for.cond.i ]
%mul.i = mul nsw i32 %t.0.i, %t.0.i
%cmp.i = icmp slt i32 %mul.i, %2
%inc.i = add nuw nsw i32 %t.0.i, 1
br i1 %cmp.i, label %for.cond.i, label %SR.exit, !llvm.loop !5
SR.exit: ; preds = %for.cond.i
%cmp4 = icmp sgt i32 %mul.i, %2
%spec.select = select i1 %cmp4, i8 1, i8 %R.015
%inc = add nuw nsw i32 %i.014, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %SR.exit
%tobool5.not = icmp eq i8 %spec.select, 0
br i1 %tobool5.not, label %if.else, label %if.end9
if.else: ; preds = %while.body, %for.end
br label %if.end9
if.end9: ; preds = %for.end, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %for.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%4 = load i32, ptr %T, align 4, !tbaa !7
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %T, align 4, !tbaa !7
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end9, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
|
#include<stdio.h>
int main(){
int h,w,i,l,n,c;
int r[10000];
while(scanf("%d%d%d",&h,&w,&i),h+w+i){
scanf("%d",&n);
for(l=0;l<n;l++)scanf("%d",&r[l]);
if(h<i){
if(i<w) c=h*h+i*i;
else c=h*h+w*w;
}else if(i<w){
if(w<h) c=w*w+i*i;
else c=h*h+i*i;
}else if(w<h){
if(i<h) c=w*w+i*i;
else c=h*h+w*w;
}
for(l=0;l<n;l++){
if(r[l]*r[l]*4<=c)puts("NA");
else puts("OK");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254602/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254602/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NA\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"OK\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
%i = alloca i32, align 4
%n = alloca i32, align 4
%r = alloca [10000 x i32], 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %r) #3
%call73 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %i)
%0 = load i32, ptr %h, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%add74 = add nsw i32 %1, %0
%2 = load i32, ptr %i, align 4, !tbaa !5
%add175 = sub i32 0, %2
%tobool.not76 = icmp eq i32 %add74, %add175
br i1 %tobool.not76, label %while.end, label %while.body
while.cond.loopexit: ; preds = %for.body43, %if.end40
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %i)
%3 = load i32, ptr %h, align 4, !tbaa !5
%4 = load i32, ptr %w, align 4, !tbaa !5
%add = add nsw i32 %4, %3
%5 = load i32, ptr %i, align 4, !tbaa !5
%add1 = sub i32 0, %5
%tobool.not = icmp eq i32 %add, %add1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.body: ; preds = %entry, %while.cond.loopexit
%c.077 = phi i32 [ %c.1, %while.cond.loopexit ], [ undef, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp69 = icmp sgt i32 %6, 0
br i1 %cmp69, label %for.body, label %for.end
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %r, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %while.body
%9 = phi i32 [ %6, %while.body ], [ %7, %for.body ]
%10 = load i32, ptr %h, align 4, !tbaa !5
%11 = load i32, ptr %i, align 4, !tbaa !5
%cmp4 = icmp slt i32 %10, %11
%12 = load i32, ptr %w, align 4, !tbaa !5
%cmp5 = icmp slt i32 %11, %12
br i1 %cmp4, label %if.then, label %if.else12
if.then: ; preds = %for.end
%mul = mul nsw i32 %10, %10
br i1 %cmp5, label %if.then6, label %if.else
if.then6: ; preds = %if.then
%mul7 = mul nsw i32 %11, %11
%add8 = add nuw nsw i32 %mul7, %mul
br label %if.end40
if.else: ; preds = %if.then
%mul10 = mul nsw i32 %12, %12
%add11 = add nuw nsw i32 %mul10, %mul
br label %if.end40
if.else12: ; preds = %for.end
%cmp15 = icmp slt i32 %12, %10
br i1 %cmp5, label %if.then14, label %if.else25
if.then14: ; preds = %if.else12
%mul18 = mul nsw i32 %11, %11
br i1 %cmp15, label %if.then16, label %if.else20
if.then16: ; preds = %if.then14
%mul17 = mul nsw i32 %12, %12
%add19 = add nuw nsw i32 %mul17, %mul18
br label %if.end40
if.else20: ; preds = %if.then14
%mul21 = mul nsw i32 %10, %10
%add23 = add nuw nsw i32 %mul18, %mul21
br label %if.end40
if.else25: ; preds = %if.else12
br i1 %cmp15, label %if.then27, label %if.end40
if.then27: ; preds = %if.else25
%cmp28 = icmp slt i32 %11, %10
br i1 %cmp28, label %if.then29, label %if.else33
if.then29: ; preds = %if.then27
%mul30 = mul nsw i32 %12, %12
%mul31 = mul nsw i32 %11, %11
%add32 = add nuw nsw i32 %mul30, %mul31
br label %if.end40
if.else33: ; preds = %if.then27
%mul34 = mul nsw i32 %10, %10
%mul35 = mul nsw i32 %12, %12
%add36 = add nuw nsw i32 %mul35, %mul34
br label %if.end40
if.end40: ; preds = %if.else20, %if.then16, %if.then29, %if.else33, %if.else25, %if.then6, %if.else
%c.1 = phi i32 [ %add8, %if.then6 ], [ %add11, %if.else ], [ %add19, %if.then16 ], [ %add23, %if.else20 ], [ %add32, %if.then29 ], [ %add36, %if.else33 ], [ %c.077, %if.else25 ]
%cmp4271 = icmp sgt i32 %9, 0
br i1 %cmp4271, label %for.body43, label %while.cond.loopexit
for.body43: ; preds = %if.end40, %for.body43
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body43 ], [ 0, %if.end40 ]
%arrayidx45 = getelementptr inbounds [10000 x i32], ptr %r, i64 0, i64 %indvars.iv79
%13 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%mul48 = shl i32 %13, 2
%mul49 = mul i32 %mul48, %13
%cmp50.not = icmp sgt i32 %mul49, %c.1
%.str.3..str.2 = select i1 %cmp50.not, ptr @.str.3, ptr @.str.2
%call52 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.3..str.2)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp42 = icmp slt i64 %indvars.iv.next80, %15
br i1 %cmp42, label %for.body43, label %while.cond.loopexit, !llvm.loop !12
while.end: ; preds = %while.cond.loopexit, %entry
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %r) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
int main(void)
{
int t,w,h;
int k;
int i,j;
double mininaname;
while(1){
scanf("%d %d %d",&t,&w,&h);
if(t == 0 && w == 0 && h == 0) break;
if(t >= w && t >= h) t = 0;
else if(w >= t && w >= h) w = 0;
else if(h >= t && h >= w) h = 0;
mininaname = sqrt((double)(t * t) + (double)(w * w) + (double)(h * h));
scanf("%d",&k);
int a[k];
for(i = 0; i < k; i++){
scanf("%d",&a[i]);
}
for(i = 0; i < k; i++){
if(a[i] * 2 > mininaname) printf("OK\n");
else printf("NA\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254668/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"OK\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%w = alloca i32, align 4
%h = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
%call64 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %w, ptr noundef nonnull %h)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp65 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp166 = icmp eq i32 %1, 0
%or.cond67 = select i1 %cmp65, i1 %cmp166, i1 false
%2 = load i32, ptr %h, align 4
%cmp368 = icmp eq i32 %2, 0
%or.cond4869 = select i1 %or.cond67, i1 %cmp368, i1 false
br i1 %or.cond4869, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end47
%3 = phi i32 [ %20, %for.end47 ], [ %2, %entry ]
%4 = phi i32 [ %19, %for.end47 ], [ %1, %entry ]
%5 = phi i32 [ %18, %for.end47 ], [ %0, %entry ]
%cmp4.not = icmp slt i32 %5, %4
%cmp6.not = icmp slt i32 %5, %3
%or.cond57 = select i1 %cmp4.not, i1 true, i1 %cmp6.not
br i1 %or.cond57, label %if.else, label %if.then7
if.then7: ; preds = %if.end
store i32 0, ptr %t, align 4, !tbaa !5
br label %if.end19
if.else: ; preds = %if.end
%cmp8.not = icmp slt i32 %4, %5
%cmp10.not = icmp slt i32 %4, %3
%or.cond58 = select i1 %cmp8.not, i1 true, i1 %cmp10.not
br i1 %or.cond58, label %if.else12, label %if.then11
if.then11: ; preds = %if.else
store i32 0, ptr %w, align 4, !tbaa !5
br label %if.end19
if.else12: ; preds = %if.else
%cmp13.not = icmp slt i32 %3, %5
%cmp15.not = icmp slt i32 %3, %4
%or.cond59 = or i1 %cmp13.not, %cmp15.not
br i1 %or.cond59, label %if.end19, label %if.then16
if.then16: ; preds = %if.else12
store i32 0, ptr %h, align 4, !tbaa !5
br label %if.end19
if.end19: ; preds = %if.then11, %if.then16, %if.else12, %if.then7
%6 = phi i32 [ %3, %if.then11 ], [ 0, %if.then16 ], [ %3, %if.else12 ], [ %3, %if.then7 ]
%7 = phi i32 [ 0, %if.then11 ], [ %4, %if.then16 ], [ %4, %if.else12 ], [ %4, %if.then7 ]
%8 = phi i32 [ %5, %if.then11 ], [ %5, %if.then16 ], [ %5, %if.else12 ], [ 0, %if.then7 ]
%mul = mul nsw i32 %8, %8
%conv = sitofp i32 %mul to double
%mul20 = mul nsw i32 %7, %7
%conv21 = sitofp i32 %mul20 to double
%add = fadd double %conv, %conv21
%mul22 = mul nsw i32 %6, %6
%conv23 = sitofp i32 %mul22 to double
%add24 = fadd double %add, %conv23
%call25 = call double @sqrt(double noundef %add24) #6
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%9 = load i32, ptr %k, align 4, !tbaa !5
%10 = zext i32 %9 to i64
%11 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %10, align 16
%12 = load i32, ptr %k, align 4, !tbaa !5
%cmp2760 = icmp sgt i32 %12, 0
br i1 %cmp2760, label %for.body, label %for.end47
for.cond30.preheader: ; preds = %for.body
%cmp3162 = icmp sgt i32 %13, 0
br i1 %cmp3162, label %for.body33, label %for.end47
for.body: ; preds = %if.end19, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end19 ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call29 = 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 %k, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp27 = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp27, label %for.body, label %for.cond30.preheader, !llvm.loop !9
for.body33: ; preds = %for.cond30.preheader, %for.body33
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body33 ], [ 0, %for.cond30.preheader ]
%arrayidx35 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv71
%15 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%mul36 = shl nsw i32 %15, 1
%conv37 = sitofp i32 %mul36 to double
%cmp38 = fcmp olt double %call25, %conv37
%str.4.str = select i1 %cmp38, ptr @str.4, ptr @str
%puts56 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%16 = load i32, ptr %k, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp31 = icmp slt i64 %indvars.iv.next72, %17
br i1 %cmp31, label %for.body33, label %for.end47, !llvm.loop !11
for.end47: ; preds = %for.body33, %if.end19, %for.cond30.preheader
call void @llvm.stackrestore.p0(ptr %11)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %w, ptr noundef nonnull %h)
%18 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp eq i32 %18, 0
%19 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %19, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%20 = load i32, ptr %h, align 4
%cmp3 = icmp eq i32 %20, 0
%or.cond48 = select i1 %or.cond, i1 %cmp3, i1 false
br i1 %or.cond48, label %while.end, label %if.end
while.end: ; preds = %for.end47, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) 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
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
double rnd(double a,int n) {
double b;
b=a*pow(10,n+1);
b=(double)(int)(b+0.5);
return b*pow(10,-n-1);
}
int main(void) {
double a,b,c,d,e,f,D;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF) {
D=a*e-b*d;
printf("%.3f %.3f\n",rnd((e*c-b*f)/(a*e-b*d),4),rnd((a*f-c*d)/(a*e-b*d),4));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254718/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254718/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local double @rnd(double noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %n, 1
%conv = sitofp i32 %add to double
%call = tail call double @pow(double noundef 1.000000e+01, double noundef %conv) #7
%mul = fmul double %call, %a
%add1 = fadd double %mul, 5.000000e-01
%conv2 = fptosi double %add1 to i32
%conv3 = sitofp i32 %conv2 to double
%sub4 = xor i32 %n, -1
%conv5 = sitofp i32 %sub4 to double
%call6 = tail call double @pow(double noundef 1.000000e+01, double noundef %conv5) #7
%mul7 = fmul double %call6, %conv3
ret double %mul7
}
; 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 @pow(double noundef, 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:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #7
%call21 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not22 = icmp eq i32 %call21, -1
br i1 %cmp.not22, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %e, align 8, !tbaa !5
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%4 = fneg double %2
%5 = load double, ptr %c, align 8, !tbaa !5
%6 = load double, ptr %f, align 8, !tbaa !5
%7 = insertelement <2 x double> poison, double %6, i64 0
%8 = insertelement <2 x double> %7, double %3, i64 1
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %1, i64 0
%13 = insertelement <2 x double> %12, double %0, i64 1
%14 = insertelement <2 x double> poison, double %5, i64 0
%15 = insertelement <2 x double> %14, double %1, i64 1
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div = fdiv double %17, %18
%mul.i = fmul double %div, 1.000000e+05
%add1.i = fadd double %mul.i, 5.000000e-01
%conv2.i = fptosi double %add1.i to i32
%conv3.i = sitofp i32 %conv2.i to double
%mul7.i = fmul double %conv3.i, 1.000000e-05
%19 = fneg double %5
%neg8 = fmul double %3, %19
%20 = call double @llvm.fmuladd.f64(double %0, double %6, double %neg8)
%div11 = fdiv double %20, %18
%mul.i15 = fmul double %div11, 1.000000e+05
%add1.i16 = fadd double %mul.i15, 5.000000e-01
%conv2.i17 = fptosi double %add1.i16 to i32
%conv3.i18 = sitofp i32 %conv2.i17 to double
%mul7.i20 = fmul double %conv3.i18, 1.000000e-05
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul7.i, double noundef %mul7.i20)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%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
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #6
attributes #0 = { mustprogress nofree nounwind willreturn memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
typedef struct eq
{
int a;
int b;
int c;
} eq_t;
int main(){
eq_t eq1, eq2;
double ans_x, ans_y;
while(scanf("%d %d %d %d %d %d", &eq1.a, &eq1.b, &eq1.c, &eq2.a, &eq2.b, &eq2.c)==6)
{
if(eq1.b == 0)
{
ans_x = (double)(eq1.c / eq1.a);
ans_y = (double)(( eq2.c - eq2.a * ans_x ) / eq2.b);
}
else if(eq1.a == 0)
{
ans_y = (double)(eq1.c / eq1.b);
ans_x = (double)(( eq2.c - eq2.b * ans_y ) / eq2.a);
}
else
{
if(eq2.b == 0)
{
ans_x = (double)(eq2.c / eq2.a);
ans_y = (double)(( eq1.c - eq1.a * ans_x ) / eq1.b);
}
else if(eq2.a == 0)
{
ans_y = (double)(eq2.c / eq2.b);
ans_x = (double)(( eq1.c - eq1.b * ans_y ) / eq1.a);
}
else
{
ans_x = (double)( eq1.c * eq2.b - eq1.b * eq2.c );
ans_x = ans_x / ( eq1.a * eq2.b - eq1.b * eq2.a );
ans_y = (double)(( eq1.c - eq1.a * ans_x ) / eq1.b);
}
}
ans_x = ans_x + 0.000499999999;
ans_y = ans_y + 0.000499999999;
printf("%.3f %.3f\n", ans_x, ans_y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254761/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254761/source.c"
target datalayout = "e-m:e-p270: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.eq = type { i32, i32, i32 }
@.str = private unnamed_addr constant [18 x i8] c"%d %d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%eq1 = alloca %struct.eq, align 4
%eq2 = alloca %struct.eq, align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %eq1) #4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %eq2) #4
%b = getelementptr inbounds %struct.eq, ptr %eq1, i64 0, i32 1
%c = getelementptr inbounds %struct.eq, ptr %eq1, i64 0, i32 2
%b2 = getelementptr inbounds %struct.eq, ptr %eq2, i64 0, i32 1
%c3 = getelementptr inbounds %struct.eq, ptr %eq2, i64 0, i32 2
%call106 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %eq1, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %eq2, ptr noundef nonnull %b2, ptr noundef nonnull %c3)
%cmp107 = icmp eq i32 %call106, 6
br i1 %cmp107, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end92
%0 = load i32, ptr %b, align 4, !tbaa !5
%cmp5 = icmp eq i32 %0, 0
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %while.body
%1 = load i32, ptr %c, align 4, !tbaa !10
%2 = load i32, ptr %eq1, align 4, !tbaa !11
%div = sdiv i32 %1, %2
%conv = sitofp i32 %div to double
%3 = load i32, ptr %c3, align 4, !tbaa !10
%conv9 = sitofp i32 %3 to double
%4 = load i32, ptr %eq2, align 4, !tbaa !11
%conv11 = sitofp i32 %4 to double
%neg = fneg double %conv11
%5 = call double @llvm.fmuladd.f64(double %neg, double %conv, double %conv9)
%6 = load i32, ptr %b2, align 4, !tbaa !5
%conv13 = sitofp i32 %6 to double
%div14 = fdiv double %5, %conv13
br label %if.end92
if.else: ; preds = %while.body
%7 = load i32, ptr %eq1, align 4, !tbaa !11
%cmp16 = icmp eq i32 %7, 0
br i1 %cmp16, label %if.then18, label %if.else31
if.then18: ; preds = %if.else
%8 = load i32, ptr %c, align 4, !tbaa !10
%div21 = sdiv i32 %8, %0
%conv22 = sitofp i32 %div21 to double
%9 = load i32, ptr %c3, align 4, !tbaa !10
%conv24 = sitofp i32 %9 to double
%10 = load i32, ptr %b2, align 4, !tbaa !5
%conv26 = sitofp i32 %10 to double
%neg27 = fneg double %conv26
%11 = call double @llvm.fmuladd.f64(double %neg27, double %conv22, double %conv24)
%12 = load i32, ptr %eq2, align 4, !tbaa !11
%conv29 = sitofp i32 %12 to double
%div30 = fdiv double %11, %conv29
br label %if.end92
if.else31: ; preds = %if.else
%13 = load i32, ptr %b2, align 4, !tbaa !5
%cmp33 = icmp eq i32 %13, 0
br i1 %cmp33, label %if.then35, label %if.else48
if.then35: ; preds = %if.else31
%14 = load i32, ptr %c3, align 4, !tbaa !10
%15 = load i32, ptr %eq2, align 4, !tbaa !11
%div38 = sdiv i32 %14, %15
%conv39 = sitofp i32 %div38 to double
%16 = load i32, ptr %c, align 4, !tbaa !10
%conv41 = sitofp i32 %16 to double
%conv43 = sitofp i32 %7 to double
%neg44 = fneg double %conv43
%17 = call double @llvm.fmuladd.f64(double %neg44, double %conv39, double %conv41)
%conv46 = sitofp i32 %0 to double
%div47 = fdiv double %17, %conv46
br label %if.end92
if.else48: ; preds = %if.else31
%18 = load i32, ptr %eq2, align 4, !tbaa !11
%cmp50 = icmp eq i32 %18, 0
br i1 %cmp50, label %if.then52, label %if.else65
if.then52: ; preds = %if.else48
%19 = load i32, ptr %c3, align 4, !tbaa !10
%div55 = sdiv i32 %19, %13
%conv56 = sitofp i32 %div55 to double
%20 = load i32, ptr %c, align 4, !tbaa !10
%conv58 = sitofp i32 %20 to double
%conv60 = sitofp i32 %0 to double
%neg61 = fneg double %conv60
%21 = call double @llvm.fmuladd.f64(double %neg61, double %conv56, double %conv58)
%conv63 = sitofp i32 %7 to double
%div64 = fdiv double %21, %conv63
br label %if.end92
if.else65: ; preds = %if.else48
%22 = load i32, ptr %c, align 4, !tbaa !10
%mul = mul nsw i32 %22, %13
%23 = load i32, ptr %c3, align 4, !tbaa !10
%mul70 = mul nsw i32 %23, %0
%sub = sub nsw i32 %mul, %mul70
%conv71 = sitofp i32 %sub to double
%mul74 = mul nsw i32 %13, %7
%mul77 = mul nsw i32 %18, %0
%sub78 = sub nsw i32 %mul74, %mul77
%conv79 = sitofp i32 %sub78 to double
%div80 = fdiv double %conv71, %conv79
%conv82 = sitofp i32 %22 to double
%conv84 = sitofp i32 %7 to double
%neg86 = fneg double %conv84
%24 = call double @llvm.fmuladd.f64(double %neg86, double %div80, double %conv82)
%conv88 = sitofp i32 %0 to double
%div89 = fdiv double %24, %conv88
br label %if.end92
if.end92: ; preds = %if.then18, %if.then52, %if.else65, %if.then35, %if.then
%ans_x.0 = phi double [ %conv, %if.then ], [ %div30, %if.then18 ], [ %conv39, %if.then35 ], [ %div64, %if.then52 ], [ %div80, %if.else65 ]
%ans_y.0 = phi double [ %div14, %if.then ], [ %conv22, %if.then18 ], [ %div47, %if.then35 ], [ %conv56, %if.then52 ], [ %div89, %if.else65 ]
%add = fadd double %ans_x.0, 0x3F40624DD264ED30
%add93 = fadd double %ans_y.0, 0x3F40624DD264ED30
%call94 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %add, double noundef %add93)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %eq1, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %eq2, ptr noundef nonnull %b2, ptr noundef nonnull %c3)
%cmp = icmp eq i32 %call, 6
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %if.end92, %entry
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %eq2) #4
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %eq1) #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, !7, i64 4}
!6 = !{!"eq", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
double a, b, c, d, e, f;
double x, y;
while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
y = (a * f - c * d) / (a * e - b * d);
x = (c - b * y) / a;
printf("%.3f %.3f\n", x, y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254804/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254804/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #5
%call8 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %f, align 8, !tbaa !5
%2 = load double, ptr %c, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%4 = load double, ptr %e, align 8, !tbaa !5
%5 = load double, ptr %b, align 8, !tbaa !5
%6 = insertelement <2 x double> poison, double %2, i64 0
%7 = insertelement <2 x double> %6, double %5, i64 1
%8 = fneg <2 x double> %7
%9 = insertelement <2 x double> poison, double %3, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %10, %8
%12 = insertelement <2 x double> poison, double %0, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %1, i64 0
%15 = insertelement <2 x double> %14, double %4, i64 1
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div = fdiv double %17, %18
%19 = extractelement <2 x double> %8, i64 1
%20 = call double @llvm.fmuladd.f64(double %19, double %div, double %2)
%div5 = fdiv double %20, %0
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div5, double noundef %div)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%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
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #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 = !{!"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(){
double a,b,c,d,e,f,A,x,y,X,Y,Z;
//while(scanf_s("%f",&a)!=EOF){
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
Y=a*e-b*d,Z=f*a-c*d;
y=Z/Y;
x=(c-b*y)/a;
printf("%.3lf %.3lf\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254848/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254848/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #5
%call8 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %e, align 8, !tbaa !5
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%4 = load double, ptr %f, align 8, !tbaa !5
%5 = load double, ptr %c, align 8, !tbaa !5
%6 = insertelement <2 x double> poison, double %5, i64 0
%7 = insertelement <2 x double> %6, double %2, i64 1
%8 = fneg <2 x double> %7
%9 = insertelement <2 x double> poison, double %3, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %10, %8
%12 = insertelement <2 x double> poison, double %4, i64 0
%13 = insertelement <2 x double> %12, double %0, i64 1
%14 = insertelement <2 x double> poison, double %0, i64 0
%15 = insertelement <2 x double> %14, double %1, i64 1
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div = fdiv double %17, %18
%19 = extractelement <2 x double> %8, i64 1
%20 = call double @llvm.fmuladd.f64(double %19, double %div, double %5)
%div5 = fdiv double %20, %0
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div5, double noundef %div)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%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
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #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 = !{!"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 a,b,c,d,e,f;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
f=(f-c/a*d)/(e-b/a*d);
c=c/a-f*b/a;
printf("%.3f %.3f\n",c,f);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254891/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254891/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #4
%call7 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not8 = icmp eq i32 %call7, -1
br i1 %cmp.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %f, align 8, !tbaa !5
%1 = load double, ptr %c, align 8, !tbaa !5
%2 = load double, ptr %a, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%4 = load double, ptr %e, align 8, !tbaa !5
%5 = load double, ptr %b, align 8, !tbaa !5
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %5, i64 1
%8 = fneg <2 x double> %7
%9 = insertelement <2 x double> poison, double %2, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fdiv <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %3, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %0, i64 0
%15 = insertelement <2 x double> %14, double %4, i64 1
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %13, <2 x double> %15)
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div3 = fdiv double %17, %18
store double %div3, ptr %f, align 8, !tbaa !5
%mul = fmul double %5, %div3
%19 = insertelement <2 x double> %6, double %mul, i64 1
%20 = fdiv <2 x double> %19, %10
%shift = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%21 = fsub <2 x double> %20, %shift
%sub = extractelement <2 x double> %21, i64 0
store double %sub, ptr %c, align 8, !tbaa !5
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub, double noundef %div3)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%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
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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(){
double a, b, c, d, e, f;
while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
double x, y;
x = (c * e / b - f) / (a * e / b - d);
y = (c * d / a - f) / (b * d / a - e);
if (-0.0005 < x && x <= 0)
x = 0;
if (-0.0005 < y && y <= 0)
y = 0;
printf("%.3lf %.3lf\n", x, y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254934/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254934/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #3
%call26 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not27 = icmp eq i32 %call26, -1
br i1 %cmp.not27, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %c, align 8, !tbaa !5
%1 = load double, ptr %e, align 8, !tbaa !5
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %f, align 8, !tbaa !5
%4 = load double, ptr %a, align 8, !tbaa !5
%5 = load double, ptr %d, align 8, !tbaa !5
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> zeroinitializer
%8 = insertelement <2 x double> poison, double %0, i64 0
%9 = insertelement <2 x double> %8, double %4, i64 1
%10 = fmul <2 x double> %7, %9
%11 = insertelement <2 x double> poison, double %2, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fdiv <2 x double> %10, %12
%14 = insertelement <2 x double> poison, double %3, i64 0
%15 = insertelement <2 x double> %14, double %5, i64 1
%16 = fsub <2 x double> %13, %15
%17 = insertelement <2 x double> %8, double %2, i64 1
%18 = insertelement <2 x double> poison, double %5, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = fmul <2 x double> %17, %19
%21 = insertelement <2 x double> poison, double %4, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = fdiv <2 x double> %20, %22
%24 = insertelement <2 x double> %14, double %1, i64 1
%25 = fsub <2 x double> %23, %24
%26 = shufflevector <2 x double> %25, <2 x double> %16, <2 x i32> <i32 0, i32 2>
%27 = shufflevector <2 x double> %25, <2 x double> %16, <2 x i32> <i32 1, i32 3>
%28 = fdiv <2 x double> %26, %27
%29 = extractelement <2 x double> %28, i64 1
%cmp13 = fcmp ole double %29, 0.000000e+00
%30 = fcmp ogt <2 x double> %28, <double -5.000000e-04, double -5.000000e-04>
%31 = extractelement <2 x i1> %30, i64 1
%or.cond = and i1 %31, %cmp13
%spec.store.select = select i1 %or.cond, double 0.000000e+00, double %29
%32 = extractelement <2 x double> %28, i64 0
%cmp16 = fcmp ole double %32, 0.000000e+00
%33 = extractelement <2 x i1> %30, i64 0
%or.cond20 = and i1 %33, %cmp16
%spec.store.select21 = select i1 %or.cond20, double 0.000000e+00, double %32
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %spec.store.select, double noundef %spec.store.select21)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%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
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
double a,b,c,d,e,f,x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
if(a<0){
a=-a;
b=-b;
c=-c;
}
if(d<0){
d=-d;
e=-e;
f=-f;
}
y=((c*d)-(a*f))/((b*d)-(a*e));
x=((b*f)-(c*e))/((b*d)-(a*e));
printf("%.3lf %.3lf\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254978/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254978/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #4
%call20 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not21 = icmp eq i32 %call20, -1
br i1 %cmp.not21, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end9
%0 = load double, ptr %a, align 8, !tbaa !5
%cmp1 = fcmp olt double %0, 0.000000e+00
br i1 %cmp1, label %if.then, label %if.end
if.then: ; preds = %while.body
%fneg = fneg double %0
store double %fneg, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %b, align 8, !tbaa !5
%fneg2 = fneg double %1
store double %fneg2, ptr %b, align 8, !tbaa !5
%2 = load double, ptr %c, align 8, !tbaa !5
%fneg3 = fneg double %2
store double %fneg3, ptr %c, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%3 = phi double [ %fneg, %if.then ], [ %0, %while.body ]
%4 = load double, ptr %d, align 8, !tbaa !5
%cmp4 = fcmp olt double %4, 0.000000e+00
%.pre = load double, ptr %f, align 8, !tbaa !5
%.pre22 = load double, ptr %e, align 8, !tbaa !5
br i1 %cmp4, label %if.then5, label %if.end9
if.then5: ; preds = %if.end
%fneg6 = fneg double %4
store double %fneg6, ptr %d, align 8, !tbaa !5
%fneg7 = fneg double %.pre22
store double %fneg7, ptr %e, align 8, !tbaa !5
%fneg8 = fneg double %.pre
store double %fneg8, ptr %f, align 8, !tbaa !5
br label %if.end9
if.end9: ; preds = %if.then5, %if.end
%5 = phi double [ %fneg7, %if.then5 ], [ %.pre22, %if.end ]
%6 = phi double [ %fneg8, %if.then5 ], [ %.pre, %if.end ]
%7 = phi double [ %fneg6, %if.then5 ], [ %4, %if.end ]
%8 = load double, ptr %c, align 8, !tbaa !5
%9 = fneg double %3
%neg = fmul double %6, %9
%10 = call double @llvm.fmuladd.f64(double %8, double %7, double %neg)
%11 = load double, ptr %b, align 8, !tbaa !5
%neg12 = fmul double %5, %9
%12 = call double @llvm.fmuladd.f64(double %11, double %7, double %neg12)
%div = fdiv double %10, %12
%13 = fneg double %8
%neg14 = fmul double %5, %13
%14 = call double @llvm.fmuladd.f64(double %11, double %6, double %neg14)
%div17 = fdiv double %14, %12
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div17, double noundef %div)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end9, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!"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 <math.h>
/*-----Codeforces Round #716 (Div. 2)-A-----*/
int main(){
int T;
scanf("%d", &T);
while (T--)
{
int n;
scanf("%d", &n);
double A[n];
for (int i = 0; i < n ; i++)
{
scanf("%lf", &A[i]);
}
double root=0, imp=0;
int sub=0;
for (int i = 0; i < n&&sub==0; i++)
{
root=sqrt(A[i]);
double tmp=modf(root, &imp);
sub=(tmp!=0)?1:0;
}
if(sub==1){
printf("YES\n");
}else{
printf("NO\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25502/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25502/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca i32, align 4
%n = alloca i32, align 4
%imp = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%0 = load i32, ptr %T, align 4, !tbaa !5
%dec30 = add nsw i32 %0, -1
store i32 %dec30, ptr %T, align 4, !tbaa !5
%tobool.not31 = icmp eq i32 %0, 0
br i1 %tobool.not31, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca double, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %4, 0
br i1 %cmp26, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %while.body
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %imp) #7
br label %if.else
for.cond.cleanup: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %imp) #7
%cmp528 = icmp sgt i32 %5, 0
br i1 %cmp528, label %for.body8, label %if.else
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds double, ptr %vla, 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
%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.cond.cleanup, !llvm.loop !9
for.cond.cleanup7: ; preds = %for.body8
br i1 %cmp13, label %if.else, label %if.end
for.body8: ; preds = %for.cond.cleanup, %for.body8
%indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.body8 ], [ 0, %for.cond.cleanup ]
%arrayidx10 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv33
%7 = load double, ptr %arrayidx10, align 8, !tbaa !11
%call11 = call double @sqrt(double noundef %7) #7
%call12 = call double @modf(double noundef %call11, ptr noundef nonnull %imp) #7
%cmp13 = fcmp oeq double %call12, 0.000000e+00
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp5 = icmp slt i64 %indvars.iv.next34, %9
%10 = select i1 %cmp5, i1 %cmp13, i1 false
br i1 %10, label %for.body8, label %for.cond.cleanup7, !llvm.loop !13
if.else: ; preds = %for.cond.cleanup.thread, %for.cond.cleanup, %for.cond.cleanup7
br label %if.end
if.end: ; preds = %for.cond.cleanup7, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.4, %for.cond.cleanup7 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %imp) #7
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
%11 = load i32, ptr %T, align 4, !tbaa !5
%dec = add nsw i32 %11, -1
store i32 %dec, ptr %T, align 4, !tbaa !5
%tobool.not = icmp eq i32 %11, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: write)
declare double @modf(double noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(void){
float a , b , c , d , e , f;
while((scanf("%f %f %f %f %f %f" , &a , &b , &c , &d , &e , &f))!=EOF){
printf("%.3f %.3f\n" , (c*e-b*f)/(a*e-b*d)+0.0 , (a*f-c*d)/(a*e-b*d)+0.0);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255070/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255070/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [18 x i8] c"%f %f %f %f %f %f\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca float, align 4
%b = alloca float, align 4
%c = alloca float, align 4
%d = alloca float, align 4
%e = alloca float, align 4
%f = alloca float, 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
%call12 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not13 = icmp eq i32 %call12, -1
br i1 %cmp.not13, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load float, ptr %c, align 4, !tbaa !5
%1 = load float, ptr %e, align 4, !tbaa !5
%2 = load float, ptr %b, align 4, !tbaa !5
%3 = load float, ptr %f, align 4, !tbaa !5
%4 = fneg float %2
%5 = load float, ptr %a, align 4, !tbaa !5
%6 = load float, ptr %d, align 4, !tbaa !5
%7 = insertelement <2 x float> poison, float %3, i64 0
%8 = insertelement <2 x float> %7, float %6, i64 1
%9 = insertelement <2 x float> poison, float %4, i64 0
%10 = shufflevector <2 x float> %9, <2 x float> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x float> %8, %10
%12 = insertelement <2 x float> poison, float %0, i64 0
%13 = insertelement <2 x float> %12, float %5, i64 1
%14 = insertelement <2 x float> poison, float %1, i64 0
%15 = shufflevector <2 x float> %14, <2 x float> poison, <2 x i32> zeroinitializer
%16 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %13, <2 x float> %15, <2 x float> %11)
%17 = extractelement <2 x float> %16, i64 0
%18 = extractelement <2 x float> %16, i64 1
%div = fdiv float %17, %18
%conv = fpext float %div to double
%add = fadd double %conv, 0.000000e+00
%19 = fneg float %0
%neg5 = fmul float %6, %19
%20 = call float @llvm.fmuladd.f32(float %5, float %3, float %neg5)
%div8 = fdiv float %20, %18
%conv9 = fpext float %div8 to double
%add10 = fadd double %conv9, 0.000000e+00
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %add, double noundef %add10)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #5
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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #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 = !{!"float", !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(){
double a,b,c,d,e,f, x,y,dd;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)>0){
dd = (a*e-b*d);
x=(c*e-b*f-(c*b*d)/a+(c*d*b)/a)/dd;
y=(a*f-c*d)/dd;
if(x==0)x=0;
printf("%.3f %.3f\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255128/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255128/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #4
%call17 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp18 = icmp sgt i32 %call17, 0
br i1 %cmp18, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %e, align 8, !tbaa !5
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%4 = fneg double %2
%neg = fmul double %3, %4
%5 = call double @llvm.fmuladd.f64(double %0, double %1, double %neg)
%6 = load double, ptr %c, align 8, !tbaa !5
%7 = load double, ptr %f, align 8, !tbaa !5
%neg3 = fmul double %7, %4
%8 = call double @llvm.fmuladd.f64(double %6, double %1, double %neg3)
%9 = insertelement <2 x double> poison, double %3, i64 0
%10 = insertelement <2 x double> %9, double %2, i64 1
%11 = insertelement <2 x double> poison, double %6, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fmul <2 x double> %10, %12
%14 = insertelement <2 x double> poison, double %2, i64 0
%15 = insertelement <2 x double> %14, double %3, i64 1
%16 = fmul <2 x double> %15, %13
%17 = insertelement <2 x double> poison, double %0, i64 0
%18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%19 = fdiv <2 x double> %16, %18
%20 = extractelement <2 x double> %19, i64 1
%sub = fsub double %8, %20
%21 = extractelement <2 x double> %19, i64 0
%add = fadd double %21, %sub
%div8 = fdiv double %add, %5
%22 = extractelement <2 x double> %13, i64 0
%neg11 = fneg double %22
%23 = call double @llvm.fmuladd.f64(double %0, double %7, double %neg11)
%div12 = fdiv double %23, %5
%cmp13 = fcmp oeq double %div8, 0.000000e+00
%x.0 = select i1 %cmp13, double 0.000000e+00, double %div8
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %x.0, double noundef %div12)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp = icmp sgt i32 %call, 0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!"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(){
int num[6];
double ans[2];
while(scanf("%d %d %d %d %d %d", num, num+1, num+2, num+3, num+4, num+5) != EOF)
{
if(((num[1]*num[3])-(num[0]*num[4])) == 0)
{
//一意に解が求まらない
}
else
{
ans[0] = (((double)((num[1]*num[5])-(num[4]*num[2]))) / ((double)((num[1]*num[3])-(num[0]*num[4]))));
//b == 0
if(num[1] == 0)
{
ans[1] = ((double)(num[5]-num[3]*ans[0]))/((double)num[4]);
}
else
{
ans[1] = ((double)(num[2]-num[0]*ans[0]))/((double)num[1]);
}
}
if(ans[0] == 0)
{
ans[0] = 0.000;
}
if(ans[1] == 0)
{
ans[1] = 0.000;
}
printf("%.3lf %.3lf\n", ans[0], ans[1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [18 x i8] c"%d %d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca [6 x i32], align 16
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %num) #4
%add.ptr = getelementptr inbounds i32, ptr %num, i64 1
%add.ptr3 = getelementptr inbounds i32, ptr %num, i64 2
%add.ptr5 = getelementptr inbounds i32, ptr %num, i64 3
%add.ptr7 = getelementptr inbounds i32, ptr %num, i64 4
%add.ptr9 = getelementptr inbounds i32, ptr %num, i64 5
%call77 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr3, ptr noundef nonnull %add.ptr5, ptr noundef nonnull %add.ptr7, ptr noundef nonnull %add.ptr9)
%cmp.not78 = icmp eq i32 %call77, -1
br i1 %cmp.not78, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end57
%ans.sroa.0.080 = phi double [ %ans.sroa.0.2, %if.end57 ], [ undef, %entry ]
%ans.sroa.8.079 = phi double [ %ans.sroa.8.2, %if.end57 ], [ undef, %entry ]
%0 = load i32, ptr %add.ptr, align 4, !tbaa !5
%1 = load i32, ptr %add.ptr5, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %num, align 16, !tbaa !5
%3 = load i32, ptr %add.ptr7, align 16, !tbaa !5
%mul13 = mul nsw i32 %3, %2
%cmp14 = icmp eq i32 %mul, %mul13
br i1 %cmp14, label %if.end57, label %if.else
if.else: ; preds = %while.body
%sub = sub nsw i32 %mul, %mul13
%4 = load i32, ptr %add.ptr9, align 4, !tbaa !5
%mul17 = mul nsw i32 %4, %0
%5 = load i32, ptr %add.ptr3, align 8, !tbaa !5
%mul20 = mul nsw i32 %5, %3
%sub21 = sub nsw i32 %mul17, %mul20
%conv = sitofp i32 %sub21 to double
%conv29 = sitofp i32 %sub to double
%div = fdiv double %conv, %conv29
%cmp32 = icmp eq i32 %0, 0
br i1 %cmp32, label %if.then34, label %if.else45
if.then34: ; preds = %if.else
%conv36 = sitofp i32 %4 to double
%conv38 = sitofp i32 %1 to double
%neg = fneg double %conv38
%6 = call double @llvm.fmuladd.f64(double %neg, double %div, double %conv36)
%conv42 = sitofp i32 %3 to double
%div43 = fdiv double %6, %conv42
br label %if.end57
if.else45: ; preds = %if.else
%conv47 = sitofp i32 %5 to double
%conv49 = sitofp i32 %2 to double
%neg52 = fneg double %conv49
%7 = call double @llvm.fmuladd.f64(double %neg52, double %div, double %conv47)
%conv54 = sitofp i32 %0 to double
%div55 = fdiv double %7, %conv54
br label %if.end57
if.end57: ; preds = %if.then34, %if.else45, %while.body
%ans.sroa.8.1 = phi double [ %ans.sroa.8.079, %while.body ], [ %div43, %if.then34 ], [ %div55, %if.else45 ]
%ans.sroa.0.1 = phi double [ %ans.sroa.0.080, %while.body ], [ %div, %if.then34 ], [ %div, %if.else45 ]
%cmp59 = fcmp oeq double %ans.sroa.0.1, 0.000000e+00
%ans.sroa.0.2 = select i1 %cmp59, double 0.000000e+00, double %ans.sroa.0.1
%cmp65 = fcmp oeq double %ans.sroa.8.1, 0.000000e+00
%ans.sroa.8.2 = select i1 %cmp65, double 0.000000e+00, double %ans.sroa.8.1
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %ans.sroa.0.2, double noundef %ans.sroa.8.2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr3, ptr noundef nonnull %add.ptr5, ptr noundef nonnull %add.ptr7, ptr noundef nonnull %add.ptr9)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end57, %entry
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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>
#include<math.h>
int main(){
double a,b,c,d,e,f,x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)+1){
if(floor(a*e-b*d)==0){x=0.000;}
else {x=(e*c-f*b)/(a*e-b*d);
x=x+0.005;
x=x*100;
x=floor(x);
x=x/100;
}
if(floor(b*d-a*e)==0){y=0.000;}
else {y=(c*d-a*f)/(b*d-a*e);
y=y+0.005;
y=y*100;
y=floor(y);
y=y/100;
}
printf("%.3lf %.3lf\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #4
%call34 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%tobool.not35 = icmp eq i32 %call34, -1
br i1 %tobool.not35, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %e, align 8, !tbaa !5
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%4 = fneg double %2
%neg = fmul double %3, %4
%5 = call double @llvm.fmuladd.f64(double %0, double %1, double %neg)
%6 = call double @llvm.floor.f64(double %5)
%cmp = fcmp oeq double %6, 0.000000e+00
br i1 %cmp, label %if.end, label %if.else
if.else: ; preds = %while.body
%7 = load double, ptr %c, align 8, !tbaa !5
%8 = load double, ptr %f, align 8, !tbaa !5
%9 = fneg double %8
%neg3 = fmul double %2, %9
%10 = call double @llvm.fmuladd.f64(double %1, double %7, double %neg3)
%div = fdiv double %10, %5
%add6 = fadd double %div, 5.000000e-03
%mul = fmul double %add6, 1.000000e+02
%11 = call double @llvm.floor.f64(double %mul)
%div7 = fdiv double %11, 1.000000e+02
br label %if.end
if.end: ; preds = %while.body, %if.else
%x.0 = phi double [ %div7, %if.else ], [ 0.000000e+00, %while.body ]
%12 = fneg double %0
%neg10 = fmul double %1, %12
%13 = call double @llvm.fmuladd.f64(double %2, double %3, double %neg10)
%14 = call double @llvm.floor.f64(double %13)
%cmp11 = fcmp oeq double %14, 0.000000e+00
br i1 %cmp11, label %if.end24, label %if.else13
if.else13: ; preds = %if.end
%15 = load double, ptr %c, align 8, !tbaa !5
%16 = load double, ptr %f, align 8, !tbaa !5
%neg16 = fmul double %16, %12
%17 = call double @llvm.fmuladd.f64(double %15, double %3, double %neg16)
%div20 = fdiv double %17, %13
%add21 = fadd double %div20, 5.000000e-03
%mul22 = fmul double %add21, 1.000000e+02
%18 = call double @llvm.floor.f64(double %mul22)
%div23 = fdiv double %18, 1.000000e+02
br label %if.end24
if.end24: ; preds = %if.end, %if.else13
%y.0 = phi double [ %div23, %if.else13 ], [ 0.000000e+00, %if.end ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %x.0, double noundef %y.0)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end24, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.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 = !{!"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()
{
double a,b,c,d,e,f,x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
y = ((c*d)-(a*f)) / ((b*d)-(a*e));
x = ((c-b*y)/a);
printf("%.3lf %.3lf\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255265/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255265/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #5
%call8 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %c, align 8, !tbaa !5
%1 = load double, ptr %d, align 8, !tbaa !5
%2 = load double, ptr %a, align 8, !tbaa !5
%3 = load double, ptr %f, align 8, !tbaa !5
%4 = fneg double %2
%5 = load double, ptr %b, align 8, !tbaa !5
%6 = load double, ptr %e, align 8, !tbaa !5
%7 = insertelement <2 x double> poison, double %3, i64 0
%8 = insertelement <2 x double> %7, double %6, i64 1
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %0, i64 0
%13 = insertelement <2 x double> %12, double %5, i64 1
%14 = insertelement <2 x double> poison, double %1, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div = fdiv double %17, %18
%neg4 = fneg double %5
%19 = call double @llvm.fmuladd.f64(double %neg4, double %div, double %0)
%div5 = fdiv double %19, %2
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div5, double noundef %div)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%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
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #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 = !{!"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>
double rounding(double x, int n)
{
double i, DP = 1;
double X;
for(i = 0; i < (n - 1); ++i)
{
DP *= 10;
}
X = x * DP;
if(x > 0)
X = (int)(X + 0.5);
else
X = (int)(X - 0.5);
return (double)(X / DP);
}
double determinant(double a, double b, double c, double d)
{
return (a * d) - (b * c);
}
int main(void)
{
double a, b, c, d, e, f;
double A, D1, D2;
double x, y, X, Y;
while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF)
{
A = determinant(a, b, d, e);
D1 = determinant(c, b, f, e);
D2 = determinant(a, c, d, f);
x = (D1 / A);
y = (D2 / A);
X = rounding(x, 4);
Y = rounding(y, 4);
printf("%.3f %.3f\n", X, Y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255308/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255308/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local double @rounding(double noundef %x, i32 noundef %n) local_unnamed_addr #0 {
entry:
%sub = add nsw i32 %n, -1
%conv = sitofp i32 %sub to double
%cmp16 = icmp sgt i32 %n, 1
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%DP.018 = phi double [ %mul, %for.body ], [ 1.000000e+00, %entry ]
%i.017 = phi double [ %inc, %for.body ], [ 0.000000e+00, %entry ]
%mul = fmul double %DP.018, 1.000000e+01
%inc = fadd double %i.017, 1.000000e+00
%cmp = fcmp olt double %inc, %conv
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !5
for.end: ; preds = %for.body, %entry
%DP.0.lcssa = phi double [ 1.000000e+00, %entry ], [ %mul, %for.body ]
%mul2 = fmul double %DP.0.lcssa, %x
%cmp3 = fcmp ogt double %x, 0.000000e+00
%X.0.in.in.v = select i1 %cmp3, double 5.000000e-01, double -5.000000e-01
%X.0.in.in = fadd double %X.0.in.in.v, %mul2
%X.0.in = fptosi double %X.0.in.in to i32
%X.0 = sitofp i32 %X.0.in to double
%div = fdiv double %X.0, %DP.0.lcssa
ret double %div
}
; 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 double @determinant(double noundef %a, double noundef %b, double noundef %c, double noundef %d) local_unnamed_addr #2 {
entry:
%0 = fneg double %b
%neg = fmul double %0, %c
%1 = tail call double @llvm.fmuladd.f64(double %a, double %d, double %neg)
ret double %1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #7
%call25 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not26 = icmp eq i32 %call25, -1
br i1 %cmp.not26, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %a, align 8, !tbaa !7
%1 = load double, ptr %b, align 8, !tbaa !7
%2 = load double, ptr %d, align 8, !tbaa !7
%3 = load double, ptr %e, align 8, !tbaa !7
%4 = fneg double %1
%5 = load double, ptr %c, align 8, !tbaa !7
%6 = load double, ptr %f, align 8, !tbaa !7
%7 = insertelement <2 x double> poison, double %6, i64 0
%8 = insertelement <2 x double> %7, double %2, i64 1
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %5, i64 0
%13 = insertelement <2 x double> %12, double %0, i64 1
%14 = insertelement <2 x double> poison, double %3, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = fneg double %5
%neg.i10 = fmul double %2, %17
%18 = call double @llvm.fmuladd.f64(double %0, double %6, double %neg.i10)
%19 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
%20 = insertelement <2 x double> %19, double %18, i64 0
%21 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%22 = fdiv <2 x double> %20, %21
%23 = extractelement <2 x double> %22, i64 1
%mul2.i = fmul double %23, 1.000000e+03
%24 = fcmp ogt <2 x double> %22, zeroinitializer
%25 = extractelement <2 x i1> %24, i64 1
%X.0.in.in.v.i = select i1 %25, double 5.000000e-01, double -5.000000e-01
%X.0.in.in.i = fadd double %X.0.in.in.v.i, %mul2.i
%X.0.in.i = fptosi double %X.0.in.in.i to i32
%X.0.i = sitofp i32 %X.0.in.i to double
%div.i = fdiv double %X.0.i, 1.000000e+03
%26 = extractelement <2 x double> %22, i64 0
%mul2.i17 = fmul double %26, 1.000000e+03
%27 = extractelement <2 x i1> %24, i64 0
%X.0.in.in.v.i19 = select i1 %27, double 5.000000e-01, double -5.000000e-01
%X.0.in.in.i20 = fadd double %X.0.in.in.v.i19, %mul2.i17
%X.0.in.i21 = fptosi double %X.0.in.in.i20 to i32
%X.0.i22 = sitofp i32 %X.0.in.i21 to double
%div.i23 = fdiv double %X.0.i22, 1.000000e+03
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div.i, double noundef %div.i23)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #6
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 = 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 a,b,c,d,e,f,g,x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
y=(f-c*d/a)/(e-b*d/a);
x=(f-c*e/b)/(d-a*e/b);
if(-0.0004<x&&x<=0)x=0;
if(-0.0004<y&&y<=0)y=0;
printf("%.3f %.3f\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255351/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255351/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #3
%call26 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not27 = icmp eq i32 %call26, -1
br i1 %cmp.not27, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %f, align 8, !tbaa !5
%1 = load double, ptr %c, align 8, !tbaa !5
%2 = load double, ptr %d, align 8, !tbaa !5
%3 = load double, ptr %a, align 8, !tbaa !5
%4 = load double, ptr %e, align 8, !tbaa !5
%5 = load double, ptr %b, align 8, !tbaa !5
%6 = insertelement <2 x double> poison, double %2, i64 0
%7 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> zeroinitializer
%8 = insertelement <2 x double> poison, double %1, i64 0
%9 = insertelement <2 x double> %8, double %5, i64 1
%10 = fmul <2 x double> %7, %9
%11 = insertelement <2 x double> poison, double %3, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fdiv <2 x double> %10, %12
%14 = insertelement <2 x double> poison, double %0, i64 0
%15 = insertelement <2 x double> %14, double %4, i64 1
%16 = fsub <2 x double> %15, %13
%17 = insertelement <2 x double> %8, double %3, i64 1
%18 = insertelement <2 x double> poison, double %4, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = fmul <2 x double> %17, %19
%21 = insertelement <2 x double> poison, double %5, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = fdiv <2 x double> %20, %22
%24 = insertelement <2 x double> %14, double %2, i64 1
%25 = fsub <2 x double> %24, %23
%26 = shufflevector <2 x double> %16, <2 x double> %25, <2 x i32> <i32 0, i32 2>
%27 = shufflevector <2 x double> %16, <2 x double> %25, <2 x i32> <i32 1, i32 3>
%28 = fdiv <2 x double> %26, %27
%29 = extractelement <2 x double> %28, i64 1
%cmp13 = fcmp ole double %29, 0.000000e+00
%30 = fcmp ogt <2 x double> %28, <double -4.000000e-04, double -4.000000e-04>
%31 = extractelement <2 x i1> %30, i64 1
%or.cond = and i1 %31, %cmp13
%spec.store.select = select i1 %or.cond, double 0.000000e+00, double %29
%32 = extractelement <2 x double> %28, i64 0
%cmp16 = fcmp ole double %32, 0.000000e+00
%33 = extractelement <2 x i1> %30, i64 0
%or.cond20 = and i1 %33, %cmp16
%spec.store.select21 = select i1 %or.cond20, double 0.000000e+00, double %32
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %spec.store.select, double noundef %spec.store.select21)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%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
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
double a,b,c,d,e,f;
double x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
if(b!=0){
x=((e*c/b)-f)/((e*a/b)-d);
}
else{
x=c/a;
}
if(a!=0){
y=((d*c/a)-f)/((d*b/a)-e);
}
else{
y=c/b;
}
x=x*1000,y=y*1000;
if(x>0){
x=(double)(int)(x+0.5);
}
else{
x=(double)(int)(x-0.5);
}
if(y>0){
y=(double)(int)(y+0.5);
}
else{
y=(double)(int)(y-0.5);
}
x=x/1000;y=y/1000;
printf("%.3f %.3f\n",x,y);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255395/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255395/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #3
%call54 = 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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not55 = icmp eq i32 %call54, -1
br i1 %cmp.not55, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end18
%0 = load double, ptr %b, align 8, !tbaa !5
%cmp1 = fcmp une double %0, 0.000000e+00
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%1 = load double, ptr %e, align 8, !tbaa !5
%2 = load double, ptr %c, align 8, !tbaa !5
%3 = load double, ptr %f, align 8, !tbaa !5
%4 = load double, ptr %a, align 8, !tbaa !5
%5 = load double, ptr %d, align 8, !tbaa !5
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> zeroinitializer
%8 = insertelement <2 x double> poison, double %2, i64 0
%9 = insertelement <2 x double> %8, double %4, i64 1
%10 = fmul <2 x double> %7, %9
%11 = insertelement <2 x double> poison, double %0, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fdiv <2 x double> %10, %12
%14 = insertelement <2 x double> poison, double %3, i64 0
%15 = insertelement <2 x double> %14, double %5, i64 1
%16 = fsub <2 x double> %13, %15
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div5 = fdiv double %17, %18
br label %if.end
if.else: ; preds = %while.body
%19 = load double, ptr %c, align 8, !tbaa !5
%20 = load double, ptr %a, align 8, !tbaa !5
%div6 = fdiv double %19, %20
br label %if.end
if.end: ; preds = %if.else, %if.then
%21 = phi double [ %19, %if.else ], [ %2, %if.then ]
%22 = phi double [ %20, %if.else ], [ %4, %if.then ]
%x.0 = phi double [ %div6, %if.else ], [ %div5, %if.then ]
%cmp7 = fcmp une double %22, 0.000000e+00
br i1 %cmp7, label %if.then8, label %if.else16
if.then8: ; preds = %if.end
%23 = load double, ptr %d, align 8, !tbaa !5
%24 = load double, ptr %f, align 8, !tbaa !5
%25 = load double, ptr %e, align 8, !tbaa !5
%26 = insertelement <2 x double> poison, double %23, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = insertelement <2 x double> poison, double %21, i64 0
%29 = insertelement <2 x double> %28, double %0, i64 1
%30 = fmul <2 x double> %27, %29
%31 = insertelement <2 x double> poison, double %22, i64 0
%32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> zeroinitializer
%33 = fdiv <2 x double> %30, %32
%34 = insertelement <2 x double> poison, double %24, i64 0
%35 = insertelement <2 x double> %34, double %25, i64 1
%36 = fsub <2 x double> %33, %35
%37 = extractelement <2 x double> %36, i64 0
%38 = extractelement <2 x double> %36, i64 1
%div15 = fdiv double %37, %38
br label %if.end18
if.else16: ; preds = %if.end
%div17 = fdiv double %21, %0
br label %if.end18
if.end18: ; preds = %if.else16, %if.then8
%y.0 = phi double [ %div15, %if.then8 ], [ %div17, %if.else16 ]
%mul19 = fmul double %x.0, 1.000000e+03
%mul20 = fmul double %y.0, 1.000000e+03
%cmp21 = fcmp ogt double %mul19, 0.000000e+00
%x.1.in.in.v = select i1 %cmp21, double 5.000000e-01, double -5.000000e-01
%x.1.in.in = fadd double %mul19, %x.1.in.in.v
%x.1.in = fptosi double %x.1.in.in to i32
%x.1 = sitofp i32 %x.1.in to double
%cmp29 = fcmp ogt double %mul20, 0.000000e+00
%y.1.in.in.v = select i1 %cmp29, double 5.000000e-01, double -5.000000e-01
%y.1.in.in = fadd double %mul20, %y.1.in.in.v
%y.1.in = fptosi double %y.1.in.in to i32
%y.1 = sitofp i32 %y.1.in to double
%div40 = fdiv double %x.1, 1.000000e+03
%div41 = fdiv double %y.1, 1.000000e+03
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div40, double noundef %div41)
%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, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end18, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define SIZ 1400
#define min(a,b) ((a)<(b)?(a):(b))
int A[SIZ][SIZ];
int m[SIZ][SIZ];
int main(){
int i,j,k,x,y,r,M=0,t=0,z;
scanf("%d%d",&y,&x);
for(j=0;j<y;j++)for(i=0;i<x;i++)scanf("%d",A[j]+i);
for(j=0;j<y;j++)for(r=i=0;i<x;m[j][i]=r,i++)r=A[j][i]==0?r+1:0;
for(r=i=0;i<x;i++)for(j=0;j<y;j++)for(M=x,k=j;k<y;k++){
if(M>m[k][i])M=m[k][i];
int z=k-j+1;
if(M<z)break;
if(r<z)r=z;
}
printf("%d\n",r*r);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@A = dso_local global [1400 x [1400 x i32]] zeroinitializer, align 16
@m = dso_local local_unnamed_addr global [1400 x [1400 x i32]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y, ptr noundef nonnull %x)
%0 = load i32, ptr %y, align 4, !tbaa !5
%cmp108 = icmp sgt i32 %0, 0
%.pre158.pre = load i32, ptr %x, align 4, !tbaa !5
%1 = icmp sgt i32 %.pre158.pre, 0
%or.cond = select i1 %cmp108, i1 %1, i1 false
br i1 %or.cond, label %for.cond1.preheader, label %for.end63
for.cond1.preheader: ; preds = %entry, %for.inc5
%2 = phi i32 [ %10, %for.inc5 ], [ %0, %entry ]
%3 = phi i32 [ %11, %for.inc5 ], [ %.pre158.pre, %entry ]
%indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.inc5 ], [ 0, %entry ]
%cmp2106 = icmp sgt i32 %3, 0
br i1 %cmp2106, label %for.body3.lr.ph, label %for.inc5
for.body3.lr.ph: ; preds = %for.cond1.preheader
%arrayidx = getelementptr inbounds [1400 x [1400 x i32]], ptr @A, i64 0, i64 %indvars.iv132
br label %for.body3
for.cond8.preheader: ; preds = %for.inc5
%cmp9113 = icmp slt i32 %10, 1
br i1 %cmp9113, label %for.cond29.preheader, label %for.cond11.preheader.lr.ph
for.cond11.preheader.lr.ph: ; preds = %for.cond8.preheader
%cmp12110 = icmp sgt i32 %11, 0
br i1 %cmp12110, label %for.cond11.preheader.us.preheader, label %for.end63
for.cond11.preheader.us.preheader: ; preds = %for.cond11.preheader.lr.ph
%wide.trip.count141 = zext i32 %10 to i64
%wide.trip.count = zext i32 %11 to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %11, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond11.preheader.us
for.cond11.preheader.us: ; preds = %for.cond11.preheader.us.preheader, %for.cond11.for.inc26_crit_edge.us
%indvars.iv138 = phi i64 [ 0, %for.cond11.preheader.us.preheader ], [ %indvars.iv.next139, %for.cond11.for.inc26_crit_edge.us ]
br i1 %4, label %for.cond11.for.inc26_crit_edge.us.unr-lcssa, label %for.body13.us
for.body13.us: ; preds = %for.cond11.preheader.us, %for.body13.us
%indvars.iv135 = phi i64 [ %indvars.iv.next136.1, %for.body13.us ], [ 0, %for.cond11.preheader.us ]
%r.0111.us = phi i32 [ %cond.us.1, %for.body13.us ], [ 0, %for.cond11.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.body13.us ], [ 0, %for.cond11.preheader.us ]
%arrayidx17.us = getelementptr inbounds [1400 x [1400 x i32]], ptr @A, i64 0, i64 %indvars.iv138, i64 %indvars.iv135
%5 = load i32, ptr %arrayidx17.us, align 8, !tbaa !5
%cmp18.us = icmp eq i32 %5, 0
%add.us = add nsw i32 %r.0111.us, 1
%cond.us = select i1 %cmp18.us, i32 %add.us, i32 0
%arrayidx23.us = getelementptr inbounds [1400 x [1400 x i32]], ptr @m, i64 0, i64 %indvars.iv138, i64 %indvars.iv135
store i32 %cond.us, ptr %arrayidx23.us, align 8, !tbaa !5
%indvars.iv.next136 = or i64 %indvars.iv135, 1
%arrayidx17.us.1 = getelementptr inbounds [1400 x [1400 x i32]], ptr @A, i64 0, i64 %indvars.iv138, i64 %indvars.iv.next136
%6 = load i32, ptr %arrayidx17.us.1, align 4, !tbaa !5
%cmp18.us.1 = icmp eq i32 %6, 0
%add.us.1 = add nsw i32 %cond.us, 1
%cond.us.1 = select i1 %cmp18.us.1, i32 %add.us.1, i32 0
%arrayidx23.us.1 = getelementptr inbounds [1400 x [1400 x i32]], ptr @m, i64 0, i64 %indvars.iv138, i64 %indvars.iv.next136
store i32 %cond.us.1, ptr %arrayidx23.us.1, align 4, !tbaa !5
%indvars.iv.next136.1 = add nuw nsw i64 %indvars.iv135, 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.cond11.for.inc26_crit_edge.us.unr-lcssa, label %for.body13.us, !llvm.loop !9
for.cond11.for.inc26_crit_edge.us.unr-lcssa: ; preds = %for.body13.us, %for.cond11.preheader.us
%indvars.iv135.unr = phi i64 [ 0, %for.cond11.preheader.us ], [ %indvars.iv.next136.1, %for.body13.us ]
%r.0111.us.unr = phi i32 [ 0, %for.cond11.preheader.us ], [ %cond.us.1, %for.body13.us ]
br i1 %lcmp.mod.not, label %for.cond11.for.inc26_crit_edge.us, label %for.body13.us.epil
for.body13.us.epil: ; preds = %for.cond11.for.inc26_crit_edge.us.unr-lcssa
%arrayidx17.us.epil = getelementptr inbounds [1400 x [1400 x i32]], ptr @A, i64 0, i64 %indvars.iv138, i64 %indvars.iv135.unr
%7 = load i32, ptr %arrayidx17.us.epil, align 4, !tbaa !5
%cmp18.us.epil = icmp eq i32 %7, 0
%add.us.epil = add nsw i32 %r.0111.us.unr, 1
%cond.us.epil = select i1 %cmp18.us.epil, i32 %add.us.epil, i32 0
%arrayidx23.us.epil = getelementptr inbounds [1400 x [1400 x i32]], ptr @m, i64 0, i64 %indvars.iv138, i64 %indvars.iv135.unr
store i32 %cond.us.epil, ptr %arrayidx23.us.epil, align 4, !tbaa !5
br label %for.cond11.for.inc26_crit_edge.us
for.cond11.for.inc26_crit_edge.us: ; preds = %for.cond11.for.inc26_crit_edge.us.unr-lcssa, %for.body13.us.epil
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count141
br i1 %exitcond142.not, label %for.cond29.preheader, label %for.cond11.preheader.us, !llvm.loop !11
for.body3: ; preds = %for.body3.lr.ph, %for.body3
%indvars.iv = phi i64 [ 0, %for.body3.lr.ph ], [ %indvars.iv.next, %for.body3 ]
%add.ptr = getelementptr inbounds i32, ptr %arrayidx, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %x, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp2, label %for.body3, label %for.inc5.loopexit, !llvm.loop !12
for.inc5.loopexit: ; preds = %for.body3
%.pre = load i32, ptr %y, align 4, !tbaa !5
br label %for.inc5
for.inc5: ; preds = %for.inc5.loopexit, %for.cond1.preheader
%10 = phi i32 [ %.pre, %for.inc5.loopexit ], [ %2, %for.cond1.preheader ]
%11 = phi i32 [ %8, %for.inc5.loopexit ], [ %3, %for.cond1.preheader ]
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%12 = sext i32 %10 to i64
%cmp = icmp slt i64 %indvars.iv.next133, %12
br i1 %cmp, label %for.cond1.preheader, label %for.cond8.preheader, !llvm.loop !13
for.cond29.preheader: ; preds = %for.cond11.for.inc26_crit_edge.us, %for.cond8.preheader
%cmp30122 = icmp slt i32 %11, 1
%brmerge = or i1 %cmp30122, %cmp9113
br i1 %brmerge, label %for.end63, label %for.cond32.preheader.us.preheader
for.cond32.preheader.us.preheader: ; preds = %for.cond29.preheader
%wide.trip.count156 = zext i32 %11 to i64
%wide.trip.count151 = zext i32 %10 to i64
%sext = sext i32 %10 to i64
br label %for.cond32.preheader.us
for.cond32.preheader.us: ; preds = %for.cond32.preheader.us.preheader, %for.cond32.for.inc61_crit_edge.us
%indvars.iv153 = phi i64 [ 0, %for.cond32.preheader.us.preheader ], [ %indvars.iv.next154, %for.cond32.for.inc61_crit_edge.us ]
%r.1123.us = phi i32 [ 0, %for.cond32.preheader.us.preheader ], [ %r.3.lcssa.us, %for.cond32.for.inc61_crit_edge.us ]
br label %for.cond35.preheader.us
for.body37.us: ; preds = %for.cond35.preheader.us, %for.inc55.us
%indvars.iv145 = phi i64 [ %indvars.iv143, %for.cond35.preheader.us ], [ %indvars.iv.next146, %for.inc55.us ]
%M.0117.us = phi i32 [ %11, %for.cond35.preheader.us ], [ %spec.select.us, %for.inc55.us ]
%r.3116.us = phi i32 [ %r.2119.us, %for.cond35.preheader.us ], [ %spec.select105.us, %for.inc55.us ]
%arrayidx41.us = getelementptr inbounds [1400 x [1400 x i32]], ptr @m, i64 0, i64 %indvars.iv145, i64 %indvars.iv153
%13 = load i32, ptr %arrayidx41.us, align 4, !tbaa !5
%spec.select.us = call i32 @llvm.smin.i32(i32 %M.0117.us, i32 %13)
%14 = sub nuw nsw i64 %indvars.iv145, %indvars.iv143
%15 = sext i32 %spec.select.us to i64
%cmp49.not.us = icmp slt i64 %14, %15
br i1 %cmp49.not.us, label %for.inc55.us, label %for.inc58.us
for.inc58.us: ; preds = %for.inc55.us, %for.body37.us
%r.3.lcssa.us = phi i32 [ %r.3116.us, %for.body37.us ], [ %spec.select105.us, %for.inc55.us ]
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%exitcond152.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count151
br i1 %exitcond152.not, label %for.cond32.for.inc61_crit_edge.us, label %for.cond35.preheader.us, !llvm.loop !15
for.inc55.us: ; preds = %for.body37.us
%16 = sext i32 %r.3116.us to i64
%cmp52.not.us = icmp slt i64 %14, %16
%17 = trunc i64 %14 to i32
%18 = add i32 %17, 1
%spec.select105.us = select i1 %cmp52.not.us, i32 %r.3116.us, i32 %18
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%19 = icmp slt i64 %indvars.iv.next146, %sext
br i1 %19, label %for.body37.us, label %for.inc58.us, !llvm.loop !16
for.cond35.preheader.us: ; preds = %for.cond32.preheader.us, %for.inc58.us
%indvars.iv143 = phi i64 [ 0, %for.cond32.preheader.us ], [ %indvars.iv.next144, %for.inc58.us ]
%r.2119.us = phi i32 [ %r.1123.us, %for.cond32.preheader.us ], [ %r.3.lcssa.us, %for.inc58.us ]
br label %for.body37.us
for.cond32.for.inc61_crit_edge.us: ; preds = %for.inc58.us
%indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 1
%exitcond157.not = icmp eq i64 %indvars.iv.next154, %wide.trip.count156
br i1 %exitcond157.not, label %for.end63, label %for.cond32.preheader.us, !llvm.loop !17
for.end63: ; preds = %for.cond32.for.inc61_crit_edge.us, %for.cond29.preheader, %entry, %for.cond11.preheader.lr.ph
%r.1.lcssa = phi i32 [ 0, %for.cond29.preheader ], [ 0, %for.cond11.preheader.lr.ph ], [ 0, %entry ], [ %r.3.lcssa.us, %for.cond32.for.inc61_crit_edge.us ]
%mul = mul nsw i32 %r.1.lcssa, %r.1.lcssa
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int main(){
int N,K;
scanf("%d %d",&N,&K);
int sum = 0;
int len = 0;
for(int i=0; i<N; i++){
scanf("%d",&len);
if( K-len > len ){
sum = sum + 2*len;
}else{
sum = sum + 2*( K - len );
}
}
printf("%d",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255481/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255481/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%len = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %len) #4
store i32 0, ptr %len, align 4, !tbaa !5
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %sum.1, %for.body ]
%call6 = 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 %len) #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.body: ; preds = %entry, %for.body
%i.012 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%sum.011 = phi i32 [ %sum.1, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %len)
%1 = load i32, ptr %K, align 4, !tbaa !5
%2 = load i32, ptr %len, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
%.sub = call i32 @llvm.smin.i32(i32 %sub, i32 %2)
%mul.pn = shl nsw i32 %.sub, 1
%sum.1 = add nsw i32 %mul.pn, %sum.011
%inc = add nuw nsw i32 %i.012, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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(){
int n,k,x[100],i,A=0;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++){
scanf("%d",&x[i]);
A+=x[i]<k-x[i]?x[i]:k-x[i];
}
printf("%d",A*2);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255539/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255539/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%x = 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 %x) #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
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%A.022 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = load i32, ptr %k, align 4, !tbaa !5
%sub = sub nsw i32 %2, %1
%.sub = call i32 @llvm.smin.i32(i32 %1, i32 %sub)
%add = add nsw i32 %.sub, %A.022
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%5 = shl nsw i32 %add, 1
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%A.0.lcssa = phi i32 [ 0, %entry ], [ %5, %for.end.loopexit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %A.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #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"}
|
#include <stdio.h>
#include <ctype.h>
// program by Mircea Rebengiuc
// written for codeforces round 739D3
// written on 2021.08.18
char *p2s[64] = {
"1",
"2",
"4",
"8",
"16",
"32",
"64",
"128",
"256",
"512",
"1024",
"2048",
"4096",
"8192",
"16384",
"32768",
"65536",
"131072",
"262144",
"524288",
"1048576",
"2097152",
"4194304",
"8388608",
"16777216",
"33554432",
"67108864",
"134217728",
"268435456",
"536870912",
"1073741824",
"2147483648",
"4294967296",
"8589934592",
"17179869184",
"34359738368",
"68719476736",
"137438953472",
"274877906944",
"549755813888",
"1099511627776",
"2199023255552",
"4398046511104",
"8796093022208",
"17592186044416",
"35184372088832",
"70368744177664",
"140737488355328",
"281474976710656",
"562949953421312",
"1125899906842624",
"2251799813685248",
"4503599627370496",
"9007199254740992",
"18014398509481984",
"36028797018963968",
"72057594037927936",
"144115188075855872",
"288230376151711744",
"576460752303423488",
"1152921504606846976",
"2305843009213693952",
"4611686018427387904",
"9223372036854775808",
};
char input[10 + 1 + 1];
int minOp( char a[], char b[] ){
int retval = 0;
int i = 0, j = 0;
while( a[i] != '\0' && b[j] != '\0' ){
if( a[i] == b[j] )
j++;
else
retval++;
i++;
}
while( a[i++] != '\0' )
retval++;
while( b[j++] != '\0' )
retval++;
return retval;
}
static inline int min( int a, int b ){
return a < b ? a : b;
}
int main(){
int t, p2, ans, i;
for( scanf("%d ", &t) ; t-- ; ){
scanf("%s ", input);
//fgets(input, 12, stdin);
i = 0;
while( input[i] != '\n' && input[i] != '\0' )// remove \n at end if there is any
i++;
input[i] = '\0';
ans = 100000;
for( p2 = 0 ; p2 < 64 ; p2++ )
ans = min(ans, minOp(input, p2s[p2]));
printf("%d\n", ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25559/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25559/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [2 x i8] c"1\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"2\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"4\00", align 1
@.str.3 = private unnamed_addr constant [2 x i8] c"8\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"16\00", align 1
@.str.5 = private unnamed_addr constant [3 x i8] c"32\00", align 1
@.str.6 = private unnamed_addr constant [3 x i8] c"64\00", align 1
@.str.7 = private unnamed_addr constant [4 x i8] c"128\00", align 1
@.str.8 = private unnamed_addr constant [4 x i8] c"256\00", align 1
@.str.9 = private unnamed_addr constant [4 x i8] c"512\00", align 1
@.str.10 = private unnamed_addr constant [5 x i8] c"1024\00", align 1
@.str.11 = private unnamed_addr constant [5 x i8] c"2048\00", align 1
@.str.12 = private unnamed_addr constant [5 x i8] c"4096\00", align 1
@.str.13 = private unnamed_addr constant [5 x i8] c"8192\00", align 1
@.str.14 = private unnamed_addr constant [6 x i8] c"16384\00", align 1
@.str.15 = private unnamed_addr constant [6 x i8] c"32768\00", align 1
@.str.16 = private unnamed_addr constant [6 x i8] c"65536\00", align 1
@.str.17 = private unnamed_addr constant [7 x i8] c"131072\00", align 1
@.str.18 = private unnamed_addr constant [7 x i8] c"262144\00", align 1
@.str.19 = private unnamed_addr constant [7 x i8] c"524288\00", align 1
@.str.20 = private unnamed_addr constant [8 x i8] c"1048576\00", align 1
@.str.21 = private unnamed_addr constant [8 x i8] c"2097152\00", align 1
@.str.22 = private unnamed_addr constant [8 x i8] c"4194304\00", align 1
@.str.23 = private unnamed_addr constant [8 x i8] c"8388608\00", align 1
@.str.24 = private unnamed_addr constant [9 x i8] c"16777216\00", align 1
@.str.25 = private unnamed_addr constant [9 x i8] c"33554432\00", align 1
@.str.26 = private unnamed_addr constant [9 x i8] c"67108864\00", align 1
@.str.27 = private unnamed_addr constant [10 x i8] c"134217728\00", align 1
@.str.28 = private unnamed_addr constant [10 x i8] c"268435456\00", align 1
@.str.29 = private unnamed_addr constant [10 x i8] c"536870912\00", align 1
@.str.30 = private unnamed_addr constant [11 x i8] c"1073741824\00", align 1
@.str.31 = private unnamed_addr constant [11 x i8] c"2147483648\00", align 1
@.str.32 = private unnamed_addr constant [11 x i8] c"4294967296\00", align 1
@.str.33 = private unnamed_addr constant [11 x i8] c"8589934592\00", align 1
@.str.34 = private unnamed_addr constant [12 x i8] c"17179869184\00", align 1
@.str.35 = private unnamed_addr constant [12 x i8] c"34359738368\00", align 1
@.str.36 = private unnamed_addr constant [12 x i8] c"68719476736\00", align 1
@.str.37 = private unnamed_addr constant [13 x i8] c"137438953472\00", align 1
@.str.38 = private unnamed_addr constant [13 x i8] c"274877906944\00", align 1
@.str.39 = private unnamed_addr constant [13 x i8] c"549755813888\00", align 1
@.str.40 = private unnamed_addr constant [14 x i8] c"1099511627776\00", align 1
@.str.41 = private unnamed_addr constant [14 x i8] c"2199023255552\00", align 1
@.str.42 = private unnamed_addr constant [14 x i8] c"4398046511104\00", align 1
@.str.43 = private unnamed_addr constant [14 x i8] c"8796093022208\00", align 1
@.str.44 = private unnamed_addr constant [15 x i8] c"17592186044416\00", align 1
@.str.45 = private unnamed_addr constant [15 x i8] c"35184372088832\00", align 1
@.str.46 = private unnamed_addr constant [15 x i8] c"70368744177664\00", align 1
@.str.47 = private unnamed_addr constant [16 x i8] c"140737488355328\00", align 1
@.str.48 = private unnamed_addr constant [16 x i8] c"281474976710656\00", align 1
@.str.49 = private unnamed_addr constant [16 x i8] c"562949953421312\00", align 1
@.str.50 = private unnamed_addr constant [17 x i8] c"1125899906842624\00", align 1
@.str.51 = private unnamed_addr constant [17 x i8] c"2251799813685248\00", align 1
@.str.52 = private unnamed_addr constant [17 x i8] c"4503599627370496\00", align 1
@.str.53 = private unnamed_addr constant [17 x i8] c"9007199254740992\00", align 1
@.str.54 = private unnamed_addr constant [18 x i8] c"18014398509481984\00", align 1
@.str.55 = private unnamed_addr constant [18 x i8] c"36028797018963968\00", align 1
@.str.56 = private unnamed_addr constant [18 x i8] c"72057594037927936\00", align 1
@.str.57 = private unnamed_addr constant [19 x i8] c"144115188075855872\00", align 1
@.str.58 = private unnamed_addr constant [19 x i8] c"288230376151711744\00", align 1
@.str.59 = private unnamed_addr constant [19 x i8] c"576460752303423488\00", align 1
@.str.60 = private unnamed_addr constant [20 x i8] c"1152921504606846976\00", align 1
@.str.61 = private unnamed_addr constant [20 x i8] c"2305843009213693952\00", align 1
@.str.62 = private unnamed_addr constant [20 x i8] c"4611686018427387904\00", align 1
@.str.63 = private unnamed_addr constant [20 x i8] c"9223372036854775808\00", align 1
@p2s = dso_local local_unnamed_addr global [64 x ptr] [ptr @.str, ptr @.str.1, ptr @.str.2, ptr @.str.3, ptr @.str.4, ptr @.str.5, ptr @.str.6, ptr @.str.7, ptr @.str.8, ptr @.str.9, ptr @.str.10, ptr @.str.11, ptr @.str.12, ptr @.str.13, ptr @.str.14, ptr @.str.15, ptr @.str.16, ptr @.str.17, ptr @.str.18, ptr @.str.19, ptr @.str.20, ptr @.str.21, ptr @.str.22, ptr @.str.23, ptr @.str.24, ptr @.str.25, ptr @.str.26, ptr @.str.27, ptr @.str.28, ptr @.str.29, ptr @.str.30, ptr @.str.31, ptr @.str.32, ptr @.str.33, ptr @.str.34, ptr @.str.35, ptr @.str.36, ptr @.str.37, ptr @.str.38, ptr @.str.39, ptr @.str.40, ptr @.str.41, ptr @.str.42, ptr @.str.43, ptr @.str.44, ptr @.str.45, ptr @.str.46, ptr @.str.47, ptr @.str.48, ptr @.str.49, ptr @.str.50, ptr @.str.51, ptr @.str.52, ptr @.str.53, ptr @.str.54, ptr @.str.55, ptr @.str.56, ptr @.str.57, ptr @.str.58, ptr @.str.59, ptr @.str.60, ptr @.str.61, ptr @.str.62, ptr @.str.63], align 16
@.str.64 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.65 = private unnamed_addr constant [4 x i8] c"%s \00", align 1
@input = dso_local global [12 x i8] zeroinitializer, align 1
@.str.66 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @minOp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !5
%cmp.not51 = icmp eq i8 %0, 0
br i1 %cmp.not51, label %while.cond28.preheader, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%1 = phi i8 [ %3, %while.body ], [ %0, %entry ]
%j.054 = phi i32 [ %j.1, %while.body ], [ 0, %entry ]
%i.053 = phi i32 [ %inc17, %while.body ], [ 0, %entry ]
%retval1.052 = phi i32 [ %retval1.1, %while.body ], [ 0, %entry ]
%idxprom3 = zext i32 %j.054 to i64
%arrayidx4 = getelementptr inbounds i8, ptr %b, i64 %idxprom3
%2 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%cmp6.not = icmp eq i8 %2, 0
br i1 %cmp6.not, label %while.end.split.loop.exit, label %while.body
while.body: ; preds = %land.rhs
%cmp14 = icmp ne i8 %1, %2
%inc16 = zext i1 %cmp14 to i32
%retval1.1 = add nuw nsw i32 %retval1.052, %inc16
%not.cmp14 = xor i1 %cmp14, true
%inc = zext i1 %not.cmp14 to i32
%j.1 = add nuw nsw i32 %j.054, %inc
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%inc17 = add nuw nsw i32 %i.053, 1
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %3, 0
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !8
while.end.split.loop.exit: ; preds = %land.rhs
%4 = trunc i64 %indvars.iv to i32
br label %while.end
while.end: ; preds = %while.body, %while.end.split.loop.exit
%retval1.0.lcssa.ph = phi i32 [ %retval1.052, %while.end.split.loop.exit ], [ %retval1.1, %while.body ]
%i.0.lcssa.ph = phi i32 [ %4, %while.end.split.loop.exit ], [ %inc17, %while.body ]
%j.0.lcssa.ph = phi i32 [ %j.054, %while.end.split.loop.exit ], [ %j.1, %while.body ]
%idxprom2060.phi.trans.insert = zext i32 %i.0.lcssa.ph to i64
%arrayidx2161.phi.trans.insert = getelementptr inbounds i8, ptr %a, i64 %idxprom2060.phi.trans.insert
%.pre = load i8, ptr %arrayidx2161.phi.trans.insert, align 1, !tbaa !5
%5 = icmp eq i8 %.pre, 0
br i1 %5, label %while.cond28.preheader, label %while.body25.preheader
while.body25.preheader: ; preds = %while.end
%6 = zext i32 %i.0.lcssa.ph to i64
br label %while.body25
while.cond28.preheader: ; preds = %while.body25, %entry, %while.end
%j.0.lcssa82.shrunk = phi i32 [ %j.0.lcssa.ph, %while.end ], [ 0, %entry ], [ %j.0.lcssa.ph, %while.body25 ]
%retval1.2.lcssa = phi i32 [ %retval1.0.lcssa.ph, %while.end ], [ 0, %entry ], [ %inc26, %while.body25 ]
%j.0.lcssa82 = zext i32 %j.0.lcssa82.shrunk to i64
%arrayidx3167 = getelementptr inbounds i8, ptr %b, i64 %j.0.lcssa82
%7 = load i8, ptr %arrayidx3167, align 1, !tbaa !5
%cmp33.not68 = icmp eq i8 %7, 0
br i1 %cmp33.not68, label %while.end37, label %while.body35
while.body25: ; preds = %while.body25.preheader, %while.body25
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %while.body25 ], [ %6, %while.body25.preheader ]
%retval1.263 = phi i32 [ %inc26, %while.body25 ], [ %retval1.0.lcssa.ph, %while.body25.preheader ]
%indvars.iv.next73 = add nuw i64 %indvars.iv72, 1
%inc26 = add nuw nsw i32 %retval1.263, 1
%arrayidx21 = getelementptr inbounds i8, ptr %a, i64 %indvars.iv.next73
%8 = load i8, ptr %arrayidx21, align 1, !tbaa !5
%cmp23.not = icmp eq i8 %8, 0
br i1 %cmp23.not, label %while.cond28.preheader, label %while.body25, !llvm.loop !10
while.body35: ; preds = %while.cond28.preheader, %while.body35
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %while.body35 ], [ %j.0.lcssa82, %while.cond28.preheader ]
%retval1.369 = phi i32 [ %inc36, %while.body35 ], [ %retval1.2.lcssa, %while.cond28.preheader ]
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%inc36 = add nuw nsw i32 %retval1.369, 1
%arrayidx31 = getelementptr inbounds i8, ptr %b, i64 %indvars.iv.next76
%9 = load i8, ptr %arrayidx31, align 1, !tbaa !5
%cmp33.not = icmp eq i8 %9, 0
br i1 %cmp33.not, label %while.end37, label %while.body35, !llvm.loop !11
while.end37: ; preds = %while.body35, %while.cond28.preheader
%retval1.3.lcssa = phi i32 [ %retval1.2.lcssa, %while.cond28.preheader ], [ %inc36, %while.body35 ]
ret i32 %retval1.3.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:
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.64, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !12
%dec32 = add nsw i32 %0, -1
store i32 %dec32, ptr %t, align 4, !tbaa !12
%tobool.not33 = icmp eq i32 %0, 0
br i1 %tobool.not33, label %for.end20, label %for.body
for.body: ; preds = %entry, %for.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.65, ptr noundef nonnull @input)
br label %while.cond
while.cond: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds [12 x i8], ptr @input, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %while.body [
i8 10, label %while.end
i8 0, label %while.end
]
while.body: ; preds = %while.cond
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br label %while.cond, !llvm.loop !14
while.end: ; preds = %while.cond, %while.cond
%arrayidx.le = getelementptr inbounds [12 x i8], ptr @input, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx.le, align 1, !tbaa !5
%2 = load i8, ptr @input, align 1, !tbaa !5
%cmp.not51.i = icmp eq i8 %2, 0
br i1 %cmp.not51.i, label %for.body13.us, label %for.body13
for.body13.us: ; preds = %while.end, %minOp.exit.us
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %minOp.exit.us ], [ 0, %while.end ]
%ans.031.us = phi i32 [ %cond.i.us, %minOp.exit.us ], [ 100000, %while.end ]
%arrayidx15.us = getelementptr inbounds [64 x ptr], ptr @p2s, i64 0, i64 %indvars.iv43
%3 = load ptr, ptr %arrayidx15.us, align 8, !tbaa !15
%4 = load i8, ptr %3, align 1, !tbaa !5
%cmp33.not68.i.us = icmp eq i8 %4, 0
br i1 %cmp33.not68.i.us, label %minOp.exit.us, label %while.body35.i.us
while.body35.i.us: ; preds = %for.body13.us, %while.body35.i.us
%indvars.iv75.i.us = phi i64 [ %indvars.iv.next76.i.us, %while.body35.i.us ], [ 0, %for.body13.us ]
%indvars.iv.next76.i.us = add nuw nsw i64 %indvars.iv75.i.us, 1
%arrayidx31.i.us = getelementptr inbounds i8, ptr %3, i64 %indvars.iv.next76.i.us
%5 = load i8, ptr %arrayidx31.i.us, align 1, !tbaa !5
%cmp33.not.i.us = icmp eq i8 %5, 0
br i1 %cmp33.not.i.us, label %minOp.exit.us.loopexit, label %while.body35.i.us, !llvm.loop !11
minOp.exit.us.loopexit: ; preds = %while.body35.i.us
%indvars = trunc i64 %indvars.iv.next76.i.us to i32
br label %minOp.exit.us
minOp.exit.us: ; preds = %minOp.exit.us.loopexit, %for.body13.us
%retval1.3.lcssa.i.us = phi i32 [ 0, %for.body13.us ], [ %indvars, %minOp.exit.us.loopexit ]
%cond.i.us = call i32 @llvm.smin.i32(i32 %ans.031.us, i32 %retval1.3.lcssa.i.us)
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond47.not = icmp eq i64 %indvars.iv.next44, 64
br i1 %exitcond47.not, label %for.end, label %for.body13.us, !llvm.loop !17
for.body13: ; preds = %while.end, %minOp.exit
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %minOp.exit ], [ 0, %while.end ]
%ans.031 = phi i32 [ %cond.i, %minOp.exit ], [ 100000, %while.end ]
%arrayidx15 = getelementptr inbounds [64 x ptr], ptr @p2s, i64 0, i64 %indvars.iv39
%6 = load ptr, ptr %arrayidx15, align 8, !tbaa !15
br label %land.rhs.i
land.rhs.i: ; preds = %for.body13, %while.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.body.i ], [ 0, %for.body13 ]
%7 = phi i8 [ %9, %while.body.i ], [ %2, %for.body13 ]
%j.054.i = phi i32 [ %j.1.i, %while.body.i ], [ 0, %for.body13 ]
%i.053.i = phi i32 [ %inc17.i, %while.body.i ], [ 0, %for.body13 ]
%retval1.052.i = phi i32 [ %retval1.1.i, %while.body.i ], [ 0, %for.body13 ]
%idxprom3.i = zext i32 %j.054.i to i64
%arrayidx4.i = getelementptr inbounds i8, ptr %6, i64 %idxprom3.i
%8 = load i8, ptr %arrayidx4.i, align 1, !tbaa !5
%cmp6.not.i = icmp eq i8 %8, 0
br i1 %cmp6.not.i, label %while.end.split.loop.exit.i, label %while.body.i
while.body.i: ; preds = %land.rhs.i
%cmp14.i = icmp ne i8 %7, %8
%inc16.i = zext i1 %cmp14.i to i32
%retval1.1.i = add nuw nsw i32 %retval1.052.i, %inc16.i
%not.cmp14.i = xor i1 %cmp14.i, true
%inc.i = zext i1 %not.cmp14.i to i32
%j.1.i = add nuw nsw i32 %j.054.i, %inc.i
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%inc17.i = add nuw nsw i32 %i.053.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr @input, i64 %indvars.iv.next.i
%9 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp.not.i = icmp eq i8 %9, 0
br i1 %cmp.not.i, label %while.end.i, label %land.rhs.i, !llvm.loop !8
while.end.split.loop.exit.i: ; preds = %land.rhs.i
%10 = trunc i64 %indvars.iv.i to i32
br label %while.end.i
while.end.i: ; preds = %while.body.i, %while.end.split.loop.exit.i
%retval1.0.lcssa.ph.i = phi i32 [ %retval1.052.i, %while.end.split.loop.exit.i ], [ %retval1.1.i, %while.body.i ]
%i.0.lcssa.ph.i = phi i32 [ %10, %while.end.split.loop.exit.i ], [ %inc17.i, %while.body.i ]
%j.0.lcssa.ph.i = phi i32 [ %j.054.i, %while.end.split.loop.exit.i ], [ %j.1.i, %while.body.i ]
%idxprom2060.phi.trans.insert.i = zext i32 %i.0.lcssa.ph.i to i64
%arrayidx2161.phi.trans.insert.i = getelementptr inbounds i8, ptr @input, i64 %idxprom2060.phi.trans.insert.i
%.pre.i = load i8, ptr %arrayidx2161.phi.trans.insert.i, align 1, !tbaa !5
%11 = icmp eq i8 %.pre.i, 0
br i1 %11, label %while.cond28.preheader.i, label %while.body25.i
while.cond28.preheader.i: ; preds = %while.body25.i, %while.end.i
%retval1.2.lcssa.i = phi i32 [ %retval1.0.lcssa.ph.i, %while.end.i ], [ %inc26.i, %while.body25.i ]
%j.0.lcssa82.i = zext i32 %j.0.lcssa.ph.i to i64
%arrayidx3167.i = getelementptr inbounds i8, ptr %6, i64 %j.0.lcssa82.i
%12 = load i8, ptr %arrayidx3167.i, align 1, !tbaa !5
%cmp33.not68.i = icmp eq i8 %12, 0
br i1 %cmp33.not68.i, label %minOp.exit, label %while.body35.i
while.body25.i: ; preds = %while.end.i, %while.body25.i
%indvars.iv72.i = phi i64 [ %indvars.iv.next73.i, %while.body25.i ], [ %idxprom2060.phi.trans.insert.i, %while.end.i ]
%retval1.263.i = phi i32 [ %inc26.i, %while.body25.i ], [ %retval1.0.lcssa.ph.i, %while.end.i ]
%indvars.iv.next73.i = add nuw i64 %indvars.iv72.i, 1
%inc26.i = add nuw nsw i32 %retval1.263.i, 1
%arrayidx21.i = getelementptr inbounds i8, ptr @input, i64 %indvars.iv.next73.i
%13 = load i8, ptr %arrayidx21.i, align 1, !tbaa !5
%cmp23.not.i = icmp eq i8 %13, 0
br i1 %cmp23.not.i, label %while.cond28.preheader.i, label %while.body25.i, !llvm.loop !10
while.body35.i: ; preds = %while.cond28.preheader.i, %while.body35.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i, %while.body35.i ], [ %j.0.lcssa82.i, %while.cond28.preheader.i ]
%retval1.369.i = phi i32 [ %inc36.i, %while.body35.i ], [ %retval1.2.lcssa.i, %while.cond28.preheader.i ]
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%inc36.i = add nuw nsw i32 %retval1.369.i, 1
%arrayidx31.i = getelementptr inbounds i8, ptr %6, i64 %indvars.iv.next76.i
%14 = load i8, ptr %arrayidx31.i, align 1, !tbaa !5
%cmp33.not.i = icmp eq i8 %14, 0
br i1 %cmp33.not.i, label %minOp.exit, label %while.body35.i, !llvm.loop !11
minOp.exit: ; preds = %while.body35.i, %while.cond28.preheader.i
%retval1.3.lcssa.i = phi i32 [ %retval1.2.lcssa.i, %while.cond28.preheader.i ], [ %inc36.i, %while.body35.i ]
%cond.i = call i32 @llvm.smin.i32(i32 %ans.031, i32 %retval1.3.lcssa.i)
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%exitcond.not = icmp eq i64 %indvars.iv.next40, 64
br i1 %exitcond.not, label %for.end, label %for.body13, !llvm.loop !17
for.end: ; preds = %minOp.exit, %minOp.exit.us
%.us-phi = phi i32 [ %cond.i.us, %minOp.exit.us ], [ %cond.i, %minOp.exit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.66, i32 noundef %.us-phi)
%15 = load i32, ptr %t, align 4, !tbaa !12
%dec = add nsw i32 %15, -1
store i32 %dec, ptr %t, align 4, !tbaa !12
%tobool.not = icmp eq i32 %15, 0
br i1 %tobool.not, label %for.end20, label %for.body, !llvm.loop !18
for.end20: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !9}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !6, i64 0}
!17 = distinct !{!17, !9}
!18 = distinct !{!18, !9}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int N, K, total = 0;
int i;
scanf("%d\n", &N);
scanf("%d\n", &K);
for ( i = 0; i < N; i++ ){
int x;
scanf("%d\n", &x);
if ( x > K - x ){
total += (K - x)*2;
} else {
total += (2 * x);
}
}
printf("%d\n", total);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255632/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255632/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%total.012 = phi i32 [ %total.1, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %K, align 4, !tbaa !5
%sub = sub nsw i32 %2, %1
%sub. = call i32 @llvm.smin.i32(i32 %1, i32 %sub)
%mul.pn = shl nsw i32 %sub., 1
%total.1 = add nsw i32 %mul.pn, %total.012
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
%inc = add nuw nsw i32 %i.013, 1
%3 = load i32, ptr %N, 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
%total.0.lcssa = phi i32 [ 0, %entry ], [ %total.1, %for.body ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %total.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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(){
int n;
scanf("%d",&n);
int a[n],n4=0,no=0;
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]%4==0){
n4++;
}else if(a[i]%2==1){
no++;
}
}
if(n%2==1){
if(n4>=no-1){
printf("Yes");
return 0;
}
printf("No");
return 0;
}else{
if(n4>=no){
printf("Yes");
return 0;
}
printf("No");
return 0;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255676/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255676/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca 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
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %3, 0
br i1 %cmp38, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup: ; preds = %for.inc
%4 = and i32 %9, -2147483647
%cmp14 = icmp eq i32 %4, 1
br i1 %cmp14, label %if.then15, label %if.else21
for.cond.cleanup.thread: ; preds = %entry
%5 = and i32 %3, -2147483647
%cmp1449 = icmp eq i32 %5, 1
br i1 %cmp1449, label %if.then15, label %cleanup
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%no.040 = phi i32 [ %no.1, %for.inc ], [ 0, %entry ]
%n4.039 = phi i32 [ %n4.1, %for.inc ], [ 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)
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%7 = and i32 %6, 3
%cmp4 = icmp eq i32 %7, 0
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %n4.039, 1
br label %for.inc
if.else: ; preds = %for.body
%8 = and i32 %6, -2147483647
%cmp8 = icmp eq i32 %8, 1
%inc10 = zext i1 %cmp8 to i32
%spec.select = add nsw i32 %no.040, %inc10
br label %for.inc
for.inc: ; preds = %if.else, %if.then
%n4.1 = phi i32 [ %inc, %if.then ], [ %n4.039, %if.else ]
%no.1 = phi i32 [ %no.040, %if.then ], [ %spec.select, %if.else ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then15: ; preds = %for.cond.cleanup.thread, %for.cond.cleanup
%no.0.lcssa52 = phi i32 [ 0, %for.cond.cleanup.thread ], [ %no.1, %for.cond.cleanup ]
%n4.0.lcssa51 = phi i32 [ 0, %for.cond.cleanup.thread ], [ %n4.1, %for.cond.cleanup ]
%sub = add nsw i32 %no.0.lcssa52, -1
%cmp16.not = icmp slt i32 %n4.0.lcssa51, %sub
%.str.2..str.1 = select i1 %cmp16.not, ptr @.str.2, ptr @.str.1
br label %cleanup
if.else21: ; preds = %for.cond.cleanup
%cmp22.not = icmp slt i32 %n4.1, %no.1
%spec.select57 = select i1 %cmp22.not, ptr @.str.2, ptr @.str.1
br label %cleanup
cleanup: ; preds = %if.else21, %for.cond.cleanup.thread, %if.then15
%.str.2.sink = phi ptr [ %.str.2..str.1, %if.then15 ], [ @.str.1, %for.cond.cleanup.thread ], [ %spec.select57, %if.else21 ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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: 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"}
|
#include <stdio.h>
int main(){
int a,n,s4=0,s2=0,s0=0;
scanf("%d",&n);
int i;
for(i=0;i<n;i++){
scanf("%d",&a);
if(a%4==0)s4++;
else if(a%2==0)s2++;
else s0++;
}
int res=0;
if(s2>0)s2=1;
if(s0==0)res=1;
else if(s0==0 && s4==0)res=1;
else if(s4==n)res=1;
else if(s2+s0-1<=s4)res=1;
if(res>0)printf("Yes\n");
else printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255726/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255726/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %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
%cmp46 = icmp sgt i32 %0, 0
br i1 %cmp46, label %for.body, label %if.end35
for.body: ; preds = %entry, %for.inc
%i.050 = phi i32 [ %inc10, %for.inc ], [ 0, %entry ]
%s0.049 = phi i32 [ %s0.1, %for.inc ], [ 0, %entry ]
%s2.048 = phi i32 [ %s2.1, %for.inc ], [ 0, %entry ]
%s4.047 = phi i32 [ %s4.1, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = and i32 %1, 3
%cmp2 = icmp eq i32 %2, 0
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %s4.047, 1
br label %for.inc
if.else: ; preds = %for.body
%3 = and i32 %1, 1
%cmp4 = icmp eq i32 %3, 0
br i1 %cmp4, label %if.then5, label %if.else7
if.then5: ; preds = %if.else
%inc6 = add nsw i32 %s2.048, 1
br label %for.inc
if.else7: ; preds = %if.else
%inc8 = add nsw i32 %s0.049, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.else7, %if.then5
%s4.1 = phi i32 [ %inc, %if.then ], [ %s4.047, %if.then5 ], [ %s4.047, %if.else7 ]
%s2.1 = phi i32 [ %s2.048, %if.then ], [ %inc6, %if.then5 ], [ %s2.048, %if.else7 ]
%s0.1 = phi i32 [ %s0.049, %if.then ], [ %s0.049, %if.then5 ], [ %inc8, %if.else7 ]
%inc10 = add nuw nsw i32 %i.050, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc10, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%cmp14 = icmp eq i32 %s0.1, 0
%cmp21 = icmp eq i32 %s4.1, %4
%or.cond = select i1 %cmp14, i1 true, i1 %cmp21
br i1 %or.cond, label %if.end35, label %if.else23
if.else23: ; preds = %for.end
%spec.store.select = call i32 @llvm.smin.i32(i32 %s2.1, i32 1)
%add = add i32 %s0.1, -1
%sub = add i32 %add, %spec.store.select
%cmp24.not.not = icmp sgt i32 %sub, %s4.1
%spec.select = select i1 %cmp24.not.not, ptr @str, ptr @str.3
br label %if.end35
if.end35: ; preds = %if.else23, %for.end, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ @str.3, %for.end ], [ %spec.select, %if.else23 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
; Function Attrs: 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 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(){
int t;
scanf("%d", &t);
for (int i = 1; i <= t; i++){
int k, x, ansr, ansc;
scanf("%d", &k);
x = sqrt(k);
if (x * x == k){
ansr = x;
ansc = 1;
} else {
k -= x * x + 1;
ansr = 1;
ansc = ++x;
while (ansr < x && k > 0){
ansr++;
k--;
}
while (ansc >= 1 && k > 0){
ansc--;
k--;
}
}
printf("%d %d\n", ansr, ansc);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25577/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25577/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not50 = icmp slt i32 %0, 1
br i1 %cmp.not50, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
for.body: ; preds = %entry, %if.end
%i.051 = phi i32 [ %inc24, %if.end ], [ 1, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%conv = sitofp i32 %1 to double
%call2 = call double @sqrt(double noundef %conv) #5
%conv3 = fptosi double %call2 to i32
%mul = mul nsw i32 %conv3, %conv3
%2 = load i32, ptr %k, align 4, !tbaa !5
%cmp4 = icmp eq i32 %mul, %2
br i1 %cmp4, label %if.end, label %if.else
if.else: ; preds = %for.body
%add.neg = xor i32 %mul, -1
%sub = add i32 %2, %add.neg
%inc = add i32 %conv3, 1
%cmp739 = icmp sgt i32 %conv3, 0
%cmp940 = icmp sgt i32 %sub, 0
%3 = and i1 %cmp739, %cmp940
br i1 %3, label %while.body.preheader, label %while.cond12.preheader
while.body.preheader: ; preds = %if.else
%4 = add i32 %2, -2
%5 = sub i32 %4, %mul
%6 = add nsw i32 %conv3, -1
%umin = call i32 @llvm.umin.i32(i32 %5, i32 %6)
%7 = add nuw i32 %umin, 2
%8 = sub i32 %5, %umin
br label %while.cond12.preheader
while.cond12.preheader: ; preds = %while.body.preheader, %if.else
%k.promoted43 = phi i32 [ %8, %while.body.preheader ], [ %sub, %if.else ]
%ansr.0.lcssa = phi i32 [ %7, %while.body.preheader ], [ 1, %if.else ]
%k.promoted43.fr = freeze i32 %k.promoted43
store i32 %k.promoted43.fr, ptr %k, align 4, !tbaa !5
%cmp1345 = icmp sgt i32 %conv3, -1
%cmp1646 = icmp sgt i32 %k.promoted43.fr, 0
%9 = and i1 %cmp1345, %cmp1646
br i1 %9, label %while.body19.preheader, label %if.end
while.body19.preheader: ; preds = %while.cond12.preheader
%10 = add nsw i32 %k.promoted43.fr, -1
%smin = call i32 @llvm.smin.i32(i32 %inc, i32 1)
%11 = sub i32 %inc, %smin
%umin52 = call i32 @llvm.umin.i32(i32 %10, i32 %11)
%12 = sub nsw i32 %conv3, %umin52
%13 = sub nsw i32 %10, %umin52
store i32 %13, ptr %k, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %while.cond12.preheader, %while.body19.preheader, %for.body
%ansr.1 = phi i32 [ %conv3, %for.body ], [ %ansr.0.lcssa, %while.body19.preheader ], [ %ansr.0.lcssa, %while.cond12.preheader ]
%ansc.1 = phi i32 [ 1, %for.body ], [ %12, %while.body19.preheader ], [ %inc, %while.cond12.preheader ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ansr.1, i32 noundef %ansc.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
%inc24 = add nuw nsw i32 %i.051, 1
%14 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.051, %14
br i1 %cmp.not.not, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define CARDS_MAX 5000
short a,b,A[CARDS_MAX],B[CARDS_MAX];
int main(void){
int i,j,k,m,n,t;
scanf("%hd%hd",&a,&b);
i = 0;
while(i<a)scanf("%hd",A+i++);
i = 0;
while(i<b)scanf("%hd",B+i++);
i = 0;
m = 0;
while(i < b){
n = 0;
j = 0;
k = i;
while(j < a){
if(A[j] == B[k])k++,n++;
j++;
}
if(m < n)m = n;
i++;
}
printf("%d\n",m);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255812/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255812/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%hd%hd\00", align 1
@a = dso_local global i16 0, align 2
@b = dso_local global i16 0, align 2
@.str.1 = private unnamed_addr constant [4 x i8] c"%hd\00", align 1
@A = dso_local global [5000 x i16] zeroinitializer, align 16
@B = dso_local global [5000 x i16] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a, ptr noundef nonnull @b)
%0 = load i16, ptr @a, align 2, !tbaa !5
%cmp53 = icmp sgt i16 %0, 0
br i1 %cmp53, label %while.body, label %while.cond3.preheader
while.cond3.preheader: ; preds = %while.body, %entry
%1 = load i16, ptr @b, align 2, !tbaa !5
%cmp556 = icmp sgt i16 %1, 0
br i1 %cmp556, label %while.body7, label %while.end38
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
%add.ptr = getelementptr inbounds i16, ptr @A, i64 %indvars.iv
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%2 = load i16, ptr @a, align 2, !tbaa !5
%3 = sext i16 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %while.body, label %while.cond3.preheader, !llvm.loop !9
while.cond13.preheader: ; preds = %while.body7
%conv4.lcssa = sext i16 %12 to i32
%cmp1563 = icmp sgt i16 %12, 0
br i1 %cmp1563, label %while.cond18.preheader.lr.ph, label %while.end38
while.cond18.preheader.lr.ph: ; preds = %while.cond13.preheader
%4 = load i16, ptr @a, align 2, !tbaa !5
%cmp2058 = icmp sgt i16 %4, 0
br i1 %cmp2058, label %while.cond18.preheader.us.preheader, label %while.end38
while.cond18.preheader.us.preheader: ; preds = %while.cond18.preheader.lr.ph
%conv19 = sext i16 %4 to i64
%wide.trip.count = and i64 %conv19, 4294967295
%xtraiter = and i64 %conv19, 1
%5 = icmp eq i64 %wide.trip.count, 1
%unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %while.cond18.preheader.us
while.cond18.preheader.us: ; preds = %while.cond18.preheader.us.preheader, %while.cond18.while.end32_crit_edge.us
%i.265.us = phi i32 [ %inc37.us, %while.cond18.while.end32_crit_edge.us ], [ 0, %while.cond18.preheader.us.preheader ]
%m.064.us = phi i32 [ %spec.select.us, %while.cond18.while.end32_crit_edge.us ], [ 0, %while.cond18.preheader.us.preheader ]
br i1 %5, label %while.cond18.while.end32_crit_edge.us.unr-lcssa, label %while.body22.us
while.body22.us: ; preds = %while.cond18.preheader.us, %while.body22.us
%indvars.iv73 = phi i64 [ %indvars.iv.next74.1, %while.body22.us ], [ 0, %while.cond18.preheader.us ]
%n.061.us = phi i32 [ %n.1.us.1, %while.body22.us ], [ 0, %while.cond18.preheader.us ]
%k.060.us = phi i32 [ %k.1.us.1, %while.body22.us ], [ %i.265.us, %while.cond18.preheader.us ]
%niter = phi i64 [ %niter.next.1, %while.body22.us ], [ 0, %while.cond18.preheader.us ]
%arrayidx.us = getelementptr inbounds [5000 x i16], ptr @A, i64 0, i64 %indvars.iv73
%6 = load i16, ptr %arrayidx.us, align 4, !tbaa !5
%idxprom24.us = zext i32 %k.060.us to i64
%arrayidx25.us = getelementptr inbounds [5000 x i16], ptr @B, i64 0, i64 %idxprom24.us
%7 = load i16, ptr %arrayidx25.us, align 2, !tbaa !5
%cmp27.us = icmp eq i16 %6, %7
%inc29.us = zext i1 %cmp27.us to i32
%k.1.us = add nuw nsw i32 %k.060.us, %inc29.us
%n.1.us = add nuw nsw i32 %n.061.us, %inc29.us
%indvars.iv.next74 = or i64 %indvars.iv73, 1
%arrayidx.us.1 = getelementptr inbounds [5000 x i16], ptr @A, i64 0, i64 %indvars.iv.next74
%8 = load i16, ptr %arrayidx.us.1, align 2, !tbaa !5
%idxprom24.us.1 = zext i32 %k.1.us to i64
%arrayidx25.us.1 = getelementptr inbounds [5000 x i16], ptr @B, i64 0, i64 %idxprom24.us.1
%9 = load i16, ptr %arrayidx25.us.1, align 2, !tbaa !5
%cmp27.us.1 = icmp eq i16 %8, %9
%inc29.us.1 = zext i1 %cmp27.us.1 to i32
%k.1.us.1 = add nuw nsw i32 %k.1.us, %inc29.us.1
%n.1.us.1 = add nuw nsw i32 %n.1.us, %inc29.us.1
%indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 2
%niter.next.1 = add nuw i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %while.cond18.while.end32_crit_edge.us.unr-lcssa, label %while.body22.us, !llvm.loop !11
while.cond18.while.end32_crit_edge.us.unr-lcssa: ; preds = %while.body22.us, %while.cond18.preheader.us
%n.1.us.lcssa.ph = phi i32 [ undef, %while.cond18.preheader.us ], [ %n.1.us.1, %while.body22.us ]
%indvars.iv73.unr = phi i64 [ 0, %while.cond18.preheader.us ], [ %indvars.iv.next74.1, %while.body22.us ]
%n.061.us.unr = phi i32 [ 0, %while.cond18.preheader.us ], [ %n.1.us.1, %while.body22.us ]
%k.060.us.unr = phi i32 [ %i.265.us, %while.cond18.preheader.us ], [ %k.1.us.1, %while.body22.us ]
br i1 %lcmp.mod.not, label %while.cond18.while.end32_crit_edge.us, label %while.body22.us.epil
while.body22.us.epil: ; preds = %while.cond18.while.end32_crit_edge.us.unr-lcssa
%arrayidx.us.epil = getelementptr inbounds [5000 x i16], ptr @A, i64 0, i64 %indvars.iv73.unr
%10 = load i16, ptr %arrayidx.us.epil, align 2, !tbaa !5
%idxprom24.us.epil = zext i32 %k.060.us.unr to i64
%arrayidx25.us.epil = getelementptr inbounds [5000 x i16], ptr @B, i64 0, i64 %idxprom24.us.epil
%11 = load i16, ptr %arrayidx25.us.epil, align 2, !tbaa !5
%cmp27.us.epil = icmp eq i16 %10, %11
%inc29.us.epil = zext i1 %cmp27.us.epil to i32
%n.1.us.epil = add nuw nsw i32 %n.061.us.unr, %inc29.us.epil
br label %while.cond18.while.end32_crit_edge.us
while.cond18.while.end32_crit_edge.us: ; preds = %while.cond18.while.end32_crit_edge.us.unr-lcssa, %while.body22.us.epil
%n.1.us.lcssa = phi i32 [ %n.1.us.lcssa.ph, %while.cond18.while.end32_crit_edge.us.unr-lcssa ], [ %n.1.us.epil, %while.body22.us.epil ]
%spec.select.us = tail call i32 @llvm.smax.i32(i32 %m.064.us, i32 %n.1.us.lcssa)
%inc37.us = add nuw nsw i32 %i.265.us, 1
%exitcond76.not = icmp eq i32 %inc37.us, %conv4.lcssa
br i1 %exitcond76.not, label %while.end38, label %while.cond18.preheader.us, !llvm.loop !12
while.body7: ; preds = %while.cond3.preheader, %while.body7
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %while.body7 ], [ 0, %while.cond3.preheader ]
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%add.ptr10 = getelementptr inbounds i16, ptr @B, i64 %indvars.iv70
%call11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr10)
%12 = load i16, ptr @b, align 2, !tbaa !5
%13 = sext i16 %12 to i64
%cmp5 = icmp slt i64 %indvars.iv.next71, %13
br i1 %cmp5, label %while.body7, label %while.cond13.preheader, !llvm.loop !13
while.end38: ; preds = %while.cond18.while.end32_crit_edge.us, %while.cond3.preheader, %while.cond18.preheader.lr.ph, %while.cond13.preheader
%m.0.lcssa = phi i32 [ 0, %while.cond13.preheader ], [ 0, %while.cond18.preheader.lr.ph ], [ 0, %while.cond3.preheader ], [ %spec.select.us, %while.cond18.while.end32_crit_edge.us ]
%call39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %m.0.lcssa)
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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"short", !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 <math.h>
#include <stdlib.h>
#include <string.h>
int main(void){
int len;
char s[200000];
scanf("%s",s);
len = strlen(s);
for(int i = 0;i<len;i++){
if(s[i] == '?'){
s[i] = 'D';
}
}
printf("%s\n",s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255856/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255856/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [200000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%cmp14 = icmp sgt i32 %conv, 0
br i1 %cmp14, label %iter.check, label %for.cond.cleanup
iter.check: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check17 = icmp ult i64 %wide.trip.count, 32
br i1 %min.iters.check17, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.mod.vf = and i64 %call2, 31
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %pred.store.continue80, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue80 ]
%0 = or i64 %index, 16
%1 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <16 x i8>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 16
%wide.load18 = load <16 x i8>, ptr %2, align 16, !tbaa !5
%3 = icmp eq <16 x i8> %wide.load, <i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63>
%4 = icmp eq <16 x i8> %wide.load18, <i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63>
%5 = extractelement <16 x i1> %3, i64 0
br i1 %5, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%6 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %index
store i8 68, ptr %6, align 16, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%7 = extractelement <16 x i1> %3, i64 1
br i1 %7, label %pred.store.if19, label %pred.store.continue20
pred.store.if19: ; preds = %pred.store.continue
%8 = or i64 %index, 1
%9 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %8
store i8 68, ptr %9, align 1, !tbaa !5
br label %pred.store.continue20
pred.store.continue20: ; preds = %pred.store.if19, %pred.store.continue
%10 = extractelement <16 x i1> %3, i64 2
br i1 %10, label %pred.store.if21, label %pred.store.continue22
pred.store.if21: ; preds = %pred.store.continue20
%11 = or i64 %index, 2
%12 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %11
store i8 68, ptr %12, align 2, !tbaa !5
br label %pred.store.continue22
pred.store.continue22: ; preds = %pred.store.if21, %pred.store.continue20
%13 = extractelement <16 x i1> %3, i64 3
br i1 %13, label %pred.store.if23, label %pred.store.continue24
pred.store.if23: ; preds = %pred.store.continue22
%14 = or i64 %index, 3
%15 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %14
store i8 68, ptr %15, align 1, !tbaa !5
br label %pred.store.continue24
pred.store.continue24: ; preds = %pred.store.if23, %pred.store.continue22
%16 = extractelement <16 x i1> %3, i64 4
br i1 %16, label %pred.store.if25, label %pred.store.continue26
pred.store.if25: ; preds = %pred.store.continue24
%17 = or i64 %index, 4
%18 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %17
store i8 68, ptr %18, align 4, !tbaa !5
br label %pred.store.continue26
pred.store.continue26: ; preds = %pred.store.if25, %pred.store.continue24
%19 = extractelement <16 x i1> %3, i64 5
br i1 %19, label %pred.store.if27, label %pred.store.continue28
pred.store.if27: ; preds = %pred.store.continue26
%20 = or i64 %index, 5
%21 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %20
store i8 68, ptr %21, align 1, !tbaa !5
br label %pred.store.continue28
pred.store.continue28: ; preds = %pred.store.if27, %pred.store.continue26
%22 = extractelement <16 x i1> %3, i64 6
br i1 %22, label %pred.store.if29, label %pred.store.continue30
pred.store.if29: ; preds = %pred.store.continue28
%23 = or i64 %index, 6
%24 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %23
store i8 68, ptr %24, align 2, !tbaa !5
br label %pred.store.continue30
pred.store.continue30: ; preds = %pred.store.if29, %pred.store.continue28
%25 = extractelement <16 x i1> %3, i64 7
br i1 %25, label %pred.store.if31, label %pred.store.continue32
pred.store.if31: ; preds = %pred.store.continue30
%26 = or i64 %index, 7
%27 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %26
store i8 68, ptr %27, align 1, !tbaa !5
br label %pred.store.continue32
pred.store.continue32: ; preds = %pred.store.if31, %pred.store.continue30
%28 = extractelement <16 x i1> %3, i64 8
br i1 %28, label %pred.store.if33, label %pred.store.continue34
pred.store.if33: ; preds = %pred.store.continue32
%29 = or i64 %index, 8
%30 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %29
store i8 68, ptr %30, align 8, !tbaa !5
br label %pred.store.continue34
pred.store.continue34: ; preds = %pred.store.if33, %pred.store.continue32
%31 = extractelement <16 x i1> %3, i64 9
br i1 %31, label %pred.store.if35, label %pred.store.continue36
pred.store.if35: ; preds = %pred.store.continue34
%32 = or i64 %index, 9
%33 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %32
store i8 68, ptr %33, align 1, !tbaa !5
br label %pred.store.continue36
pred.store.continue36: ; preds = %pred.store.if35, %pred.store.continue34
%34 = extractelement <16 x i1> %3, i64 10
br i1 %34, label %pred.store.if37, label %pred.store.continue38
pred.store.if37: ; preds = %pred.store.continue36
%35 = or i64 %index, 10
%36 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %35
store i8 68, ptr %36, align 2, !tbaa !5
br label %pred.store.continue38
pred.store.continue38: ; preds = %pred.store.if37, %pred.store.continue36
%37 = extractelement <16 x i1> %3, i64 11
br i1 %37, label %pred.store.if39, label %pred.store.continue40
pred.store.if39: ; preds = %pred.store.continue38
%38 = or i64 %index, 11
%39 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %38
store i8 68, ptr %39, align 1, !tbaa !5
br label %pred.store.continue40
pred.store.continue40: ; preds = %pred.store.if39, %pred.store.continue38
%40 = extractelement <16 x i1> %3, i64 12
br i1 %40, label %pred.store.if41, label %pred.store.continue42
pred.store.if41: ; preds = %pred.store.continue40
%41 = or i64 %index, 12
%42 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %41
store i8 68, ptr %42, align 4, !tbaa !5
br label %pred.store.continue42
pred.store.continue42: ; preds = %pred.store.if41, %pred.store.continue40
%43 = extractelement <16 x i1> %3, i64 13
br i1 %43, label %pred.store.if43, label %pred.store.continue44
pred.store.if43: ; preds = %pred.store.continue42
%44 = or i64 %index, 13
%45 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %44
store i8 68, ptr %45, align 1, !tbaa !5
br label %pred.store.continue44
pred.store.continue44: ; preds = %pred.store.if43, %pred.store.continue42
%46 = extractelement <16 x i1> %3, i64 14
br i1 %46, label %pred.store.if45, label %pred.store.continue46
pred.store.if45: ; preds = %pred.store.continue44
%47 = or i64 %index, 14
%48 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %47
store i8 68, ptr %48, align 2, !tbaa !5
br label %pred.store.continue46
pred.store.continue46: ; preds = %pred.store.if45, %pred.store.continue44
%49 = extractelement <16 x i1> %3, i64 15
br i1 %49, label %pred.store.if47, label %pred.store.continue48
pred.store.if47: ; preds = %pred.store.continue46
%50 = or i64 %index, 15
%51 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %50
store i8 68, ptr %51, align 1, !tbaa !5
br label %pred.store.continue48
pred.store.continue48: ; preds = %pred.store.if47, %pred.store.continue46
%52 = extractelement <16 x i1> %4, i64 0
br i1 %52, label %pred.store.if49, label %pred.store.continue50
pred.store.if49: ; preds = %pred.store.continue48
%53 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %0
store i8 68, ptr %53, align 16, !tbaa !5
br label %pred.store.continue50
pred.store.continue50: ; preds = %pred.store.if49, %pred.store.continue48
%54 = extractelement <16 x i1> %4, i64 1
br i1 %54, label %pred.store.if51, label %pred.store.continue52
pred.store.if51: ; preds = %pred.store.continue50
%55 = or i64 %index, 17
%56 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %55
store i8 68, ptr %56, align 1, !tbaa !5
br label %pred.store.continue52
pred.store.continue52: ; preds = %pred.store.if51, %pred.store.continue50
%57 = extractelement <16 x i1> %4, i64 2
br i1 %57, label %pred.store.if53, label %pred.store.continue54
pred.store.if53: ; preds = %pred.store.continue52
%58 = or i64 %index, 18
%59 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %58
store i8 68, ptr %59, align 2, !tbaa !5
br label %pred.store.continue54
pred.store.continue54: ; preds = %pred.store.if53, %pred.store.continue52
%60 = extractelement <16 x i1> %4, i64 3
br i1 %60, label %pred.store.if55, label %pred.store.continue56
pred.store.if55: ; preds = %pred.store.continue54
%61 = or i64 %index, 19
%62 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %61
store i8 68, ptr %62, align 1, !tbaa !5
br label %pred.store.continue56
pred.store.continue56: ; preds = %pred.store.if55, %pred.store.continue54
%63 = extractelement <16 x i1> %4, i64 4
br i1 %63, label %pred.store.if57, label %pred.store.continue58
pred.store.if57: ; preds = %pred.store.continue56
%64 = or i64 %index, 20
%65 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %64
store i8 68, ptr %65, align 4, !tbaa !5
br label %pred.store.continue58
pred.store.continue58: ; preds = %pred.store.if57, %pred.store.continue56
%66 = extractelement <16 x i1> %4, i64 5
br i1 %66, label %pred.store.if59, label %pred.store.continue60
pred.store.if59: ; preds = %pred.store.continue58
%67 = or i64 %index, 21
%68 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %67
store i8 68, ptr %68, align 1, !tbaa !5
br label %pred.store.continue60
pred.store.continue60: ; preds = %pred.store.if59, %pred.store.continue58
%69 = extractelement <16 x i1> %4, i64 6
br i1 %69, label %pred.store.if61, label %pred.store.continue62
pred.store.if61: ; preds = %pred.store.continue60
%70 = or i64 %index, 22
%71 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %70
store i8 68, ptr %71, align 2, !tbaa !5
br label %pred.store.continue62
pred.store.continue62: ; preds = %pred.store.if61, %pred.store.continue60
%72 = extractelement <16 x i1> %4, i64 7
br i1 %72, label %pred.store.if63, label %pred.store.continue64
pred.store.if63: ; preds = %pred.store.continue62
%73 = or i64 %index, 23
%74 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %73
store i8 68, ptr %74, align 1, !tbaa !5
br label %pred.store.continue64
pred.store.continue64: ; preds = %pred.store.if63, %pred.store.continue62
%75 = extractelement <16 x i1> %4, i64 8
br i1 %75, label %pred.store.if65, label %pred.store.continue66
pred.store.if65: ; preds = %pred.store.continue64
%76 = or i64 %index, 24
%77 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %76
store i8 68, ptr %77, align 8, !tbaa !5
br label %pred.store.continue66
pred.store.continue66: ; preds = %pred.store.if65, %pred.store.continue64
%78 = extractelement <16 x i1> %4, i64 9
br i1 %78, label %pred.store.if67, label %pred.store.continue68
pred.store.if67: ; preds = %pred.store.continue66
%79 = or i64 %index, 25
%80 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %79
store i8 68, ptr %80, align 1, !tbaa !5
br label %pred.store.continue68
pred.store.continue68: ; preds = %pred.store.if67, %pred.store.continue66
%81 = extractelement <16 x i1> %4, i64 10
br i1 %81, label %pred.store.if69, label %pred.store.continue70
pred.store.if69: ; preds = %pred.store.continue68
%82 = or i64 %index, 26
%83 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %82
store i8 68, ptr %83, align 2, !tbaa !5
br label %pred.store.continue70
pred.store.continue70: ; preds = %pred.store.if69, %pred.store.continue68
%84 = extractelement <16 x i1> %4, i64 11
br i1 %84, label %pred.store.if71, label %pred.store.continue72
pred.store.if71: ; preds = %pred.store.continue70
%85 = or i64 %index, 27
%86 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %85
store i8 68, ptr %86, align 1, !tbaa !5
br label %pred.store.continue72
pred.store.continue72: ; preds = %pred.store.if71, %pred.store.continue70
%87 = extractelement <16 x i1> %4, i64 12
br i1 %87, label %pred.store.if73, label %pred.store.continue74
pred.store.if73: ; preds = %pred.store.continue72
%88 = or i64 %index, 28
%89 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %88
store i8 68, ptr %89, align 4, !tbaa !5
br label %pred.store.continue74
pred.store.continue74: ; preds = %pred.store.if73, %pred.store.continue72
%90 = extractelement <16 x i1> %4, i64 13
br i1 %90, label %pred.store.if75, label %pred.store.continue76
pred.store.if75: ; preds = %pred.store.continue74
%91 = or i64 %index, 29
%92 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %91
store i8 68, ptr %92, align 1, !tbaa !5
br label %pred.store.continue76
pred.store.continue76: ; preds = %pred.store.if75, %pred.store.continue74
%93 = extractelement <16 x i1> %4, i64 14
br i1 %93, label %pred.store.if77, label %pred.store.continue78
pred.store.if77: ; preds = %pred.store.continue76
%94 = or i64 %index, 30
%95 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %94
store i8 68, ptr %95, align 2, !tbaa !5
br label %pred.store.continue78
pred.store.continue78: ; preds = %pred.store.if77, %pred.store.continue76
%96 = extractelement <16 x i1> %4, i64 15
br i1 %96, label %pred.store.if79, label %pred.store.continue80
pred.store.if79: ; preds = %pred.store.continue78
%97 = or i64 %index, 31
%98 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %97
store i8 68, ptr %98, align 1, !tbaa !5
br label %pred.store.continue80
pred.store.continue80: ; preds = %pred.store.if79, %pred.store.continue78
%index.next = add nuw i64 %index, 32
%99 = icmp eq i64 %index.next, %n.vec
br i1 %99, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %pred.store.continue80
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.cond.cleanup, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%min.epilog.iters.check = icmp ult i64 %n.mod.vf, 8
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.mod.vf81 = and i64 %call2, 7
%n.vec82 = sub nsw i64 %wide.trip.count, %n.mod.vf81
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %pred.store.continue101, %vec.epilog.ph
%index84 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next102, %pred.store.continue101 ]
%100 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %index84
%wide.load85 = load <8 x i8>, ptr %100, align 1, !tbaa !5
%101 = icmp eq <8 x i8> %wide.load85, <i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63>
%102 = extractelement <8 x i1> %101, i64 0
br i1 %102, label %pred.store.if86, label %pred.store.continue87
pred.store.if86: ; preds = %vec.epilog.vector.body
%103 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %index84
store i8 68, ptr %103, align 1, !tbaa !5
br label %pred.store.continue87
pred.store.continue87: ; preds = %pred.store.if86, %vec.epilog.vector.body
%104 = extractelement <8 x i1> %101, i64 1
br i1 %104, label %pred.store.if88, label %pred.store.continue89
pred.store.if88: ; preds = %pred.store.continue87
%105 = add i64 %index84, 1
%106 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %105
store i8 68, ptr %106, align 1, !tbaa !5
br label %pred.store.continue89
pred.store.continue89: ; preds = %pred.store.if88, %pred.store.continue87
%107 = extractelement <8 x i1> %101, i64 2
br i1 %107, label %pred.store.if90, label %pred.store.continue91
pred.store.if90: ; preds = %pred.store.continue89
%108 = add i64 %index84, 2
%109 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %108
store i8 68, ptr %109, align 1, !tbaa !5
br label %pred.store.continue91
pred.store.continue91: ; preds = %pred.store.if90, %pred.store.continue89
%110 = extractelement <8 x i1> %101, i64 3
br i1 %110, label %pred.store.if92, label %pred.store.continue93
pred.store.if92: ; preds = %pred.store.continue91
%111 = add i64 %index84, 3
%112 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %111
store i8 68, ptr %112, align 1, !tbaa !5
br label %pred.store.continue93
pred.store.continue93: ; preds = %pred.store.if92, %pred.store.continue91
%113 = extractelement <8 x i1> %101, i64 4
br i1 %113, label %pred.store.if94, label %pred.store.continue95
pred.store.if94: ; preds = %pred.store.continue93
%114 = add i64 %index84, 4
%115 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %114
store i8 68, ptr %115, align 1, !tbaa !5
br label %pred.store.continue95
pred.store.continue95: ; preds = %pred.store.if94, %pred.store.continue93
%116 = extractelement <8 x i1> %101, i64 5
br i1 %116, label %pred.store.if96, label %pred.store.continue97
pred.store.if96: ; preds = %pred.store.continue95
%117 = add i64 %index84, 5
%118 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %117
store i8 68, ptr %118, align 1, !tbaa !5
br label %pred.store.continue97
pred.store.continue97: ; preds = %pred.store.if96, %pred.store.continue95
%119 = extractelement <8 x i1> %101, i64 6
br i1 %119, label %pred.store.if98, label %pred.store.continue99
pred.store.if98: ; preds = %pred.store.continue97
%120 = add i64 %index84, 6
%121 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %120
store i8 68, ptr %121, align 1, !tbaa !5
br label %pred.store.continue99
pred.store.continue99: ; preds = %pred.store.if98, %pred.store.continue97
%122 = extractelement <8 x i1> %101, i64 7
br i1 %122, label %pred.store.if100, label %pred.store.continue101
pred.store.if100: ; preds = %pred.store.continue99
%123 = add i64 %index84, 7
%124 = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %123
store i8 68, ptr %124, align 1, !tbaa !5
br label %pred.store.continue101
pred.store.continue101: ; preds = %pred.store.if100, %pred.store.continue99
%index.next102 = add nuw i64 %index84, 8
%125 = icmp eq i64 %index.next102, %n.vec82
br i1 %125, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12
vec.epilog.middle.block: ; preds = %pred.store.continue101
%cmp.n83 = icmp eq i64 %n.mod.vf81, 0
br i1 %cmp.n83, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec82, %vec.epilog.middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.inc, %middle.block, %vec.epilog.middle.block, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %s) #5
ret i32 0
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %indvars.iv.ph, %for.body.preheader ]
%arrayidx = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %indvars.iv
%126 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp5 = icmp eq i8 %126, 63
br i1 %cmp5, label %if.then, label %for.inc
if.then: ; preds = %for.body
store i8 68, ptr %arrayidx, align 1, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !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 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !10, !11}
!13 = distinct !{!13, !9, !11, !10}
|
#include<stdio.h>
long long a[100034];
long long b[100034];
int main()
{
long t ,n1,n2,k,m,i,j;
scanf("%ld %ld",&n1,&n2);
scanf("%ld %ld",&k,&m);
for(i=0;i<n1;i++)
scanf("%lld",&a[i]);
for(i=0;i<n2;i++)
scanf("%lld",&b[i]);
n1=n1>n2?n1:n2;
int flag=0;
j=0;
for(i=0;i<n1;)
{ if(a[i]<b[j])
{
if (i==(k-1))
{
flag=1;
break;
}
else
i++;
}
else
{
j++;
}
if(j==n2 || i==n1)
{
flag=0;
break;
}
}
//printf("%d %d",i,j);
n1=flag==1&&(n2-j>=m)?printf("YES\n"):printf("NO\n");
return 0 ;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2559/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2559/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@a = dso_local global [100034 x i64] zeroinitializer, align 16
@b = dso_local global [100034 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"YES\0A\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"NO\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n1 = alloca i64, align 8
%n2 = alloca i64, align 8
%k = alloca i64, align 8
%m = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n1, ptr noundef nonnull %n2)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %m)
%0 = load i64, ptr %n1, align 8
%cmp54 = icmp sgt i64 %0, 0
br i1 %cmp54, label %for.body, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body, %entry
%1 = phi i64 [ %0, %entry ], [ %3, %for.body ]
%2 = load i64, ptr %n2, align 8
%cmp456 = icmp sgt i64 %2, 0
br i1 %cmp456, label %for.body5, label %for.end10
for.body: ; preds = %entry, %for.body
%i.055 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100034 x i64], ptr @a, i64 0, i64 %i.055
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.055, 1
%3 = load i64, ptr %n1, align 8
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !5
for.body5: ; preds = %for.cond3.preheader, %for.body5
%i.157 = phi i64 [ %inc9, %for.body5 ], [ 0, %for.cond3.preheader ]
%arrayidx6 = getelementptr inbounds [100034 x i64], ptr @b, i64 0, i64 %i.157
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%inc9 = add nuw nsw i64 %i.157, 1
%4 = load i64, ptr %n2, align 8
%cmp4 = icmp slt i64 %inc9, %4
br i1 %cmp4, label %for.body5, label %for.end10.loopexit, !llvm.loop !7
for.end10.loopexit: ; preds = %for.body5
%.pre = load i64, ptr %n1, align 8
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.cond3.preheader
%5 = phi i64 [ %1, %for.cond3.preheader ], [ %.pre, %for.end10.loopexit ]
%.lcssa = phi i64 [ %2, %for.cond3.preheader ], [ %4, %for.end10.loopexit ]
%cond = call i64 @llvm.smax.i64(i64 %5, i64 %.lcssa)
store i64 %cond, ptr %n1, align 8, !tbaa !8
%6 = load i64, ptr %k, align 8
%sub = add nsw i64 %6, -1
br label %for.cond12
for.cond12: ; preds = %if.end23, %for.end10
%i.2 = phi i64 [ 0, %for.end10 ], [ %i.3, %if.end23 ]
%j.0 = phi i64 [ 0, %for.end10 ], [ %j.1, %if.end23 ]
%cmp13 = icmp slt i64 %i.2, %cond
br i1 %cmp13, label %for.body14, label %cond.false34
for.body14: ; preds = %for.cond12
%arrayidx15 = getelementptr inbounds [100034 x i64], ptr @a, i64 0, i64 %i.2
%7 = load i64, ptr %arrayidx15, align 8, !tbaa !12
%arrayidx16 = getelementptr inbounds [100034 x i64], ptr @b, i64 0, i64 %j.0
%8 = load i64, ptr %arrayidx16, align 8, !tbaa !12
%cmp17 = icmp slt i64 %7, %8
br i1 %cmp17, label %if.then, label %if.else21
if.then: ; preds = %for.body14
%cmp18 = icmp eq i64 %i.2, %sub
br i1 %cmp18, label %land.lhs.true, label %if.else
if.else: ; preds = %if.then
%inc20 = add nsw i64 %i.2, 1
br label %if.end23
if.else21: ; preds = %for.body14
%inc22 = add nsw i64 %j.0, 1
br label %if.end23
if.end23: ; preds = %if.else21, %if.else
%i.3 = phi i64 [ %inc20, %if.else ], [ %i.2, %if.else21 ]
%j.1 = phi i64 [ %j.0, %if.else ], [ %inc22, %if.else21 ]
%cmp24 = icmp eq i64 %j.1, %.lcssa
%cmp25 = icmp eq i64 %i.3, %cond
%or.cond = select i1 %cmp24, i1 true, i1 %cmp25
br i1 %or.cond, label %cond.false34, label %for.cond12, !llvm.loop !14
land.lhs.true: ; preds = %if.then
%sub30 = sub nsw i64 %.lcssa, %j.0
%9 = load i64, ptr %m, align 8, !tbaa !8
%cmp31.not = icmp slt i64 %sub30, %9
br i1 %cmp31.not, label %cond.false34, label %cond.end36
cond.false34: ; preds = %if.end23, %for.cond12, %land.lhs.true
br label %cond.end36
cond.end36: ; preds = %land.lhs.true, %cond.false34
%.str.3.sink = phi ptr [ @.str.3, %cond.false34 ], [ @.str.2, %land.lhs.true ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = 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 = !{!13, !13, i64 0}
!13 = !{!"long long", !10, i64 0}
!14 = distinct !{!14, !6}
|
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p (int)(1e9 + 7)
#define ms_valtype edge
typedef struct {
int U;
int V;
int W;
}edge;
//比較関数
int compare_ms(ms_valtype a, ms_valtype b){
return a.W - b.W;
}
//昇順
void sort_sub(ms_valtype *origin, int left, int right, ms_valtype *tmp){
if(right - left > 1){
int i, j, k, half = (left + right) / 2;
sort_sub(origin, left, half, tmp);
sort_sub(origin, half, right, tmp);
for(i = left; i < right; i++){
tmp[i] = origin[i];
}
for(i = left, j = left, k = half; i < right; i++){
if(k == right){
origin[i] = tmp[j];
j++;
}
else if(compare_ms(tmp[j], tmp[k]) <= 0 && j < half){
origin[i] = tmp[j];
j++;
}
else{
origin[i] = tmp[k];
k++;
}
}
}
}
void sort(ms_valtype *origin, int N){
ms_valtype *tmp = (ms_valtype *)malloc(sizeof(ms_valtype) * N);
sort_sub(origin, 0, N, tmp);
free(tmp);
}
typedef struct {
int N;
int *u;
int *u_rank;
}union_find;
union_find *make_union_find(int N){
int i;
union_find *uf = (union_find *)malloc(sizeof(union_find));
uf->N = N;
uf->u = (int *)malloc(sizeof(int) * N);
uf->u_rank = (int *)malloc(sizeof(int) * N);
for(i = 0; i < N; i++){
(uf->u)[i] = i;
(uf->u_rank)[i] = 1;
}
return uf;
}
int root_uf(int x, union_find *uf){
int *u = uf->u;
if(u[x] == x){
return x;
}
else{
u[x] = root_uf(u[x], uf);
return u[x];
}
}
void combine_uf(int x, int y, union_find *uf){
int x_root = root_uf(x, uf);
int y_root = root_uf(y, uf);
int *u = uf->u;
int *u_rank = uf->u_rank;
if(x_root == y_root){
return;
}
else if(u_rank[x_root] < u_rank[y_root]){
u[x_root] = y_root;
u_rank[y_root] += u_rank[x_root];
u_rank[x_root] = 0;
}
else{
u[y_root] = x_root;
u_rank[x_root] += u_rank[y_root];
u_rank[y_root] = 0;
}
}
//xとyが同じ集合に属していれば1を,そうでなければ0を返す
int is_same_union_uf(int x, int y, union_find *uf){
if(root_uf(x, uf) == root_uf(y, uf)){
return 1;
}
else{
return 0;
}
}
//xが属する集合の要素数を返す
int rank_uf(int x, union_find *uf){
return (uf->u_rank)[root_uf(x, uf)];
}
int power(int a, int N){
if(N == 0){
return 1;
}
else if(N % 2 == 0){
return power((a * a) % p, N / 2);
}
else{
return (a * power(a, N - 1)) % p;
}
}
signed main(){
int N, M, X, i, j;
scanf("%lld%lld", &N, &M);
scanf("%lld", &X);
edge *Es = (edge *)malloc(sizeof(edge) * M);
for(i = 0; i < M; i++){
scanf("%lld%lld%lld", &Es[i].U, &Es[i].V, &Es[i].W);
Es[i].U--;
Es[i].V--;
}
int *MST = (int *)malloc(sizeof(int) * M);
for(i = 0; i < M; i++){
MST[i] = 0;
}
sort(Es, M);
union_find *uf;
for(i = 0; i < M; i++){
uf = make_union_find(N);
combine_uf(Es[i].U, Es[i].V, uf);
MST[i] = Es[i].W;
for(j = 0; j < M; j++){
if(j != i && is_same_union_uf(Es[j].U, Es[j].V, uf) == 0){
combine_uf(Es[j].U, Es[j].V, uf);
MST[i] += Es[j].W;
}
}
}
int less = 0, equal = 0, more = 0;
for(i = 0; i < M; i++){
if(MST[i] < X){
less++;
}
else if(MST[i] == X){
equal++;
}
else{
more++;
}
}
// printf("less = %lld\n", less);
// printf("equal = %lld\n", equal);
// printf("more = %lld\n", more);
if(equal == 0){
printf("0\n");
return 0;
}
if(MST[0] == X){
equal--;
}
int ans = (power(2, more) * (power(2, equal) - 1) * 2) % p;
printf("%lld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255942/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255942/source.c"
target datalayout = "e-m:e-p270: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.edge = type { i64, i64, i64 }
%struct.union_find = type { i64, ptr, ptr }
@.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
@.str.2 = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i64 @compare_ms(ptr nocapture noundef readonly byval(%struct.edge) align 8 %a, ptr nocapture noundef readonly byval(%struct.edge) align 8 %b) local_unnamed_addr #0 {
entry:
%W = getelementptr inbounds %struct.edge, ptr %a, i64 0, i32 2
%0 = load i64, ptr %W, align 8, !tbaa !5
%W1 = getelementptr inbounds %struct.edge, ptr %b, i64 0, i32 2
%1 = load i64, ptr %W1, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
ret i64 %sub
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort_sub(ptr noundef %origin, i64 noundef %left, i64 noundef %right, ptr noundef %tmp) local_unnamed_addr #1 {
entry:
%sub = sub nsw i64 %right, %left
%cmp = icmp sgt i64 %sub, 1
br i1 %cmp, label %if.then, label %if.end27
if.then: ; preds = %entry
%add = add nsw i64 %right, %left
%div = sdiv i64 %add, 2
tail call void @sort_sub(ptr noundef %origin, i64 noundef %left, i64 noundef %div, ptr noundef %tmp)
tail call void @sort_sub(ptr noundef %origin, i64 noundef %div, i64 noundef %right, ptr noundef %tmp)
%cmp171 = icmp slt i64 %left, %right
br i1 %cmp171, label %for.body.preheader, label %if.end27
for.body.preheader: ; preds = %if.then
%xtraiter = and i64 %sub, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader
%arrayidx.prol = getelementptr inbounds %struct.edge, ptr %tmp, i64 %left
%arrayidx2.prol = getelementptr inbounds %struct.edge, ptr %origin, i64 %left
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %arrayidx.prol, ptr noundef nonnull align 8 dereferenceable(24) %arrayidx2.prol, i64 24, i1 false), !tbaa.struct !10
%inc.prol = add nsw i64 %left, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%i.072.unr = phi i64 [ %left, %for.body.preheader ], [ %inc.prol, %for.body.prol ]
%0 = sub i64 0, %right
%1 = xor i64 %0, %left
%2 = icmp eq i64 %1, -1
br i1 %2, label %for.cond3.preheader, label %for.body
for.cond3.preheader: ; preds = %for.body, %for.body.prol.loopexit
br i1 %cmp171, label %for.body5, label %if.end27
for.body: ; preds = %for.body.prol.loopexit, %for.body
%i.072 = phi i64 [ %inc.1, %for.body ], [ %i.072.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds %struct.edge, ptr %tmp, i64 %i.072
%arrayidx2 = getelementptr inbounds %struct.edge, ptr %origin, i64 %i.072
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %arrayidx, ptr noundef nonnull align 8 dereferenceable(24) %arrayidx2, i64 24, i1 false), !tbaa.struct !10
%inc = add nsw i64 %i.072, 1
%arrayidx.1 = getelementptr inbounds %struct.edge, ptr %tmp, i64 %inc
%arrayidx2.1 = getelementptr inbounds %struct.edge, ptr %origin, i64 %inc
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %arrayidx.1, ptr noundef nonnull align 8 dereferenceable(24) %arrayidx2.1, i64 24, i1 false), !tbaa.struct !10
%inc.1 = add nsw i64 %i.072, 2
%exitcond.not.1 = icmp eq i64 %inc.1, %right
br i1 %exitcond.not.1, label %for.cond3.preheader, label %for.body, !llvm.loop !12
for.body5: ; preds = %for.cond3.preheader, %for.inc24
%i.176 = phi i64 [ %inc25, %for.inc24 ], [ %left, %for.cond3.preheader ]
%k.075 = phi i64 [ %k.1, %for.inc24 ], [ %div, %for.cond3.preheader ]
%j.074 = phi i64 [ %j.1, %for.inc24 ], [ %left, %for.cond3.preheader ]
%cmp6 = icmp eq i64 %k.075, %right
br i1 %cmp6, label %if.then7, label %if.else
if.then7: ; preds = %for.body5
%arrayidx8 = getelementptr inbounds %struct.edge, ptr %origin, i64 %i.176
%arrayidx9 = getelementptr inbounds %struct.edge, ptr %tmp, i64 %j.074
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %arrayidx8, ptr noundef nonnull align 8 dereferenceable(24) %arrayidx9, i64 24, i1 false), !tbaa.struct !10
%inc10 = add nsw i64 %j.074, 1
br label %for.inc24
if.else: ; preds = %for.body5
%arrayidx11 = getelementptr inbounds %struct.edge, ptr %tmp, i64 %j.074
%arrayidx12 = getelementptr inbounds %struct.edge, ptr %tmp, i64 %k.075
%arrayidx1270.sroa.3.0.arrayidx12.sroa_idx = getelementptr inbounds i8, ptr %arrayidx12, i64 16
%arrayidx1270.sroa.3.0.copyload = load i64, ptr %arrayidx1270.sroa.3.0.arrayidx12.sroa_idx, align 1
%arrayidx1169.sroa.3.0.arrayidx11.sroa_idx = getelementptr inbounds i8, ptr %arrayidx11, i64 16
%arrayidx1169.sroa.3.0.copyload = load i64, ptr %arrayidx1169.sroa.3.0.arrayidx11.sroa_idx, align 1
%cmp13 = icmp sle i64 %arrayidx1169.sroa.3.0.copyload, %arrayidx1270.sroa.3.0.copyload
%cmp14 = icmp slt i64 %j.074, %div
%or.cond = select i1 %cmp13, i1 %cmp14, i1 false
%arrayidx16 = getelementptr inbounds %struct.edge, ptr %origin, i64 %i.176
br i1 %or.cond, label %if.then15, label %if.else19
if.then15: ; preds = %if.else
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %arrayidx16, ptr noundef nonnull align 8 dereferenceable(24) %arrayidx11, i64 24, i1 false), !tbaa.struct !10
%inc18 = add nsw i64 %j.074, 1
br label %for.inc24
if.else19: ; preds = %if.else
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %arrayidx16, ptr noundef nonnull align 8 dereferenceable(24) %arrayidx12, i64 24, i1 false), !tbaa.struct !10
%inc22 = add nsw i64 %k.075, 1
br label %for.inc24
for.inc24: ; preds = %if.then7, %if.else19, %if.then15
%j.1 = phi i64 [ %inc10, %if.then7 ], [ %inc18, %if.then15 ], [ %j.074, %if.else19 ]
%k.1 = phi i64 [ %right, %if.then7 ], [ %k.075, %if.then15 ], [ %inc22, %if.else19 ]
%inc25 = add nsw i64 %i.176, 1
%exitcond78.not = icmp eq i64 %inc25, %right
br i1 %exitcond78.not, label %if.end27, label %for.body5, !llvm.loop !14
if.end27: ; preds = %for.inc24, %if.then, %for.cond3.preheader, %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 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) #2
; Function Attrs: nounwind uwtable
define dso_local void @sort(ptr noundef %origin, i64 noundef %N) local_unnamed_addr #4 {
entry:
%mul = mul i64 %N, 24
%call = tail call noalias ptr @malloc(i64 noundef %mul) #13
tail call void @sort_sub(ptr noundef %origin, i64 noundef 0, i64 noundef %N, ptr noundef %call)
tail call void @free(ptr noundef %call) #14
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @make_union_find(i64 noundef %N) local_unnamed_addr #7 {
entry:
%call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #13
store i64 %N, ptr %call, align 8, !tbaa !15
%mul = shl i64 %N, 3
%call2 = tail call noalias ptr @malloc(i64 noundef %mul) #13
%u = getelementptr inbounds %struct.union_find, ptr %call, i64 0, i32 1
store ptr %call2, ptr %u, align 8, !tbaa !18
%call4 = tail call noalias ptr @malloc(i64 noundef %mul) #13
%u_rank = getelementptr inbounds %struct.union_find, ptr %call, i64 0, i32 2
store ptr %call4, ptr %u_rank, align 8, !tbaa !19
%cmp20 = icmp sgt i64 %N, 0
br i1 %cmp20, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %N, 4
br i1 %min.iters.check, label %for.body.preheader23, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %N, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
%0 = getelementptr inbounds i64, ptr %call2, i64 %index
store <2 x i64> %vec.ind, ptr %0, align 8, !tbaa !11
%1 = getelementptr inbounds i64, ptr %0, i64 2
store <2 x i64> %step.add, ptr %1, align 8, !tbaa !11
%2 = getelementptr inbounds i64, ptr %call4, i64 %index
store <2 x i64> <i64 1, i64 1>, ptr %2, align 8, !tbaa !11
%3 = getelementptr inbounds i64, ptr %2, i64 2
store <2 x i64> <i64 1, i64 1>, ptr %3, align 8, !tbaa !11
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %N
br i1 %cmp.n, label %for.end, label %for.body.preheader23
for.body.preheader23: ; preds = %for.body.preheader, %middle.block
%i.021.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader23, %for.body
%i.021 = phi i64 [ %inc, %for.body ], [ %i.021.ph, %for.body.preheader23 ]
%arrayidx = getelementptr inbounds i64, ptr %call2, i64 %i.021
store i64 %i.021, ptr %arrayidx, align 8, !tbaa !11
%arrayidx7 = getelementptr inbounds i64, ptr %call4, i64 %i.021
store i64 1, ptr %arrayidx7, align 8, !tbaa !11
%inc = add nuw nsw i64 %i.021, 1
%exitcond.not = icmp eq i64 %inc, %N
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !23
for.end: ; preds = %for.body, %middle.block, %entry
ret ptr %call
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @root_uf(i64 noundef %x, ptr nocapture noundef readonly %uf) local_unnamed_addr #8 {
entry:
%u1 = getelementptr inbounds %struct.union_find, ptr %uf, i64 0, i32 1
%0 = load ptr, ptr %u1, align 8, !tbaa !18
%arrayidx = getelementptr inbounds i64, ptr %0, i64 %x
%1 = load i64, ptr %arrayidx, align 8, !tbaa !11
%cmp = icmp eq i64 %1, %x
br i1 %cmp, label %common.ret14, label %if.else
common.ret14: ; preds = %entry, %if.else
%common.ret14.op = phi i64 [ %call, %if.else ], [ %x, %entry ]
ret i64 %common.ret14.op
if.else: ; preds = %entry
%call = tail call i64 @root_uf(i64 noundef %1, ptr noundef nonnull %uf)
store i64 %call, ptr %arrayidx, align 8, !tbaa !11
br label %common.ret14
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @combine_uf(i64 noundef %x, i64 noundef %y, ptr nocapture noundef readonly %uf) local_unnamed_addr #8 {
entry:
%call = tail call i64 @root_uf(i64 noundef %x, ptr noundef %uf)
%call1 = tail call i64 @root_uf(i64 noundef %y, ptr noundef %uf)
%cmp = icmp eq i64 %call, %call1
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%u2 = getelementptr inbounds %struct.union_find, ptr %uf, i64 0, i32 1
%0 = load ptr, ptr %u2, align 8, !tbaa !18
%u_rank3 = getelementptr inbounds %struct.union_find, ptr %uf, i64 0, i32 2
%1 = load ptr, ptr %u_rank3, align 8, !tbaa !19
%arrayidx = getelementptr inbounds i64, ptr %1, i64 %call
%2 = load i64, ptr %arrayidx, align 8, !tbaa !11
%arrayidx4 = getelementptr inbounds i64, ptr %1, i64 %call1
%3 = load i64, ptr %arrayidx4, align 8, !tbaa !11
%cmp5 = icmp slt i64 %2, %3
%call.call1 = select i1 %cmp5, i64 %call, i64 %call1
%call1.call = select i1 %cmp5, i64 %call1, i64 %call
%arrayidx.arrayidx4 = select i1 %cmp5, ptr %arrayidx, ptr %arrayidx4
%arrayidx4.arrayidx = select i1 %cmp5, ptr %arrayidx4, ptr %arrayidx
%arrayidx12 = getelementptr inbounds i64, ptr %0, i64 %call.call1
store i64 %call1.call, ptr %arrayidx12, align 8, !tbaa !11
%4 = load i64, ptr %arrayidx.arrayidx4, align 8, !tbaa !11
%5 = load i64, ptr %arrayidx4.arrayidx, align 8, !tbaa !11
%add15 = add nsw i64 %5, %4
store i64 %add15, ptr %arrayidx4.arrayidx, align 8, !tbaa !11
store i64 0, ptr %arrayidx.arrayidx4, align 8, !tbaa !11
br label %cleanup
cleanup: ; preds = %if.else, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @is_same_union_uf(i64 noundef %x, i64 noundef %y, ptr nocapture noundef readonly %uf) local_unnamed_addr #8 {
entry:
%call = tail call i64 @root_uf(i64 noundef %x, ptr noundef %uf)
%call1 = tail call i64 @root_uf(i64 noundef %y, ptr noundef %uf)
%cmp = icmp eq i64 %call, %call1
%. = zext i1 %cmp to i64
ret i64 %.
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @rank_uf(i64 noundef %x, ptr nocapture noundef readonly %uf) local_unnamed_addr #8 {
entry:
%u_rank = getelementptr inbounds %struct.union_find, ptr %uf, i64 0, i32 2
%0 = load ptr, ptr %u_rank, align 8, !tbaa !19
%call = tail call i64 @root_uf(i64 noundef %x, ptr noundef %uf)
%arrayidx = getelementptr inbounds i64, ptr %0, i64 %call
%1 = load i64, ptr %arrayidx, align 8, !tbaa !11
ret i64 %1
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @power(i64 noundef %a, i64 noundef %N) local_unnamed_addr #9 {
entry:
%cmp16 = icmp eq i64 %N, 0
br i1 %cmp16, label %common.ret29, label %if.else
if.else: ; preds = %entry, %if.then2
%N.tr18 = phi i64 [ %div, %if.then2 ], [ %N, %entry ]
%a.tr17 = phi i64 [ %rem3, %if.then2 ], [ %a, %entry ]
%0 = and i64 %N.tr18, 1
%cmp1 = icmp eq i64 %0, 0
br i1 %cmp1, label %if.then2, label %if.else4
if.then2: ; preds = %if.else
%mul = mul nsw i64 %a.tr17, %a.tr17
%rem3 = urem i64 %mul, 1000000007
%div = sdiv i64 %N.tr18, 2
%cmp = icmp ult i64 %N.tr18, 2
br i1 %cmp, label %common.ret29, label %if.else
common.ret29: ; preds = %entry, %if.then2, %if.else4
%common.ret29.op = phi i64 [ %rem7, %if.else4 ], [ 1, %if.then2 ], [ 1, %entry ]
ret i64 %common.ret29.op
if.else4: ; preds = %if.else
%sub = add nsw i64 %N.tr18, -1
%call5 = tail call i64 @power(i64 noundef %a.tr17, i64 noundef %sub), !range !24
%mul6 = mul nsw i64 %call5, %a.tr17
%rem7 = srem i64 %mul6, 1000000007
br label %common.ret29
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%N = alloca i64, align 8
%M = alloca i64, align 8
%X = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #14
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %M) #14
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #14
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %X)
%0 = load i64, ptr %M, align 8, !tbaa !11
%mul = mul i64 %0, 24
%call2 = call noalias ptr @malloc(i64 noundef %mul) #13
%cmp175 = icmp sgt i64 %0, 0
br i1 %cmp175, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%mul11193 = shl i64 %0, 3
%call12194 = call noalias ptr @malloc(i64 noundef %mul11193) #13
br label %for.end19
for.body: ; preds = %entry, %for.body
%i.0176 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.edge, ptr %call2, i64 %i.0176
%V = getelementptr inbounds %struct.edge, ptr %call2, i64 %i.0176, i32 1
%W = getelementptr inbounds %struct.edge, ptr %call2, i64 %i.0176, i32 2
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %arrayidx, ptr noundef nonnull %V, ptr noundef nonnull %W)
%1 = load <2 x i64>, ptr %arrayidx, align 8, !tbaa !11
%2 = add nsw <2 x i64> %1, <i64 -1, i64 -1>
store <2 x i64> %2, ptr %arrayidx, align 8, !tbaa !11
%inc = add nuw nsw i64 %i.0176, 1
%3 = load i64, ptr %M, align 8, !tbaa !11
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !25
for.end: ; preds = %for.body
%mul11 = shl i64 %3, 3
%call12 = call noalias ptr @malloc(i64 noundef %mul11) #13
%cmp14177 = icmp sgt i64 %3, 0
br i1 %cmp14177, label %for.body15.preheader, label %for.end19
for.body15.preheader: ; preds = %for.end
call void @llvm.memset.p0.i64(ptr align 8 %call12, i8 0, i64 %mul11, i1 false), !tbaa !11
br label %for.end19
for.end19: ; preds = %for.end.thread, %for.body15.preheader, %for.end
%cmp14177197 = phi i1 [ false, %for.end.thread ], [ true, %for.body15.preheader ], [ false, %for.end ]
%call12196 = phi ptr [ %call12194, %for.end.thread ], [ %call12, %for.body15.preheader ], [ %call12, %for.end ]
%4 = phi i64 [ %0, %for.end.thread ], [ %3, %for.body15.preheader ], [ %3, %for.end ]
%mul.i = mul i64 %4, 24
%call.i = call noalias ptr @malloc(i64 noundef %mul.i) #13
call void @sort_sub(ptr noundef %call2, i64 noundef 0, i64 noundef %4, ptr noundef %call.i)
call void @free(ptr noundef %call.i) #14
br i1 %cmp14177197, label %for.body22, label %for.cond54.preheader
for.cond54.preheader: ; preds = %for.inc51, %for.end19
%.lcssa = phi i64 [ %4, %for.end19 ], [ %29, %for.inc51 ]
%cmp55184 = icmp sgt i64 %.lcssa, 0
br i1 %cmp55184, label %for.body56.lr.ph, label %if.then73
for.body56.lr.ph: ; preds = %for.cond54.preheader
%5 = load i64, ptr %X, align 8, !tbaa !11
%xtraiter = and i64 %.lcssa, 1
%6 = icmp eq i64 %.lcssa, 1
br i1 %6, label %for.end71.unr-lcssa, label %for.body56.lr.ph.new
for.body56.lr.ph.new: ; preds = %for.body56.lr.ph
%unroll_iter = and i64 %.lcssa, -2
br label %for.body56
for.body22: ; preds = %for.end19, %for.inc51
%i.2182 = phi i64 [ %inc52, %for.inc51 ], [ 0, %for.end19 ]
%7 = load i64, ptr %N, align 8, !tbaa !11
%call.i151 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #13
store i64 %7, ptr %call.i151, align 8, !tbaa !15
%mul.i152 = shl i64 %7, 3
%call2.i = call noalias ptr @malloc(i64 noundef %mul.i152) #13
%u.i = getelementptr inbounds %struct.union_find, ptr %call.i151, i64 0, i32 1
store ptr %call2.i, ptr %u.i, align 8, !tbaa !18
%call4.i = call noalias ptr @malloc(i64 noundef %mul.i152) #13
%u_rank.i = getelementptr inbounds %struct.union_find, ptr %call.i151, i64 0, i32 2
store ptr %call4.i, ptr %u_rank.i, align 8, !tbaa !19
%cmp20.i = icmp sgt i64 %7, 0
br i1 %cmp20.i, label %for.body.i.preheader, label %make_union_find.exit
for.body.i.preheader: ; preds = %for.body22
%min.iters.check = icmp ult i64 %7, 4
br i1 %min.iters.check, label %for.body.i.preheader208, label %vector.ph
vector.ph: ; preds = %for.body.i.preheader
%n.vec = and i64 %7, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
%8 = getelementptr inbounds i64, ptr %call2.i, i64 %index
store <2 x i64> %vec.ind, ptr %8, align 8, !tbaa !11
%9 = getelementptr inbounds i64, ptr %8, i64 2
store <2 x i64> %step.add, ptr %9, align 8, !tbaa !11
%10 = getelementptr inbounds i64, ptr %call4.i, i64 %index
store <2 x i64> <i64 1, i64 1>, ptr %10, align 8, !tbaa !11
%11 = getelementptr inbounds i64, ptr %10, i64 2
store <2 x i64> <i64 1, i64 1>, ptr %11, align 8, !tbaa !11
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !26
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %7, %n.vec
br i1 %cmp.n, label %make_union_find.exit, label %for.body.i.preheader208
for.body.i.preheader208: ; preds = %for.body.i.preheader, %middle.block
%i.021.i.ph = phi i64 [ 0, %for.body.i.preheader ], [ %n.vec, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader208, %for.body.i
%i.021.i = phi i64 [ %inc.i, %for.body.i ], [ %i.021.i.ph, %for.body.i.preheader208 ]
%arrayidx.i = getelementptr inbounds i64, ptr %call2.i, i64 %i.021.i
store i64 %i.021.i, ptr %arrayidx.i, align 8, !tbaa !11
%arrayidx7.i = getelementptr inbounds i64, ptr %call4.i, i64 %i.021.i
store i64 1, ptr %arrayidx7.i, align 8, !tbaa !11
%inc.i = add nuw nsw i64 %i.021.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %7
br i1 %exitcond.not.i, label %make_union_find.exit, label %for.body.i, !llvm.loop !27
make_union_find.exit: ; preds = %for.body.i, %middle.block, %for.body22
%arrayidx24 = getelementptr inbounds %struct.edge, ptr %call2, i64 %i.2182
%13 = load i64, ptr %arrayidx24, align 8, !tbaa !28
%V27 = getelementptr inbounds %struct.edge, ptr %call2, i64 %i.2182, i32 1
%14 = load i64, ptr %V27, align 8, !tbaa !29
%call.i153 = call i64 @root_uf(i64 noundef %13, ptr noundef nonnull %call.i151)
%call1.i = call i64 @root_uf(i64 noundef %14, ptr noundef nonnull %call.i151)
%cmp.i = icmp eq i64 %call.i153, %call1.i
br i1 %cmp.i, label %combine_uf.exit, label %if.else.i
if.else.i: ; preds = %make_union_find.exit
%arrayidx.i154 = getelementptr inbounds i64, ptr %call4.i, i64 %call.i153
%15 = load i64, ptr %arrayidx.i154, align 8, !tbaa !11
%arrayidx4.i = getelementptr inbounds i64, ptr %call4.i, i64 %call1.i
%16 = load i64, ptr %arrayidx4.i, align 8, !tbaa !11
%cmp5.i = icmp slt i64 %15, %16
%call.call1.i = select i1 %cmp5.i, i64 %call.i153, i64 %call1.i
%call1.call.i = select i1 %cmp5.i, i64 %call1.i, i64 %call.i153
%arrayidx.arrayidx4.i = select i1 %cmp5.i, ptr %arrayidx.i154, ptr %arrayidx4.i
%arrayidx4.arrayidx.i = select i1 %cmp5.i, ptr %arrayidx4.i, ptr %arrayidx.i154
%arrayidx12.i = getelementptr inbounds i64, ptr %call2.i, i64 %call.call1.i
store i64 %call1.call.i, ptr %arrayidx12.i, align 8, !tbaa !11
%add15.i = add nsw i64 %15, %16
store i64 %add15.i, ptr %arrayidx4.arrayidx.i, align 8, !tbaa !11
store i64 0, ptr %arrayidx.arrayidx4.i, align 8, !tbaa !11
br label %combine_uf.exit
combine_uf.exit: ; preds = %make_union_find.exit, %if.else.i
%W29 = getelementptr inbounds %struct.edge, ptr %call2, i64 %i.2182, i32 2
%17 = load i64, ptr %W29, align 8, !tbaa !5
%arrayidx30 = getelementptr inbounds i64, ptr %call12196, i64 %i.2182
store i64 %17, ptr %arrayidx30, align 8, !tbaa !11
%18 = load i64, ptr %M, align 8, !tbaa !11
%cmp32179 = icmp sgt i64 %18, 0
br i1 %cmp32179, label %for.body33, label %for.inc51
for.body33: ; preds = %combine_uf.exit, %for.inc48
%19 = phi i64 [ %27, %for.inc48 ], [ %17, %combine_uf.exit ]
%j.0180 = phi i64 [ %inc49, %for.inc48 ], [ 0, %combine_uf.exit ]
%cmp34.not = icmp eq i64 %j.0180, %i.2182
br i1 %cmp34.not, label %for.inc48, label %land.lhs.true
land.lhs.true: ; preds = %for.body33
%arrayidx35 = getelementptr inbounds %struct.edge, ptr %call2, i64 %j.0180
%20 = load i64, ptr %arrayidx35, align 8, !tbaa !28
%V38 = getelementptr inbounds %struct.edge, ptr %call2, i64 %j.0180, i32 1
%21 = load i64, ptr %V38, align 8, !tbaa !29
%call.i155 = call i64 @root_uf(i64 noundef %20, ptr noundef nonnull %call.i151)
%call1.i156 = call i64 @root_uf(i64 noundef %21, ptr noundef nonnull %call.i151)
%cmp.i157.not = icmp eq i64 %call.i155, %call1.i156
br i1 %cmp.i157.not, label %for.inc48, label %if.then
if.then: ; preds = %land.lhs.true
%22 = load i64, ptr %arrayidx35, align 8, !tbaa !28
%23 = load i64, ptr %V38, align 8, !tbaa !29
%call.i158 = call i64 @root_uf(i64 noundef %22, ptr noundef nonnull %call.i151)
%call1.i159 = call i64 @root_uf(i64 noundef %23, ptr noundef nonnull %call.i151)
%cmp.i160 = icmp eq i64 %call.i158, %call1.i159
br i1 %cmp.i160, label %combine_uf.exit173, label %if.else.i161
if.else.i161: ; preds = %if.then
%arrayidx.i164 = getelementptr inbounds i64, ptr %call4.i, i64 %call.i158
%24 = load i64, ptr %arrayidx.i164, align 8, !tbaa !11
%arrayidx4.i165 = getelementptr inbounds i64, ptr %call4.i, i64 %call1.i159
%25 = load i64, ptr %arrayidx4.i165, align 8, !tbaa !11
%cmp5.i166 = icmp slt i64 %24, %25
%call.call1.i167 = select i1 %cmp5.i166, i64 %call.i158, i64 %call1.i159
%call1.call.i168 = select i1 %cmp5.i166, i64 %call1.i159, i64 %call.i158
%arrayidx.arrayidx4.i169 = select i1 %cmp5.i166, ptr %arrayidx.i164, ptr %arrayidx4.i165
%arrayidx4.arrayidx.i170 = select i1 %cmp5.i166, ptr %arrayidx4.i165, ptr %arrayidx.i164
%arrayidx12.i171 = getelementptr inbounds i64, ptr %call2.i, i64 %call.call1.i167
store i64 %call1.call.i168, ptr %arrayidx12.i171, align 8, !tbaa !11
%add15.i172 = add nsw i64 %24, %25
store i64 %add15.i172, ptr %arrayidx4.arrayidx.i170, align 8, !tbaa !11
store i64 0, ptr %arrayidx.arrayidx4.i169, align 8, !tbaa !11
br label %combine_uf.exit173
combine_uf.exit173: ; preds = %if.then, %if.else.i161
%W46 = getelementptr inbounds %struct.edge, ptr %call2, i64 %j.0180, i32 2
%26 = load i64, ptr %W46, align 8, !tbaa !5
%add = add nsw i64 %19, %26
store i64 %add, ptr %arrayidx30, align 8, !tbaa !11
br label %for.inc48
for.inc48: ; preds = %for.body33, %land.lhs.true, %combine_uf.exit173
%27 = phi i64 [ %19, %for.body33 ], [ %19, %land.lhs.true ], [ %add, %combine_uf.exit173 ]
%inc49 = add nuw nsw i64 %j.0180, 1
%28 = load i64, ptr %M, align 8, !tbaa !11
%cmp32 = icmp slt i64 %inc49, %28
br i1 %cmp32, label %for.body33, label %for.inc51, !llvm.loop !30
for.inc51: ; preds = %for.inc48, %combine_uf.exit
%29 = phi i64 [ %18, %combine_uf.exit ], [ %28, %for.inc48 ]
%inc52 = add nuw nsw i64 %i.2182, 1
%cmp21 = icmp slt i64 %inc52, %29
br i1 %cmp21, label %for.body22, label %for.cond54.preheader, !llvm.loop !31
for.body56: ; preds = %for.inc69.1, %for.body56.lr.ph.new
%more.0188 = phi i64 [ 0, %for.body56.lr.ph.new ], [ %more.1.1, %for.inc69.1 ]
%equal.0187 = phi i64 [ 0, %for.body56.lr.ph.new ], [ %equal.1.1, %for.inc69.1 ]
%i.3185 = phi i64 [ 0, %for.body56.lr.ph.new ], [ %inc70.1, %for.inc69.1 ]
%niter = phi i64 [ 0, %for.body56.lr.ph.new ], [ %niter.next.1, %for.inc69.1 ]
%arrayidx57 = getelementptr inbounds i64, ptr %call12196, i64 %i.3185
%30 = load i64, ptr %arrayidx57, align 8, !tbaa !11
%cmp58 = icmp slt i64 %30, %5
br i1 %cmp58, label %for.inc69, label %if.else
if.else: ; preds = %for.body56
%cmp62 = icmp eq i64 %30, %5
br i1 %cmp62, label %if.then63, label %if.else65
if.then63: ; preds = %if.else
%inc64 = add nsw i64 %equal.0187, 1
br label %for.inc69
if.else65: ; preds = %if.else
%inc66 = add nsw i64 %more.0188, 1
br label %for.inc69
for.inc69: ; preds = %for.body56, %if.else65, %if.then63
%equal.1 = phi i64 [ %inc64, %if.then63 ], [ %equal.0187, %if.else65 ], [ %equal.0187, %for.body56 ]
%more.1 = phi i64 [ %more.0188, %if.then63 ], [ %inc66, %if.else65 ], [ %more.0188, %for.body56 ]
%inc70 = or i64 %i.3185, 1
%arrayidx57.1 = getelementptr inbounds i64, ptr %call12196, i64 %inc70
%31 = load i64, ptr %arrayidx57.1, align 8, !tbaa !11
%cmp58.1 = icmp slt i64 %31, %5
br i1 %cmp58.1, label %for.inc69.1, label %if.else.1
if.else.1: ; preds = %for.inc69
%cmp62.1 = icmp eq i64 %31, %5
br i1 %cmp62.1, label %if.then63.1, label %if.else65.1
if.else65.1: ; preds = %if.else.1
%inc66.1 = add nsw i64 %more.1, 1
br label %for.inc69.1
if.then63.1: ; preds = %if.else.1
%inc64.1 = add nsw i64 %equal.1, 1
br label %for.inc69.1
for.inc69.1: ; preds = %if.then63.1, %if.else65.1, %for.inc69
%equal.1.1 = phi i64 [ %inc64.1, %if.then63.1 ], [ %equal.1, %if.else65.1 ], [ %equal.1, %for.inc69 ]
%more.1.1 = phi i64 [ %more.1, %if.then63.1 ], [ %inc66.1, %if.else65.1 ], [ %more.1, %for.inc69 ]
%inc70.1 = add nuw nsw i64 %i.3185, 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.end71.unr-lcssa, label %for.body56, !llvm.loop !32
for.end71.unr-lcssa: ; preds = %for.inc69.1, %for.body56.lr.ph
%equal.1.lcssa.ph = phi i64 [ undef, %for.body56.lr.ph ], [ %equal.1.1, %for.inc69.1 ]
%more.1.lcssa.ph = phi i64 [ undef, %for.body56.lr.ph ], [ %more.1.1, %for.inc69.1 ]
%more.0188.unr = phi i64 [ 0, %for.body56.lr.ph ], [ %more.1.1, %for.inc69.1 ]
%equal.0187.unr = phi i64 [ 0, %for.body56.lr.ph ], [ %equal.1.1, %for.inc69.1 ]
%i.3185.unr = phi i64 [ 0, %for.body56.lr.ph ], [ %inc70.1, %for.inc69.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end71, label %for.body56.epil
for.body56.epil: ; preds = %for.end71.unr-lcssa
%arrayidx57.epil = getelementptr inbounds i64, ptr %call12196, i64 %i.3185.unr
%32 = load i64, ptr %arrayidx57.epil, align 8, !tbaa !11
%cmp58.epil = icmp slt i64 %32, %5
br i1 %cmp58.epil, label %for.end71, label %if.else.epil
if.else.epil: ; preds = %for.body56.epil
%cmp62.epil = icmp eq i64 %32, %5
br i1 %cmp62.epil, label %if.then63.epil, label %if.else65.epil
if.else65.epil: ; preds = %if.else.epil
%inc66.epil = add nsw i64 %more.0188.unr, 1
br label %for.end71
if.then63.epil: ; preds = %if.else.epil
%inc64.epil = add nsw i64 %equal.0187.unr, 1
br label %for.end71
for.end71: ; preds = %for.body56.epil, %if.else65.epil, %if.then63.epil, %for.end71.unr-lcssa
%equal.1.lcssa = phi i64 [ %equal.1.lcssa.ph, %for.end71.unr-lcssa ], [ %inc64.epil, %if.then63.epil ], [ %equal.0187.unr, %if.else65.epil ], [ %equal.0187.unr, %for.body56.epil ]
%more.1.lcssa = phi i64 [ %more.1.lcssa.ph, %for.end71.unr-lcssa ], [ %more.0188.unr, %if.then63.epil ], [ %inc66.epil, %if.else65.epil ], [ %more.0188.unr, %for.body56.epil ]
%cmp72 = icmp eq i64 %equal.1.lcssa, 0
br i1 %cmp72, label %if.then73, label %if.end75
if.then73: ; preds = %for.cond54.preheader, %for.end71
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.end75: ; preds = %for.end71
%33 = load i64, ptr %call12196, align 8, !tbaa !11
%34 = load i64, ptr %X, align 8, !tbaa !11
%cmp77 = icmp eq i64 %33, %34
%dec79 = sext i1 %cmp77 to i64
%spec.select = add nsw i64 %equal.1.lcssa, %dec79
%call81 = call i64 @power(i64 noundef 2, i64 noundef %more.1.lcssa), !range !24
%call82 = call i64 @power(i64 noundef 2, i64 noundef %spec.select), !range !24
%sub = add nsw i64 %call82, -1
%mul83 = shl nsw i64 %call81, 1
%mul84 = mul i64 %mul83, %sub
%rem = srem i64 %mul84, 1000000007
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %rem)
br label %cleanup
cleanup: ; preds = %if.end75, %if.then73
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %X) #14
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %M) #14
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #14
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #11
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #12
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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { 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 #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 = { nofree nounwind }
attributes #12 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #13 = { nounwind allocsize(0) }
attributes #14 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 16}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{i64 0, i64 8, !11, i64 8, i64 8, !11, i64 16, i64 8, !11}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !7, i64 0}
!16 = !{!"", !7, i64 0, !17, i64 8, !17, i64 16}
!17 = !{!"any pointer", !8, i64 0}
!18 = !{!16, !17, i64 8}
!19 = !{!16, !17, i64 16}
!20 = distinct !{!20, !13, !21, !22}
!21 = !{!"llvm.loop.isvectorized", i32 1}
!22 = !{!"llvm.loop.unroll.runtime.disable"}
!23 = distinct !{!23, !13, !22, !21}
!24 = !{i64 -1000000006, i64 1000000007}
!25 = distinct !{!25, !13}
!26 = distinct !{!26, !13, !21, !22}
!27 = distinct !{!27, !13, !22, !21}
!28 = !{!6, !7, i64 0}
!29 = !{!6, !7, i64 8}
!30 = distinct !{!30, !13}
!31 = distinct !{!31, !13}
!32 = distinct !{!32, !13}
|
#include<stdio.h>
int main(void){
long long int N,A,B;
long long int i;
long long int h[100000];
long long int K;
long long int left,right;
long long int sum;
scanf("%lld %lld %lld",&N,&A,&B);
//printf("%d\n", N);
for(i=0;i<N;++i){
scanf("%lld",&h[i]);
//printf("h[%lld]=%lld\n", i,h[i]);
}
left=0;
right=1000000000;
K=(right+left)/2;
//printf("%d\n", K);
while(1){
sum=0;
for(i=0;i<N;i++){
if(h[i]-K*B > 0){
sum += (h[i]-K*B)%(A-B) ? (h[i]-B*K)/(A-B)+1 :(h[i]-B*K)/(A-B);
}
}
if(sum <= K){
right=(right+left)/(long long int)2;
}else{
left=(right+left)/(long long int)2;
}
//printf("%lld,%lld\n", left,right);
K=(right+left)/2;
if(left==right-1){
break;
}
}
printf("%lld\n", right);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255986/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255986/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%A = alloca i64, align 8
%B = alloca i64, align 8
%h = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp62 = icmp sgt i64 %0, 0
br i1 %cmp62, label %for.body, label %while.cond.preheader76
while.cond.preheader: ; preds = %for.body
%cmp364 = icmp sgt i64 %4, 0
%1 = load i64, ptr %B, align 8
%2 = load i64, ptr %A, align 8
%sub10 = sub nsw i64 %2, %1
br i1 %cmp364, label %while.cond.us, label %while.cond.preheader76
while.cond.preheader76: ; preds = %entry, %while.cond.preheader
br label %while.cond
while.cond.us: ; preds = %while.cond.preheader, %for.cond2.for.end25_crit_edge.us
%K.0.us = phi i64 [ %div34.us, %for.cond2.for.end25_crit_edge.us ], [ 500000000, %while.cond.preheader ]
%left.0.us = phi i64 [ %div31.us.left.0.us, %for.cond2.for.end25_crit_edge.us ], [ 0, %while.cond.preheader ]
%right.0.us = phi i64 [ %right.0.us.div31.us, %for.cond2.for.end25_crit_edge.us ], [ 1000000000, %while.cond.preheader ]
%mul.us = mul nsw i64 %1, %K.0.us
br label %for.body4.us
for.body4.us: ; preds = %while.cond.us, %for.inc23.us
%sum.066.us = phi i64 [ 0, %while.cond.us ], [ %sum.1.us, %for.inc23.us ]
%i.165.us = phi i64 [ 0, %while.cond.us ], [ %inc24.us, %for.inc23.us ]
%arrayidx5.us = getelementptr inbounds [100000 x i64], ptr %h, i64 0, i64 %i.165.us
%3 = load i64, ptr %arrayidx5.us, align 8, !tbaa !5
%sub.us = sub nsw i64 %3, %mul.us
%cmp6.us = icmp sgt i64 %sub.us, 0
br i1 %cmp6.us, label %if.then.us, label %for.inc23.us
if.then.us: ; preds = %for.body4.us
%rem.us = srem i64 %sub.us, %sub10
%tobool.not.us = icmp ne i64 %rem.us, 0
%div21.us = sdiv i64 %sub.us, %sub10
%add16.us = zext i1 %tobool.not.us to i64
%cond.us = add nsw i64 %div21.us, %add16.us
%add22.us = add nsw i64 %cond.us, %sum.066.us
br label %for.inc23.us
for.inc23.us: ; preds = %if.then.us, %for.body4.us
%sum.1.us = phi i64 [ %add22.us, %if.then.us ], [ %sum.066.us, %for.body4.us ]
%inc24.us = add nuw nsw i64 %i.165.us, 1
%exitcond.not = icmp eq i64 %inc24.us, %4
br i1 %exitcond.not, label %for.cond2.for.end25_crit_edge.us, label %for.body4.us, !llvm.loop !9
for.cond2.for.end25_crit_edge.us: ; preds = %for.inc23.us
%cmp26.not.us = icmp sgt i64 %sum.1.us, %K.0.us
%add30.us = add nsw i64 %right.0.us, %left.0.us
%div31.us = sdiv i64 %add30.us, 2
%div31.us.left.0.us = select i1 %cmp26.not.us, i64 %div31.us, i64 %left.0.us
%right.0.us.div31.us = select i1 %cmp26.not.us, i64 %right.0.us, i64 %div31.us
%add33.us = add nsw i64 %right.0.us.div31.us, %div31.us.left.0.us
%div34.us = sdiv i64 %add33.us, 2
%sub35.us = add nsw i64 %right.0.us.div31.us, -1
%cmp36.us = icmp eq i64 %div31.us.left.0.us, %sub35.us
br i1 %cmp36.us, label %while.end, label %while.cond.us
for.body: ; preds = %entry, %for.body
%i.063 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr %h, i64 0, i64 %i.063
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.063, 1
%4 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %4
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
while.cond: ; preds = %while.cond.preheader76, %while.cond
%K.0 = phi i64 [ %div34, %while.cond ], [ 500000000, %while.cond.preheader76 ]
%left.0 = phi i64 [ %div31.left.0, %while.cond ], [ 0, %while.cond.preheader76 ]
%right.0 = phi i64 [ %right.0.div31, %while.cond ], [ 1000000000, %while.cond.preheader76 ]
%cmp26.not = icmp slt i64 %K.0, 0
%add30 = add nsw i64 %right.0, %left.0
%div31 = sdiv i64 %add30, 2
%div31.left.0 = select i1 %cmp26.not, i64 %div31, i64 %left.0
%right.0.div31 = select i1 %cmp26.not, i64 %right.0, i64 %div31
%add33 = add nsw i64 %right.0.div31, %div31.left.0
%div34 = sdiv i64 %add33, 2
%sub35 = add nsw i64 %right.0.div31, -1
%cmp36 = icmp eq i64 %div31.left.0, %sub35
br i1 %cmp36, label %while.end, label %while.cond
while.end: ; preds = %while.cond, %for.cond2.for.end25_crit_edge.us
%.us-phi = phi i64 [ %right.0.us.div31.us, %for.cond2.for.end25_crit_edge.us ], [ %right.0.div31, %while.cond ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int t, a, b, c, bet, tot;
int main()
{
scanf("%d", &t);
while (t >= 1) {
scanf("%d %d %d", &a, &b, &c);
bet = a-b;
if (bet < 0)
bet *= -1;
tot = 2*bet;
if (a > tot || b > tot || c > tot)
printf("-1\n");
else
if (c + bet <= tot)
printf("%d\n", c + bet);
else
printf("%d\n", c + bet - tot);
t--;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25605/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25605/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@t = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@a = dso_local global i32 0, align 4
@b = dso_local global i32 0, align 4
@c = dso_local global i32 0, align 4
@bet = dso_local local_unnamed_addr global i32 0, align 4
@tot = dso_local local_unnamed_addr global i32 0, align 4
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
%.pr = load i32, ptr @t, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %.pr, 0
br i1 %cmp20, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end19
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @a, ptr noundef nonnull @b, ptr noundef nonnull @c)
%0 = load i32, ptr @a, align 4, !tbaa !5
%1 = load i32, ptr @b, align 4
%sub = sub nsw i32 %0, %1
%spec.select = tail call i32 @llvm.abs.i32(i32 %sub, i1 true)
store i32 %spec.select, ptr @bet, align 4, !tbaa !5
%mul3 = shl nuw nsw i32 %spec.select, 1
store i32 %mul3, ptr @tot, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, %mul3
%cmp5 = icmp sgt i32 %1, %mul3
%or.cond = select i1 %cmp4, i1 true, i1 %cmp5
br i1 %or.cond, label %if.then8, label %lor.lhs.false6
lor.lhs.false6: ; preds = %while.body
%2 = load i32, ptr @c, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %2, %mul3
br i1 %cmp7, label %if.then8, label %if.else
if.then8: ; preds = %lor.lhs.false6, %while.body
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end19
if.else: ; preds = %lor.lhs.false6
%add = add nsw i32 %2, %spec.select
%cmp10.not = icmp sgt i32 %add, %mul3
br i1 %cmp10.not, label %if.else14, label %if.then11
if.then11: ; preds = %if.else
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %add)
br label %if.end19
if.else14: ; preds = %if.else
%sub16 = sub nsw i32 %add, %mul3
%call17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sub16)
br label %if.end19
if.end19: ; preds = %if.then11, %if.else14, %if.then8
%3 = load i32, ptr @t, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr @t, align 4, !tbaa !5
%cmp = icmp sgt i32 %3, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end19, %entry
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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int cmpnum(const void * n1, const void * n2) {
if (*(long *)n1 > *(long *)n2) {
return -1;
}
else if (*(long *)n1 < *(long *)n2) {
return 1;
}
else {
return 0;
}
}
int cmpnum2(const void * n1, const void * n2) {
if (labs(*(long *)n1) > labs(*(long *)n2)) {
return 1;
}
else if (labs(*(long *)n1) < labs(*(long *)n2)) {
return -1;
}
else {
return 0;
}
}
int main(void) {
long n,k;
scanf("%ld %ld", &n, &k);
long a[n];
long plus = 0, zero = 0, minus = 0;
for (long i = 0; i < n; i++) {
scanf("%ld", &a[i]);
if (a[i] > 0) {
plus++;
} else if (a[i] == 0) {
zero++;
} else {
minus++;
}
}
qsort(a, n, sizeof(long), cmpnum);
long mod = pow(10,9)+7;
int flag = 0;
long pairs = minus/2;
if (k/2 < pairs) {
pairs = k/2;
}
if (plus+pairs*2 >= k) {
flag = 1;
} else if (zero == 0) {
flag = -1;
}
long ans;
long p_cur,m_cur,left,p_left,m_left;
long tmp1,tmp2;
if (flag == 1) {
ans = 1;
p_cur = 0;
m_cur = n-1;
left = k;
p_left = plus;
m_left = minus/2*2;
if (k%2 == 1) {
ans = a[0];
p_cur++;
left--;
p_left--;
}
while (left > 0) {
if (p_left == 0) {
ans *= -a[m_cur];
ans %= mod;
ans *= -a[m_cur-1];
ans %= mod;
left -= 2;
m_cur -= 2;
} else if (m_left == 0) {
ans *= a[p_cur];
ans %= mod;
ans *= a[p_cur+1];
ans %= mod;
left -= 2;
p_cur += 2;
} else {
tmp1 = a[p_cur]*a[p_cur+1];
tmp2 = (-a[m_cur])*(-a[m_cur-1]);
if (tmp1 >= tmp2) {
ans *= a[p_cur];
ans %= mod;
ans *= a[p_cur+1];
ans %= mod;
left -= 2;
p_cur += 2;
} else {
ans *= -a[m_cur];
ans %= mod;
ans *= -a[m_cur-1];
ans %= mod;
left -= 2;
m_cur -= 2;
}
}
}
printf("%ld\n", ans);
} else if (flag == -1) {
qsort(a, n, sizeof(long), cmpnum2);
ans = 1;
for (long i = 0; i < k; i++) {
ans *= (mod+a[i]);
ans %= mod;
}
printf("%ld\n", ans);
} else {
printf("0\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256093/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256093/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmpnum(ptr nocapture noundef readonly %n1, ptr nocapture noundef readonly %n2) #0 {
entry:
%0 = load i64, ptr %n1, align 8, !tbaa !5
%1 = load i64, ptr %n2, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmpnum2(ptr nocapture noundef readonly %n1, ptr nocapture noundef readonly %n2) #1 {
entry:
%0 = load i64, ptr %n1, align 8, !tbaa !5
%1 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
%2 = load i64, ptr %n2, align 8, !tbaa !5
%3 = tail call i64 @llvm.abs.i64(i64 %2, i1 true)
%cmp = icmp ugt i64 %1, %3
%cmp1 = icmp ult i64 %1, %3
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp195 = icmp sgt i64 %2, 0
br i1 %cmp195, label %for.body, label %for.cond.cleanup
for.cond.cleanup.loopexit: ; preds = %for.inc
%3 = icmp eq i64 %zero.1, 0
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%minus.0.lcssa = phi i64 [ 0, %entry ], [ %minus.1, %for.cond.cleanup.loopexit ]
%zero.0.lcssa = phi i1 [ true, %entry ], [ %3, %for.cond.cleanup.loopexit ]
%plus.0.lcssa = phi i64 [ 0, %entry ], [ %plus.1, %for.cond.cleanup.loopexit ]
%.lcssa = phi i64 [ %2, %entry ], [ %6, %for.cond.cleanup.loopexit ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.lcssa, i64 noundef 8, ptr noundef nonnull @cmpnum) #10
%div = sdiv i64 %minus.0.lcssa, 2
%4 = load i64, ptr %k, align 8, !tbaa !5
%div13 = sdiv i64 %4, 2
%spec.select = call i64 @llvm.smin.i64(i64 %div13, i64 %div)
%mul = shl nsw i64 %spec.select, 1
%add19 = add nsw i64 %mul, %plus.0.lcssa
%cmp20.not.not = icmp slt i64 %add19, %4
br i1 %cmp20.not.not, label %if.else109, label %if.then31
for.body: ; preds = %entry, %for.inc
%plus.0199 = phi i64 [ %plus.1, %for.inc ], [ 0, %entry ]
%zero.0198 = phi i64 [ %zero.1, %for.inc ], [ 0, %entry ]
%minus.0197 = phi i64 [ %minus.1, %for.inc ], [ 0, %entry ]
%i.0196 = phi i64 [ %inc11, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.0196
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%5 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp3 = icmp sgt i64 %5, 0
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i64 %plus.0199, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp5 = icmp eq i64 %5, 0
br i1 %cmp5, label %if.then6, label %if.else8
if.then6: ; preds = %if.else
%inc7 = add nsw i64 %zero.0198, 1
br label %for.inc
if.else8: ; preds = %if.else
%inc9 = add nsw i64 %minus.0197, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.else8, %if.then6
%minus.1 = phi i64 [ %minus.0197, %if.then ], [ %minus.0197, %if.then6 ], [ %inc9, %if.else8 ]
%zero.1 = phi i64 [ %zero.0198, %if.then ], [ %inc7, %if.then6 ], [ %zero.0198, %if.else8 ]
%plus.1 = phi i64 [ %inc, %if.then ], [ %plus.0199, %if.then6 ], [ %plus.0199, %if.else8 ]
%inc11 = add nuw nsw i64 %i.0196, 1
%6 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc11, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !9
if.then31: ; preds = %for.cond.cleanup
%7 = load i64, ptr %n, align 8, !tbaa !5
%sub = add nsw i64 %7, -1
%8 = and i64 %4, -9223372036854775807
%cmp34 = icmp eq i64 %8, 1
br i1 %cmp34, label %if.then36, label %if.end40
if.then36: ; preds = %if.then31
%9 = load i64, ptr %vla, align 16, !tbaa !5
%dec = add nsw i64 %4, -1
%dec39 = add nsw i64 %plus.0.lcssa, -1
br label %if.end40
if.end40: ; preds = %if.then36, %if.then31
%ans.0 = phi i64 [ %9, %if.then36 ], [ 1, %if.then31 ]
%p_cur.0 = phi i64 [ 1, %if.then36 ], [ 0, %if.then31 ]
%left.0 = phi i64 [ %dec, %if.then36 ], [ %4, %if.then31 ]
%p_left.0 = phi i64 [ %dec39, %if.then36 ], [ %plus.0.lcssa, %if.then31 ]
%cmp41203 = icmp sgt i64 %left.0, 0
br i1 %cmp41203, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %if.end40
%cmp43 = icmp eq i64 %p_left.0, 0
br i1 %cmp43, label %while.body.us, label %while.body.lr.ph.split
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%left.1207.us = phi i64 [ %left.2.us, %while.body.us ], [ %left.0, %while.body.lr.ph ]
%m_cur.0206.us = phi i64 [ %sub56.us, %while.body.us ], [ %sub, %while.body.lr.ph ]
%ans.1204.us = phi i64 [ %ans.2.us, %while.body.us ], [ %ans.0, %while.body.lr.ph ]
%arrayidx46.us = getelementptr inbounds i64, ptr %vla, i64 %m_cur.0206.us
%10 = load i64, ptr %arrayidx46.us, align 8, !tbaa !5
%11 = mul i64 %ans.1204.us, %10
%mul48.us = sub i64 0, %11
%rem49.us = srem i64 %mul48.us, 1000000007
%arrayidx51.us = getelementptr i64, ptr %arrayidx46.us, i64 -1
%12 = load i64, ptr %arrayidx51.us, align 8, !tbaa !5
%13 = mul i64 %12, %rem49.us
%mul53.us = sub i64 0, %13
%sub56.us = add nsw i64 %m_cur.0206.us, -2
%left.2.us = add nsw i64 %left.1207.us, -2
%ans.2.us = srem i64 %mul53.us, 1000000007
%cmp41.us = icmp ugt i64 %left.1207.us, 2
br i1 %cmp41.us, label %while.body.us, label %while.end, !llvm.loop !11
while.body.lr.ph.split: ; preds = %while.body.lr.ph
%minus.0.off = add i64 %minus.0.lcssa, 1
%cmp58 = icmp ult i64 %minus.0.off, 3
br i1 %cmp58, label %while.body.us209, label %while.body
while.body.us209: ; preds = %while.body.lr.ph.split, %while.body.us209
%left.1207.us210 = phi i64 [ %left.2.us218, %while.body.us209 ], [ %left.0, %while.body.lr.ph.split ]
%p_cur.1205.us212 = phi i64 [ %add69.us, %while.body.us209 ], [ %p_cur.0, %while.body.lr.ph.split ]
%ans.1204.us213 = phi i64 [ %ans.2.us219, %while.body.us209 ], [ %ans.0, %while.body.lr.ph.split ]
%arrayidx61.us = getelementptr inbounds i64, ptr %vla, i64 %p_cur.1205.us212
%14 = load i64, ptr %arrayidx61.us, align 8, !tbaa !5
%mul62.us = mul nsw i64 %14, %ans.1204.us213
%rem63.us = srem i64 %mul62.us, 1000000007
%arrayidx65.us = getelementptr i64, ptr %arrayidx61.us, i64 1
%15 = load i64, ptr %arrayidx65.us, align 8, !tbaa !5
%mul66.us = mul nsw i64 %rem63.us, %15
%add69.us = add nuw nsw i64 %p_cur.1205.us212, 2
%left.2.us218 = add nsw i64 %left.1207.us210, -2
%ans.2.us219 = srem i64 %mul66.us, 1000000007
%cmp41.us220 = icmp ugt i64 %left.1207.us210, 2
br i1 %cmp41.us220, label %while.body.us209, label %while.end, !llvm.loop !11
while.body: ; preds = %while.body.lr.ph.split, %if.end107
%left.1207 = phi i64 [ %left.2, %if.end107 ], [ %left.0, %while.body.lr.ph.split ]
%m_cur.0206 = phi i64 [ %m_cur.1, %if.end107 ], [ %sub, %while.body.lr.ph.split ]
%p_cur.1205 = phi i64 [ %p_cur.2, %if.end107 ], [ %p_cur.0, %while.body.lr.ph.split ]
%ans.1204 = phi i64 [ %ans.2, %if.end107 ], [ %ans.0, %while.body.lr.ph.split ]
%arrayidx71 = getelementptr inbounds i64, ptr %vla, i64 %p_cur.1205
%16 = load i64, ptr %arrayidx71, align 8, !tbaa !5
%arrayidx73 = getelementptr i64, ptr %arrayidx71, i64 1
%17 = load i64, ptr %arrayidx73, align 8, !tbaa !5
%mul74 = mul nsw i64 %17, %16
%arrayidx75 = getelementptr inbounds i64, ptr %vla, i64 %m_cur.0206
%18 = load i64, ptr %arrayidx75, align 8, !tbaa !5
%arrayidx78 = getelementptr i64, ptr %arrayidx75, i64 -1
%19 = load i64, ptr %arrayidx78, align 8, !tbaa !5
%mul80 = mul nsw i64 %19, %18
%cmp81.not = icmp slt i64 %mul74, %mul80
br i1 %cmp81.not, label %if.else93, label %if.then83
if.then83: ; preds = %while.body
%mul85 = mul nsw i64 %16, %ans.1204
%rem86 = srem i64 %mul85, 1000000007
%mul89 = mul nsw i64 %rem86, %17
%add92 = add nsw i64 %p_cur.1205, 2
br label %if.end107
if.else93: ; preds = %while.body
%20 = mul i64 %ans.1204, %18
%mul96 = sub i64 0, %20
%rem97 = srem i64 %mul96, 1000000007
%21 = mul i64 %19, %rem97
%mul101 = sub i64 0, %21
%sub104 = add nsw i64 %m_cur.0206, -2
br label %if.end107
if.end107: ; preds = %if.else93, %if.then83
%ans.2.in = phi i64 [ %mul89, %if.then83 ], [ %mul101, %if.else93 ]
%p_cur.2 = phi i64 [ %add92, %if.then83 ], [ %p_cur.1205, %if.else93 ]
%m_cur.1 = phi i64 [ %m_cur.0206, %if.then83 ], [ %sub104, %if.else93 ]
%left.2 = add nsw i64 %left.1207, -2
%ans.2 = srem i64 %ans.2.in, 1000000007
%cmp41 = icmp sgt i64 %left.1207, 2
br i1 %cmp41, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %if.end107, %while.body.us209, %while.body.us, %if.end40
%ans.1.lcssa = phi i64 [ %ans.0, %if.end40 ], [ %ans.2.us, %while.body.us ], [ %ans.2.us219, %while.body.us209 ], [ %ans.2, %if.end107 ]
%call108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.1.lcssa)
br label %if.end130
if.else109: ; preds = %for.cond.cleanup
br i1 %zero.0.lcssa, label %if.then112, label %if.else127
if.then112: ; preds = %if.else109
%22 = load i64, ptr %n, align 8, !tbaa !5
call void @qsort(ptr noundef nonnull %vla, i64 noundef %22, i64 noundef 8, ptr noundef nonnull @cmpnum2) #10
%23 = load i64, ptr %k, align 8, !tbaa !5
%cmp115223 = icmp sgt i64 %23, 0
br i1 %cmp115223, label %for.body118.preheader, label %for.cond.cleanup117
for.body118.preheader: ; preds = %if.then112
%xtraiter = and i64 %23, 1
%24 = icmp eq i64 %23, 1
br i1 %24, label %for.cond.cleanup117.loopexit.unr-lcssa, label %for.body118.preheader.new
for.body118.preheader.new: ; preds = %for.body118.preheader
%unroll_iter = and i64 %23, -2
br label %for.body118
for.cond.cleanup117.loopexit.unr-lcssa: ; preds = %for.body118, %for.body118.preheader
%rem122.lcssa.ph = phi i64 [ undef, %for.body118.preheader ], [ %rem122.1, %for.body118 ]
%i113.0225.unr = phi i64 [ 0, %for.body118.preheader ], [ %inc124.1, %for.body118 ]
%ans.3224.unr = phi i64 [ 1, %for.body118.preheader ], [ %rem122.1, %for.body118 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup117, label %for.body118.epil
for.body118.epil: ; preds = %for.cond.cleanup117.loopexit.unr-lcssa
%arrayidx119.epil = getelementptr inbounds i64, ptr %vla, i64 %i113.0225.unr
%25 = load i64, ptr %arrayidx119.epil, align 8, !tbaa !5
%add120.epil = add nsw i64 %25, 1000000007
%mul121.epil = mul nsw i64 %add120.epil, %ans.3224.unr
%rem122.epil = srem i64 %mul121.epil, 1000000007
br label %for.cond.cleanup117
for.cond.cleanup117: ; preds = %for.body118.epil, %for.cond.cleanup117.loopexit.unr-lcssa, %if.then112
%ans.3.lcssa = phi i64 [ 1, %if.then112 ], [ %rem122.lcssa.ph, %for.cond.cleanup117.loopexit.unr-lcssa ], [ %rem122.epil, %for.body118.epil ]
%call126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.3.lcssa)
br label %if.end130
for.body118: ; preds = %for.body118, %for.body118.preheader.new
%i113.0225 = phi i64 [ 0, %for.body118.preheader.new ], [ %inc124.1, %for.body118 ]
%ans.3224 = phi i64 [ 1, %for.body118.preheader.new ], [ %rem122.1, %for.body118 ]
%niter = phi i64 [ 0, %for.body118.preheader.new ], [ %niter.next.1, %for.body118 ]
%arrayidx119 = getelementptr inbounds i64, ptr %vla, i64 %i113.0225
%26 = load i64, ptr %arrayidx119, align 16, !tbaa !5
%add120 = add nsw i64 %26, 1000000007
%mul121 = mul nsw i64 %add120, %ans.3224
%rem122 = srem i64 %mul121, 1000000007
%inc124 = or i64 %i113.0225, 1
%arrayidx119.1 = getelementptr inbounds i64, ptr %vla, i64 %inc124
%27 = load i64, ptr %arrayidx119.1, align 8, !tbaa !5
%add120.1 = add nsw i64 %27, 1000000007
%mul121.1 = mul nsw i64 %add120.1, %rem122
%rem122.1 = srem i64 %mul121.1, 1000000007
%inc124.1 = add nuw nsw i64 %i113.0225, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup117.loopexit.unr-lcssa, label %for.body118, !llvm.loop !12
if.else127: ; preds = %if.else109
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end130
if.end130: ; preds = %for.cond.cleanup117, %if.else127, %while.end
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #10
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #10
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind 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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #7 = { 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 #8 = { nofree nounwind }
attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int a,i,s,j,k,n,m;
int jro[25];
while(1){
scanf("%d",&i);
if(i==0){ break; }
for(j=0;j<i;j++){
scanf("%d",&jro[j]);
}
s=32;
k=1;
m=0;
while(1){
if(k%2==1){
n=(s-1)%5;
}
else{
n=jro[m];
m++;
if(m==i){m=0;
}
}
k++;
s-=n;
if(s>=0){
printf("%d\n",s);
}
else{
s=0;
printf("%d\n",s);
}
if(s==0){break;}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256136/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256136/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
%jro = alloca [25 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %jro) #3
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
%cmp40 = icmp eq i32 %0, 0
br i1 %cmp40, label %while.end26, label %for.cond.preheader
while.cond.loopexit: ; preds = %if.end22, %if.end22.thread
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%1 = load i32, ptr %i, align 4, !tbaa !5
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %while.end26, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %while.cond.loopexit
%2 = phi i32 [ %1, %while.cond.loopexit ], [ %0, %entry ]
%cmp137 = icmp sgt i32 %2, 0
br i1 %cmp137, label %for.body, label %while.cond3.preheader
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [25 x i32], ptr %jro, i64 0, 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
%3 = load i32, ptr %i, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp1, label %for.body, label %while.cond3.preheader, !llvm.loop !9
while.cond3.preheader: ; preds = %for.body, %for.cond.preheader
br label %while.cond3
while.cond3: ; preds = %while.cond3.preheader, %if.end22
%s.0 = phi i32 [ %sub16, %if.end22 ], [ 32, %while.cond3.preheader ]
%k.0 = phi i32 [ %inc15, %if.end22 ], [ 1, %while.cond3.preheader ]
%m.0 = phi i32 [ %m.1, %if.end22 ], [ 0, %while.cond3.preheader ]
%rem = and i32 %k.0, 1
%cmp5.not = icmp eq i32 %rem, 0
br i1 %cmp5.not, label %if.else, label %if.then6
if.then6: ; preds = %while.cond3
%sub = add nsw i32 %s.0, -1
%rem7 = srem i32 %sub, 5
br label %if.end14
if.else: ; preds = %while.cond3
%idxprom8 = sext i32 %m.0 to i64
%arrayidx9 = getelementptr inbounds [25 x i32], ptr %jro, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%inc10 = add nsw i32 %m.0, 1
%6 = load i32, ptr %i, align 4, !tbaa !5
%cmp11 = icmp eq i32 %inc10, %6
%spec.store.select = select i1 %cmp11, i32 0, i32 %inc10
br label %if.end14
if.end14: ; preds = %if.else, %if.then6
%n.0 = phi i32 [ %rem7, %if.then6 ], [ %5, %if.else ]
%m.1 = phi i32 [ %m.0, %if.then6 ], [ %spec.store.select, %if.else ]
%sub16 = sub nsw i32 %s.0, %n.0
%cmp17 = icmp sgt i32 %sub16, -1
br i1 %cmp17, label %if.end22, label %if.end22.thread
if.end22.thread: ; preds = %if.end14
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
br label %while.cond.loopexit
if.end22: ; preds = %if.end14
%inc15 = add nuw nsw i32 %k.0, 1
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub16)
%cmp23 = icmp eq i32 %sub16, 0
br i1 %cmp23, label %while.cond.loopexit, label %while.cond3
while.end26: ; preds = %while.cond.loopexit, %entry
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %jro) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #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>
#define lw 4280
int main(void){
int n, i, j, x[6] = {0};
double a;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%lf", &a);
if (a < 165.0)
x[0] += 1;
else if (a <170.0)
x[1] += 1;
else if (a <175.0)
x[2] += 1;
else if (a < 180.0)
x[3] += 1;
else if(a < 185.0)
x[4] += 1;
else
x[5] +=1;
}
for (i = 0; i < 6; i++){
printf("%d:", i+1);
if (x[i] != 0)
for (j = 0; j < x[i]; j++){
printf("*");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256194/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256194/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d:\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.body, label %for.cond29.preheader.thread
for.cond29.preheader.thread: ; preds = %entry
%call3388 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
br label %if.end46
for.cond29.preheader: ; preds = %for.inc
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
%cmp4071 = icmp sgt i32 %3, 0
br i1 %cmp4071, label %for.body41, label %if.end46
for.body: ; preds = %entry, %for.inc
%add670 = phi i32 [ %add669, %for.inc ], [ 0, %entry ]
%add1168 = phi i32 [ %add1167, %for.inc ], [ 0, %entry ]
%add1666 = phi i32 [ %add1665, %for.inc ], [ 0, %entry ]
%add2164 = phi i32 [ %add2163, %for.inc ], [ 0, %entry ]
%add2462 = phi i32 [ %add2461, %for.inc ], [ 0, %entry ]
%i.060 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%1 = phi i32 [ %3, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%2 = load double, ptr %a, align 8, !tbaa !9
%cmp2 = fcmp olt double %2, 1.650000e+02
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%add = add nsw i32 %1, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp3 = fcmp olt double %2, 1.700000e+02
br i1 %cmp3, label %if.then4, label %if.else7
if.then4: ; preds = %if.else
%add6 = add nsw i32 %add670, 1
br label %for.inc
if.else7: ; preds = %if.else
%cmp8 = fcmp olt double %2, 1.750000e+02
br i1 %cmp8, label %if.then9, label %if.else12
if.then9: ; preds = %if.else7
%add11 = add nsw i32 %add1168, 1
br label %for.inc
if.else12: ; preds = %if.else7
%cmp13 = fcmp olt double %2, 1.800000e+02
br i1 %cmp13, label %if.then14, label %if.else17
if.then14: ; preds = %if.else12
%add16 = add nsw i32 %add1666, 1
br label %for.inc
if.else17: ; preds = %if.else12
%cmp18 = fcmp olt double %2, 1.850000e+02
br i1 %cmp18, label %if.then19, label %if.else22
if.then19: ; preds = %if.else17
%add21 = add nsw i32 %add2164, 1
br label %for.inc
if.else22: ; preds = %if.else17
%add24 = add nsw i32 %add2462, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.then9, %if.then19, %if.else22, %if.then14, %if.then4
%add669 = phi i32 [ %add670, %if.then ], [ %add670, %if.then9 ], [ %add670, %if.then19 ], [ %add670, %if.else22 ], [ %add670, %if.then14 ], [ %add6, %if.then4 ]
%add1167 = phi i32 [ %add1168, %if.then ], [ %add11, %if.then9 ], [ %add1168, %if.then19 ], [ %add1168, %if.else22 ], [ %add1168, %if.then14 ], [ %add1168, %if.then4 ]
%add1665 = phi i32 [ %add1666, %if.then ], [ %add1666, %if.then9 ], [ %add1666, %if.then19 ], [ %add1666, %if.else22 ], [ %add16, %if.then14 ], [ %add1666, %if.then4 ]
%add2163 = phi i32 [ %add2164, %if.then ], [ %add2164, %if.then9 ], [ %add21, %if.then19 ], [ %add2164, %if.else22 ], [ %add2164, %if.then14 ], [ %add2164, %if.then4 ]
%add2461 = phi i32 [ %add2462, %if.then ], [ %add2462, %if.then9 ], [ %add2462, %if.then19 ], [ %add24, %if.else22 ], [ %add2462, %if.then14 ], [ %add2462, %if.then4 ]
%3 = phi i32 [ %add, %if.then ], [ %1, %if.then9 ], [ %1, %if.then19 ], [ %1, %if.else22 ], [ %1, %if.then14 ], [ %1, %if.then4 ]
%inc = add nuw nsw i32 %i.060, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond29.preheader, !llvm.loop !11
for.body41: ; preds = %for.cond29.preheader, %for.body41
%j.072 = phi i32 [ %inc44, %for.body41 ], [ 0, %for.cond29.preheader ]
%putchar58 = call i32 @putchar(i32 42)
%inc44 = add nuw nsw i32 %j.072, 1
%exitcond.not = icmp eq i32 %inc44, %3
br i1 %exitcond.not, label %if.end46, label %for.body41, !llvm.loop !13
if.end46: ; preds = %for.body41, %for.cond29.preheader.thread, %for.cond29.preheader
%x.sroa.17.094 = phi i32 [ 0, %for.cond29.preheader.thread ], [ %add2461, %for.cond29.preheader ], [ %add2461, %for.body41 ]
%x.sroa.14.093 = phi i32 [ 0, %for.cond29.preheader.thread ], [ %add2163, %for.cond29.preheader ], [ %add2163, %for.body41 ]
%x.sroa.11.092 = phi i32 [ 0, %for.cond29.preheader.thread ], [ %add1665, %for.cond29.preheader ], [ %add1665, %for.body41 ]
%x.sroa.8.091 = phi i32 [ 0, %for.cond29.preheader.thread ], [ %add1167, %for.cond29.preheader ], [ %add1167, %for.body41 ]
%x.sroa.5.090 = phi i32 [ 0, %for.cond29.preheader.thread ], [ %add669, %for.cond29.preheader ], [ %add669, %for.body41 ]
%putchar = call i32 @putchar(i32 10)
%call33.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2)
%cmp4071.1 = icmp sgt i32 %x.sroa.5.090, 0
br i1 %cmp4071.1, label %for.body41.1, label %if.end46.1
for.body41.1: ; preds = %if.end46, %for.body41.1
%j.072.1 = phi i32 [ %inc44.1, %for.body41.1 ], [ 0, %if.end46 ]
%putchar58.1 = call i32 @putchar(i32 42)
%inc44.1 = add nuw nsw i32 %j.072.1, 1
%exitcond.1.not = icmp eq i32 %inc44.1, %x.sroa.5.090
br i1 %exitcond.1.not, label %if.end46.1, label %for.body41.1, !llvm.loop !13
if.end46.1: ; preds = %for.body41.1, %if.end46
%putchar.1 = call i32 @putchar(i32 10)
%call33.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 3)
%cmp4071.2 = icmp sgt i32 %x.sroa.8.091, 0
br i1 %cmp4071.2, label %for.body41.2, label %if.end46.2
for.body41.2: ; preds = %if.end46.1, %for.body41.2
%j.072.2 = phi i32 [ %inc44.2, %for.body41.2 ], [ 0, %if.end46.1 ]
%putchar58.2 = call i32 @putchar(i32 42)
%inc44.2 = add nuw nsw i32 %j.072.2, 1
%exitcond.2.not = icmp eq i32 %inc44.2, %x.sroa.8.091
br i1 %exitcond.2.not, label %if.end46.2, label %for.body41.2, !llvm.loop !13
if.end46.2: ; preds = %for.body41.2, %if.end46.1
%putchar.2 = call i32 @putchar(i32 10)
%call33.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 4)
%cmp4071.3 = icmp sgt i32 %x.sroa.11.092, 0
br i1 %cmp4071.3, label %for.body41.3, label %if.end46.3
for.body41.3: ; preds = %if.end46.2, %for.body41.3
%j.072.3 = phi i32 [ %inc44.3, %for.body41.3 ], [ 0, %if.end46.2 ]
%putchar58.3 = call i32 @putchar(i32 42)
%inc44.3 = add nuw nsw i32 %j.072.3, 1
%exitcond.3.not = icmp eq i32 %inc44.3, %x.sroa.11.092
br i1 %exitcond.3.not, label %if.end46.3, label %for.body41.3, !llvm.loop !13
if.end46.3: ; preds = %for.body41.3, %if.end46.2
%putchar.3 = call i32 @putchar(i32 10)
%call33.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 5)
%cmp4071.4 = icmp sgt i32 %x.sroa.14.093, 0
br i1 %cmp4071.4, label %for.body41.4, label %if.end46.4
for.body41.4: ; preds = %if.end46.3, %for.body41.4
%j.072.4 = phi i32 [ %inc44.4, %for.body41.4 ], [ 0, %if.end46.3 ]
%putchar58.4 = call i32 @putchar(i32 42)
%inc44.4 = add nuw nsw i32 %j.072.4, 1
%exitcond.4.not = icmp eq i32 %inc44.4, %x.sroa.14.093
br i1 %exitcond.4.not, label %if.end46.4, label %for.body41.4, !llvm.loop !13
if.end46.4: ; preds = %for.body41.4, %if.end46.3
%putchar.4 = call i32 @putchar(i32 10)
%call33.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 6)
%cmp4071.5 = icmp sgt i32 %x.sroa.17.094, 0
br i1 %cmp4071.5, label %for.body41.5, label %if.end46.5
for.body41.5: ; preds = %if.end46.4, %for.body41.5
%j.072.5 = phi i32 [ %inc44.5, %for.body41.5 ], [ 0, %if.end46.4 ]
%putchar58.5 = call i32 @putchar(i32 42)
%inc44.5 = add nuw nsw i32 %j.072.5, 1
%exitcond.5.not = icmp eq i32 %inc44.5, %x.sroa.17.094
br i1 %exitcond.5.not, label %if.end46.5, label %for.body41.5, !llvm.loop !13
if.end46.5: ; preds = %for.body41.5, %if.end46.4
%putchar.5 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 8, 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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
// include
// ----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
// repetition
// ----------------------------------------------------------------------------
#define FOR(i, a, b) for (i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// memory clear
// ----------------------------------------------------------------------------
#define CLRNUM(a) memset((a), 0, sizeof(a))
#define CLRBOOL(a, flag) memset((a), flag, sizeof(a))
#define CLRCHAR(a) memset((a), '\0', sizeof(a))
// debug
// ----------------------------------------------------------------------------
#define DEBUGINT(x) printf("%d\n", x);
#define DEBUGFLOAT(x) printf("%f\n", x);
#define DEBUGCHAR(x) printf("%c\n", x);
#define DEBUGSTR(x) printf("%s\n", x);
#define DEBUGFORINT(i, a, b, x) FOR(i, a, b){ printf("%d ", x[i]); }
#define DEBUGFORFLOAT(i, a, b,x ) FOR(i, a, b){ printf("%f ", x[i]); }
#define DEBUGFORCHAR(i, a, b, x) FOR(i, a, b){ printf("%c ", x[i]); }
#define DEBUGREPINT(i, n, x) REP(i, n){ printf("%d ", x[i]); }
#define DEBUGREPFLOAT(i, n, x) REP(i, n){ printf("%f ", x[i]); }
#define DEBUGREPCHAR(i, n, x) REP(i, n){ printf("%c ", x[i]); }
// other
// ----------------------------------------------------------------------------
#define PUTNL printf("\n")
// constant
// ----------------------------------------------------------------------------
#define INF 1000000000
int main(void)
{
int n;
int i, j;
int list[6];
double hight;
scanf("%d", &n);
memset(list, 0, sizeof(list));
for (i = 0; i < n; ++i){
scanf("%lf", &hight);
if (hight < 165.0){
list[0]++;
}
else if (hight >= 165.0 && hight < 170.0){
list[1]++;
}
else if (hight >= 170.0 && hight < 175.0){
list[2]++;
}
else if (hight >= 175.0 && hight < 180.0){
list[3]++;
}
else if (hight >= 180.0 && hight < 185.0){
list[4]++;
}
else if (hight >= 185.0){
list[5]++;
}
}
for (i = 0; i < 6; ++i){
printf("%d:", i + 1);
for (j = 0; j < list[i]; ++j){
printf("*");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256237/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256237/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d:\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%hight = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %hight) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body, label %for.cond40.preheader.thread
for.cond40.preheader.thread: ; preds = %entry
%call4395 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
br label %for.end51
for.cond40.preheader: ; preds = %for.inc
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
%cmp4678 = icmp sgt i32 %3, 0
br i1 %cmp4678, label %for.body47, label %for.end51
for.body: ; preds = %entry, %for.inc
%inc777 = phi i32 [ %inc776, %for.inc ], [ 0, %entry ]
%inc1475 = phi i32 [ %inc1474, %for.inc ], [ 0, %entry ]
%inc2173 = phi i32 [ %inc2172, %for.inc ], [ 0, %entry ]
%inc2871 = phi i32 [ %inc2870, %for.inc ], [ 0, %entry ]
%inc3369 = phi i32 [ %inc3368, %for.inc ], [ 0, %entry ]
%i.067 = phi i32 [ %inc39, %for.inc ], [ 0, %entry ]
%1 = phi i32 [ %3, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %hight)
%2 = load double, ptr %hight, align 8
%cmp2 = fcmp olt double %2, 1.650000e+02
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %1, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp3 = fcmp oge double %2, 1.650000e+02
%cmp4 = fcmp olt double %2, 1.700000e+02
%or.cond = and i1 %cmp3, %cmp4
br i1 %or.cond, label %if.then5, label %if.else8
if.then5: ; preds = %if.else
%inc7 = add nsw i32 %inc777, 1
br label %for.inc
if.else8: ; preds = %if.else
%cmp9 = fcmp oge double %2, 1.700000e+02
%cmp11 = fcmp olt double %2, 1.750000e+02
%or.cond56 = and i1 %cmp9, %cmp11
br i1 %or.cond56, label %if.then12, label %if.else15
if.then12: ; preds = %if.else8
%inc14 = add nsw i32 %inc1475, 1
br label %for.inc
if.else15: ; preds = %if.else8
%cmp16 = fcmp oge double %2, 1.750000e+02
%cmp18 = fcmp olt double %2, 1.800000e+02
%or.cond57 = and i1 %cmp16, %cmp18
br i1 %or.cond57, label %if.then19, label %if.else22
if.then19: ; preds = %if.else15
%inc21 = add nsw i32 %inc2173, 1
br label %for.inc
if.else22: ; preds = %if.else15
%cmp23 = fcmp oge double %2, 1.800000e+02
%cmp25 = fcmp olt double %2, 1.850000e+02
%or.cond58 = and i1 %cmp23, %cmp25
br i1 %or.cond58, label %if.then26, label %if.else29
if.then26: ; preds = %if.else22
%inc28 = add nsw i32 %inc2871, 1
br label %for.inc
if.else29: ; preds = %if.else22
%cmp30 = fcmp ult double %2, 1.850000e+02
br i1 %cmp30, label %for.inc, label %if.then31
if.then31: ; preds = %if.else29
%inc33 = add nsw i32 %inc3369, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.then12, %if.then26, %if.then31, %if.else29, %if.then19, %if.then5
%inc776 = phi i32 [ %inc777, %if.then ], [ %inc777, %if.then12 ], [ %inc777, %if.then26 ], [ %inc777, %if.then31 ], [ %inc777, %if.else29 ], [ %inc777, %if.then19 ], [ %inc7, %if.then5 ]
%inc1474 = phi i32 [ %inc1475, %if.then ], [ %inc14, %if.then12 ], [ %inc1475, %if.then26 ], [ %inc1475, %if.then31 ], [ %inc1475, %if.else29 ], [ %inc1475, %if.then19 ], [ %inc1475, %if.then5 ]
%inc2172 = phi i32 [ %inc2173, %if.then ], [ %inc2173, %if.then12 ], [ %inc2173, %if.then26 ], [ %inc2173, %if.then31 ], [ %inc2173, %if.else29 ], [ %inc21, %if.then19 ], [ %inc2173, %if.then5 ]
%inc2870 = phi i32 [ %inc2871, %if.then ], [ %inc2871, %if.then12 ], [ %inc28, %if.then26 ], [ %inc2871, %if.then31 ], [ %inc2871, %if.else29 ], [ %inc2871, %if.then19 ], [ %inc2871, %if.then5 ]
%inc3368 = phi i32 [ %inc3369, %if.then ], [ %inc3369, %if.then12 ], [ %inc3369, %if.then26 ], [ %inc33, %if.then31 ], [ %inc3369, %if.else29 ], [ %inc3369, %if.then19 ], [ %inc3369, %if.then5 ]
%3 = phi i32 [ %inc, %if.then ], [ %1, %if.then12 ], [ %1, %if.then26 ], [ %1, %if.then31 ], [ %1, %if.else29 ], [ %1, %if.then19 ], [ %1, %if.then5 ]
%inc39 = add nuw nsw i32 %i.067, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc39, %4
br i1 %cmp, label %for.body, label %for.cond40.preheader, !llvm.loop !9
for.body47: ; preds = %for.cond40.preheader, %for.body47
%j.079 = phi i32 [ %inc50, %for.body47 ], [ 0, %for.cond40.preheader ]
%putchar65 = call i32 @putchar(i32 42)
%inc50 = add nuw nsw i32 %j.079, 1
%exitcond.not = icmp eq i32 %inc50, %3
br i1 %exitcond.not, label %for.end51, label %for.body47, !llvm.loop !11
for.end51: ; preds = %for.body47, %for.cond40.preheader.thread, %for.cond40.preheader
%list.sroa.17.0101 = phi i32 [ 0, %for.cond40.preheader.thread ], [ %inc3368, %for.cond40.preheader ], [ %inc3368, %for.body47 ]
%list.sroa.14.0100 = phi i32 [ 0, %for.cond40.preheader.thread ], [ %inc2870, %for.cond40.preheader ], [ %inc2870, %for.body47 ]
%list.sroa.11.099 = phi i32 [ 0, %for.cond40.preheader.thread ], [ %inc2172, %for.cond40.preheader ], [ %inc2172, %for.body47 ]
%list.sroa.8.098 = phi i32 [ 0, %for.cond40.preheader.thread ], [ %inc1474, %for.cond40.preheader ], [ %inc1474, %for.body47 ]
%list.sroa.5.097 = phi i32 [ 0, %for.cond40.preheader.thread ], [ %inc776, %for.cond40.preheader ], [ %inc776, %for.body47 ]
%putchar = call i32 @putchar(i32 10)
%call43.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2)
%cmp4678.1 = icmp sgt i32 %list.sroa.5.097, 0
br i1 %cmp4678.1, label %for.body47.1, label %for.end51.1
for.body47.1: ; preds = %for.end51, %for.body47.1
%j.079.1 = phi i32 [ %inc50.1, %for.body47.1 ], [ 0, %for.end51 ]
%putchar65.1 = call i32 @putchar(i32 42)
%inc50.1 = add nuw nsw i32 %j.079.1, 1
%exitcond.1.not = icmp eq i32 %inc50.1, %list.sroa.5.097
br i1 %exitcond.1.not, label %for.end51.1, label %for.body47.1, !llvm.loop !11
for.end51.1: ; preds = %for.body47.1, %for.end51
%putchar.1 = call i32 @putchar(i32 10)
%call43.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 3)
%cmp4678.2 = icmp sgt i32 %list.sroa.8.098, 0
br i1 %cmp4678.2, label %for.body47.2, label %for.end51.2
for.body47.2: ; preds = %for.end51.1, %for.body47.2
%j.079.2 = phi i32 [ %inc50.2, %for.body47.2 ], [ 0, %for.end51.1 ]
%putchar65.2 = call i32 @putchar(i32 42)
%inc50.2 = add nuw nsw i32 %j.079.2, 1
%exitcond.2.not = icmp eq i32 %inc50.2, %list.sroa.8.098
br i1 %exitcond.2.not, label %for.end51.2, label %for.body47.2, !llvm.loop !11
for.end51.2: ; preds = %for.body47.2, %for.end51.1
%putchar.2 = call i32 @putchar(i32 10)
%call43.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 4)
%cmp4678.3 = icmp sgt i32 %list.sroa.11.099, 0
br i1 %cmp4678.3, label %for.body47.3, label %for.end51.3
for.body47.3: ; preds = %for.end51.2, %for.body47.3
%j.079.3 = phi i32 [ %inc50.3, %for.body47.3 ], [ 0, %for.end51.2 ]
%putchar65.3 = call i32 @putchar(i32 42)
%inc50.3 = add nuw nsw i32 %j.079.3, 1
%exitcond.3.not = icmp eq i32 %inc50.3, %list.sroa.11.099
br i1 %exitcond.3.not, label %for.end51.3, label %for.body47.3, !llvm.loop !11
for.end51.3: ; preds = %for.body47.3, %for.end51.2
%putchar.3 = call i32 @putchar(i32 10)
%call43.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 5)
%cmp4678.4 = icmp sgt i32 %list.sroa.14.0100, 0
br i1 %cmp4678.4, label %for.body47.4, label %for.end51.4
for.body47.4: ; preds = %for.end51.3, %for.body47.4
%j.079.4 = phi i32 [ %inc50.4, %for.body47.4 ], [ 0, %for.end51.3 ]
%putchar65.4 = call i32 @putchar(i32 42)
%inc50.4 = add nuw nsw i32 %j.079.4, 1
%exitcond.4.not = icmp eq i32 %inc50.4, %list.sroa.14.0100
br i1 %exitcond.4.not, label %for.end51.4, label %for.body47.4, !llvm.loop !11
for.end51.4: ; preds = %for.body47.4, %for.end51.3
%putchar.4 = call i32 @putchar(i32 10)
%call43.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 6)
%cmp4678.5 = icmp sgt i32 %list.sroa.17.0101, 0
br i1 %cmp4678.5, label %for.body47.5, label %for.end51.5
for.body47.5: ; preds = %for.end51.4, %for.body47.5
%j.079.5 = phi i32 [ %inc50.5, %for.body47.5 ], [ 0, %for.end51.4 ]
%putchar65.5 = call i32 @putchar(i32 42)
%inc50.5 = add nuw nsw i32 %j.079.5, 1
%exitcond.5.not = icmp eq i32 %inc50.5, %list.sroa.17.0101
br i1 %exitcond.5.not, label %for.end51.5, label %for.body47.5, !llvm.loop !11
for.end51.5: ; preds = %for.body47.5, %for.end51.4
%putchar.5 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %hight) #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 @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(){
int n,i,j,c[6]={0};
double t;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%lf",&t);
if(t<165.0)c[0]++;
else if(t<170.0)c[1]++;
else if(t<175.0)c[2]++;
else if(t<180.0)c[3]++;
else if(t<185.0)c[4]++;
else c[5]++;
}
for(i=0;i<6;i++){
printf("%d:",i+1);
for(j=0;j<c[i];j++){
printf("*");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256288/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256288/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d:\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%t = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body, label %for.cond30.preheader.thread
for.cond30.preheader.thread: ; preds = %entry
%call3382 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
br label %for.end41
for.cond30.preheader: ; preds = %for.inc
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
%cmp3665 = icmp sgt i32 %3, 0
br i1 %cmp3665, label %for.body37, label %for.end41
for.body: ; preds = %entry, %for.inc
%inc664 = phi i32 [ %inc663, %for.inc ], [ 0, %entry ]
%inc1162 = phi i32 [ %inc1161, %for.inc ], [ 0, %entry ]
%inc1660 = phi i32 [ %inc1659, %for.inc ], [ 0, %entry ]
%inc2158 = phi i32 [ %inc2157, %for.inc ], [ 0, %entry ]
%inc2456 = phi i32 [ %inc2455, %for.inc ], [ 0, %entry ]
%i.054 = phi i32 [ %inc29, %for.inc ], [ 0, %entry ]
%1 = phi i32 [ %3, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t)
%2 = load double, ptr %t, align 8, !tbaa !9
%cmp2 = fcmp olt double %2, 1.650000e+02
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %1, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp3 = fcmp olt double %2, 1.700000e+02
br i1 %cmp3, label %if.then4, label %if.else7
if.then4: ; preds = %if.else
%inc6 = add nsw i32 %inc664, 1
br label %for.inc
if.else7: ; preds = %if.else
%cmp8 = fcmp olt double %2, 1.750000e+02
br i1 %cmp8, label %if.then9, label %if.else12
if.then9: ; preds = %if.else7
%inc11 = add nsw i32 %inc1162, 1
br label %for.inc
if.else12: ; preds = %if.else7
%cmp13 = fcmp olt double %2, 1.800000e+02
br i1 %cmp13, label %if.then14, label %if.else17
if.then14: ; preds = %if.else12
%inc16 = add nsw i32 %inc1660, 1
br label %for.inc
if.else17: ; preds = %if.else12
%cmp18 = fcmp olt double %2, 1.850000e+02
br i1 %cmp18, label %if.then19, label %if.else22
if.then19: ; preds = %if.else17
%inc21 = add nsw i32 %inc2158, 1
br label %for.inc
if.else22: ; preds = %if.else17
%inc24 = add nsw i32 %inc2456, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.then9, %if.then19, %if.else22, %if.then14, %if.then4
%inc663 = phi i32 [ %inc664, %if.then ], [ %inc664, %if.then9 ], [ %inc664, %if.then19 ], [ %inc664, %if.else22 ], [ %inc664, %if.then14 ], [ %inc6, %if.then4 ]
%inc1161 = phi i32 [ %inc1162, %if.then ], [ %inc11, %if.then9 ], [ %inc1162, %if.then19 ], [ %inc1162, %if.else22 ], [ %inc1162, %if.then14 ], [ %inc1162, %if.then4 ]
%inc1659 = phi i32 [ %inc1660, %if.then ], [ %inc1660, %if.then9 ], [ %inc1660, %if.then19 ], [ %inc1660, %if.else22 ], [ %inc16, %if.then14 ], [ %inc1660, %if.then4 ]
%inc2157 = phi i32 [ %inc2158, %if.then ], [ %inc2158, %if.then9 ], [ %inc21, %if.then19 ], [ %inc2158, %if.else22 ], [ %inc2158, %if.then14 ], [ %inc2158, %if.then4 ]
%inc2455 = phi i32 [ %inc2456, %if.then ], [ %inc2456, %if.then9 ], [ %inc2456, %if.then19 ], [ %inc24, %if.else22 ], [ %inc2456, %if.then14 ], [ %inc2456, %if.then4 ]
%3 = phi i32 [ %inc, %if.then ], [ %1, %if.then9 ], [ %1, %if.then19 ], [ %1, %if.else22 ], [ %1, %if.then14 ], [ %1, %if.then4 ]
%inc29 = add nuw nsw i32 %i.054, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc29, %4
br i1 %cmp, label %for.body, label %for.cond30.preheader, !llvm.loop !11
for.body37: ; preds = %for.cond30.preheader, %for.body37
%j.066 = phi i32 [ %inc40, %for.body37 ], [ 0, %for.cond30.preheader ]
%putchar52 = call i32 @putchar(i32 42)
%inc40 = add nuw nsw i32 %j.066, 1
%exitcond.not = icmp eq i32 %inc40, %3
br i1 %exitcond.not, label %for.end41, label %for.body37, !llvm.loop !13
for.end41: ; preds = %for.body37, %for.cond30.preheader.thread, %for.cond30.preheader
%c.sroa.17.088 = phi i32 [ 0, %for.cond30.preheader.thread ], [ %inc2455, %for.cond30.preheader ], [ %inc2455, %for.body37 ]
%c.sroa.14.087 = phi i32 [ 0, %for.cond30.preheader.thread ], [ %inc2157, %for.cond30.preheader ], [ %inc2157, %for.body37 ]
%c.sroa.11.086 = phi i32 [ 0, %for.cond30.preheader.thread ], [ %inc1659, %for.cond30.preheader ], [ %inc1659, %for.body37 ]
%c.sroa.8.085 = phi i32 [ 0, %for.cond30.preheader.thread ], [ %inc1161, %for.cond30.preheader ], [ %inc1161, %for.body37 ]
%c.sroa.5.084 = phi i32 [ 0, %for.cond30.preheader.thread ], [ %inc663, %for.cond30.preheader ], [ %inc663, %for.body37 ]
%putchar = call i32 @putchar(i32 10)
%call33.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2)
%cmp3665.1 = icmp sgt i32 %c.sroa.5.084, 0
br i1 %cmp3665.1, label %for.body37.1, label %for.end41.1
for.body37.1: ; preds = %for.end41, %for.body37.1
%j.066.1 = phi i32 [ %inc40.1, %for.body37.1 ], [ 0, %for.end41 ]
%putchar52.1 = call i32 @putchar(i32 42)
%inc40.1 = add nuw nsw i32 %j.066.1, 1
%exitcond.1.not = icmp eq i32 %inc40.1, %c.sroa.5.084
br i1 %exitcond.1.not, label %for.end41.1, label %for.body37.1, !llvm.loop !13
for.end41.1: ; preds = %for.body37.1, %for.end41
%putchar.1 = call i32 @putchar(i32 10)
%call33.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 3)
%cmp3665.2 = icmp sgt i32 %c.sroa.8.085, 0
br i1 %cmp3665.2, label %for.body37.2, label %for.end41.2
for.body37.2: ; preds = %for.end41.1, %for.body37.2
%j.066.2 = phi i32 [ %inc40.2, %for.body37.2 ], [ 0, %for.end41.1 ]
%putchar52.2 = call i32 @putchar(i32 42)
%inc40.2 = add nuw nsw i32 %j.066.2, 1
%exitcond.2.not = icmp eq i32 %inc40.2, %c.sroa.8.085
br i1 %exitcond.2.not, label %for.end41.2, label %for.body37.2, !llvm.loop !13
for.end41.2: ; preds = %for.body37.2, %for.end41.1
%putchar.2 = call i32 @putchar(i32 10)
%call33.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 4)
%cmp3665.3 = icmp sgt i32 %c.sroa.11.086, 0
br i1 %cmp3665.3, label %for.body37.3, label %for.end41.3
for.body37.3: ; preds = %for.end41.2, %for.body37.3
%j.066.3 = phi i32 [ %inc40.3, %for.body37.3 ], [ 0, %for.end41.2 ]
%putchar52.3 = call i32 @putchar(i32 42)
%inc40.3 = add nuw nsw i32 %j.066.3, 1
%exitcond.3.not = icmp eq i32 %inc40.3, %c.sroa.11.086
br i1 %exitcond.3.not, label %for.end41.3, label %for.body37.3, !llvm.loop !13
for.end41.3: ; preds = %for.body37.3, %for.end41.2
%putchar.3 = call i32 @putchar(i32 10)
%call33.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 5)
%cmp3665.4 = icmp sgt i32 %c.sroa.14.087, 0
br i1 %cmp3665.4, label %for.body37.4, label %for.end41.4
for.body37.4: ; preds = %for.end41.3, %for.body37.4
%j.066.4 = phi i32 [ %inc40.4, %for.body37.4 ], [ 0, %for.end41.3 ]
%putchar52.4 = call i32 @putchar(i32 42)
%inc40.4 = add nuw nsw i32 %j.066.4, 1
%exitcond.4.not = icmp eq i32 %inc40.4, %c.sroa.14.087
br i1 %exitcond.4.not, label %for.end41.4, label %for.body37.4, !llvm.loop !13
for.end41.4: ; preds = %for.body37.4, %for.end41.3
%putchar.4 = call i32 @putchar(i32 10)
%call33.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 6)
%cmp3665.5 = icmp sgt i32 %c.sroa.17.088, 0
br i1 %cmp3665.5, label %for.body37.5, label %for.end41.5
for.body37.5: ; preds = %for.end41.4, %for.body37.5
%j.066.5 = phi i32 [ %inc40.5, %for.body37.5 ], [ 0, %for.end41.4 ]
%putchar52.5 = call i32 @putchar(i32 42)
%inc40.5 = add nuw nsw i32 %j.066.5, 1
%exitcond.5.not = icmp eq i32 %inc40.5, %c.sroa.17.088
br i1 %exitcond.5.not, label %for.end41.5, label %for.body37.5, !llvm.loop !13
for.end41.5: ; preds = %for.body37.5, %for.end41.4
%putchar.5 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
int main(){
int a;
scanf("%i", &a);
if(a==3||a==5||a==7){
printf("YES\n");
}else
{
printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256330/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256330/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%i\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; 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) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%str.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str, %entry ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
int count;
scanf("%d",&count);
if(count==7||count==5||count==3){printf("YES");}
else {printf("NO");}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256374/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256374/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%count = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %count) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %count)
%0 = load i32, ptr %count, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %count) #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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main()
{
int x;
scanf("%d",&x);
if(x==3||x==5||x==7)printf("YES");
else printf("NO");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256424/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256424/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; 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
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main()
{
int a;
scanf("%d", &a);
printf((a == 3 || a == 5 || a == 7) ? "YES" : "NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256468/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256468/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
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
switch i32 %0, label %lor.rhs [
i32 5, label %lor.end
i32 3, label %lor.end
]
lor.rhs: ; preds = %entry
%cmp2 = icmp eq i32 %0, 7
%1 = select i1 %cmp2, ptr @.str.1, ptr @.str.2
br label %lor.end
lor.end: ; preds = %entry, %entry, %lor.rhs
%cond = phi ptr [ @.str.1, %entry ], [ %1, %lor.rhs ], [ @.str.1, %entry ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond)
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)"}
|
#include <stdio.h>
int main(void)
{
int x=0;
scanf("%d",&x);
if (x==7 || x==5 || x==3) printf("YES");
else printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256510/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256510/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; 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
store i32 0, ptr %x, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main (){
int a;
scanf ("%d",&a);
if (a==3 || a==5 || a==7 ){
printf ("YES");
}
else {
printf("NO");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256554/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256554/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#define MAX(A, B) (((A) < (B)) ? (B) : (A))
#define MIN(A, B) (((A) < (B)) ? (A) : (B))
int main() {
int x;
scanf("%d", &x);
if (x == 3 || x == 5 || x == 7)
printf("YES\n");
else
printf("NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256598/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256598/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; 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) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%str.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str, %entry ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(){
int a;
scanf("%d",&a);
if(a==3||a==5||a==7)
printf("YES");
else
printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256640/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256640/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
int i;
int X;
scanf("%d", &X);
if (X == 3 || X == 5 || X == 7){
printf("YES\n");
}
else{
printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256691/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256691/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; 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) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i32, ptr %X, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%str.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str, %entry ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
int main(){
char str[1024];
int i;
char *ret;
scanf("%s",str);
if(
(strstr(str,"S")==NULL && strstr(str,"N") != NULL) || (strstr(str,"N")==NULL && strstr(str,"S") != NULL) || (strstr(str,"W")==NULL && strstr(str,"E") != NULL) || (strstr(str,"E")==NULL && strstr(str,"W") != NULL))
printf("No");
else
printf("Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256741/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256741/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.5 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [1024 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%strchr = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %str, i32 83)
%cmp = icmp eq ptr %strchr, null
%strchr31 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %str, i32 78)
%cmp5.not = icmp eq ptr %strchr31, null
br i1 %cmp, label %land.lhs.true, label %lor.lhs.false.thread
land.lhs.true: ; preds = %entry
br i1 %cmp5.not, label %lor.lhs.false13, label %if.end
lor.lhs.false.thread: ; preds = %entry
br i1 %cmp5.not, label %if.end, label %lor.lhs.false13
lor.lhs.false13: ; preds = %land.lhs.true, %lor.lhs.false.thread
%strchr34 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %str, i32 87)
%cmp16 = icmp eq ptr %strchr34, null
%strchr35 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %str, i32 69)
%cmp20.not = icmp eq ptr %strchr35, null
br i1 %cmp16, label %land.lhs.true17, label %lor.lhs.false21.thread
land.lhs.true17: ; preds = %lor.lhs.false13
br i1 %cmp20.not, label %if.else, label %if.end
lor.lhs.false21.thread: ; preds = %lor.lhs.false13
br i1 %cmp20.not, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true17, %lor.lhs.false21.thread
br label %if.end
if.end: ; preds = %land.lhs.true, %land.lhs.true17, %lor.lhs.false.thread, %lor.lhs.false21.thread, %if.else
%.str.6.sink = phi ptr [ @.str.6, %if.else ], [ @.str.5, %lor.lhs.false21.thread ], [ @.str.5, %lor.lhs.false.thread ], [ @.str.5, %land.lhs.true17 ], [ @.str.5, %land.lhs.true ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.6.sink)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr, i32) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <string.h>
int main(void){
char S[1000];
char *np, *sp, *ep, *wp;
int x = 0;
int y = 0;
scanf("%s", S);
np = strchr(S, 'N');
sp = strchr(S, 'S');
ep = strchr(S, 'E');
wp = strchr(S, 'W');
if (np != NULL){
y++;
}
if (sp != NULL){
y--;
}
if (ep != NULL){
x++;
}
if (wp != NULL){
x--;
}
if(x == 0 && y == 0){
printf("Yes");
}else{
printf("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256785/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256785/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%call2 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %S, i32 noundef 78) #5
%call4 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %S, i32 noundef 83) #5
%call6 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %S, i32 noundef 69) #5
%call8 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %S, i32 noundef 87) #5
%cmp.not = icmp ne ptr %call2, null
%cmp9.not = icmp eq ptr %call4, null
%cmp12.not = icmp ne ptr %call6, null
%cmp16.not = icmp eq ptr %call8, null
%cmp20 = xor i1 %cmp12.not, %cmp16.not
%cmp21 = xor i1 %cmp.not, %cmp9.not
%or.cond = select i1 %cmp20, i1 %cmp21, i1 false
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 ptr @strchr(ptr noundef, i32 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)"}
|
#include<stdio.h>
int main(){
int m, min, max, i, p[10000], diff[10000], gap, nmax;
while(1){
scanf("%d%d%d", &m, &min, &max);
if(m==0 && min==0 && max==0)break;
for(i=0; i<m; i++){
scanf("%d", &p[i]);
if(i!=0){
diff[i]=p[i-1]-p[i];
}
}
gap=0;
nmax=min;
for(i=min; i<max+1; i++){
if(diff[i]>=gap){
nmax=i;
gap=diff[i];
}
}
printf("%d\n", nmax);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256842/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256842/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%min = alloca i32, align 4
%max = alloca i32, align 4
%p = alloca [10000 x i32], align 16
%diff = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %min) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %max) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %diff) #4
%call49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %min, ptr noundef nonnull %max)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp50 = icmp eq i32 %0, 0
%1 = load i32, ptr %min, align 4
%cmp151 = icmp eq i32 %1, 0
%or.cond52 = select i1 %cmp50, i1 %cmp151, i1 false
%2 = load i32, ptr %max, align 4
%cmp353 = icmp eq i32 %2, 0
%or.cond3054 = select i1 %or.cond52, i1 %cmp353, i1 false
br i1 %or.cond3054, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end28
%3 = phi i32 [ %31, %for.end28 ], [ %2, %entry ]
%4 = phi i32 [ %30, %for.end28 ], [ %1, %entry ]
%5 = phi i32 [ %29, %for.end28 ], [ %0, %entry ]
%cmp443 = icmp sgt i32 %5, 0
br i1 %cmp443, label %for.inc.peel, label %for.end
for.inc.peel: ; preds = %for.cond.preheader
%call5.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %p)
%6 = load i32, ptr %m, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %6, 1
br i1 %cmp4.peel, label %for.inc, label %for.end.loopexit
for.inc: ; preds = %for.inc.peel, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.inc.peel ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%7 = add nsw i64 %indvars.iv, -1
%arrayidx9 = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %7
%8 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub12 = sub nsw i32 %8, %9
%arrayidx14 = getelementptr inbounds [10000 x i32], ptr %diff, i64 0, i64 %indvars.iv
store i32 %sub12, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %m, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp4, label %for.inc, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc, %for.inc.peel
%.pre = load i32, ptr %min, align 4, !tbaa !5
%.pre61 = load i32, ptr %max, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %for.cond.preheader
%12 = phi i32 [ %.pre61, %for.end.loopexit ], [ %3, %for.cond.preheader ]
%13 = phi i32 [ %.pre, %for.end.loopexit ], [ %4, %for.cond.preheader ]
%cmp17.not45 = icmp sgt i32 %13, %12
br i1 %cmp17.not45, label %for.end28, label %for.body18.preheader
for.body18.preheader: ; preds = %for.end
%14 = sext i32 %13 to i64
%15 = add i32 %12, 1
%16 = sub i32 %15, %13
%17 = sub i32 %12, %13
%xtraiter = and i32 %16, 3
%18 = icmp ult i32 %17, 3
br i1 %18, label %for.end28.loopexit.unr-lcssa, label %for.body18.preheader.new
for.body18.preheader.new: ; preds = %for.body18.preheader
%unroll_iter = and i32 %16, -4
br label %for.body18
for.body18: ; preds = %for.body18, %for.body18.preheader.new
%indvars.iv58 = phi i64 [ %14, %for.body18.preheader.new ], [ %indvars.iv.next59.3, %for.body18 ]
%nmax.048 = phi i32 [ %13, %for.body18.preheader.new ], [ %spec.select42.3, %for.body18 ]
%gap.047 = phi i32 [ 0, %for.body18.preheader.new ], [ %spec.select.3, %for.body18 ]
%niter = phi i32 [ 0, %for.body18.preheader.new ], [ %niter.next.3, %for.body18 ]
%arrayidx20 = getelementptr inbounds [10000 x i32], ptr %diff, i64 0, i64 %indvars.iv58
%19 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.not = icmp slt i32 %19, %gap.047
%spec.select = call i32 @llvm.smax.i32(i32 %19, i32 %gap.047)
%20 = trunc i64 %indvars.iv58 to i32
%spec.select42 = select i1 %cmp21.not, i32 %nmax.048, i32 %20
%indvars.iv.next59 = add nsw i64 %indvars.iv58, 1
%arrayidx20.1 = getelementptr inbounds [10000 x i32], ptr %diff, i64 0, i64 %indvars.iv.next59
%21 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%cmp21.not.1 = icmp slt i32 %21, %spec.select
%spec.select.1 = call i32 @llvm.smax.i32(i32 %21, i32 %spec.select)
%22 = trunc i64 %indvars.iv.next59 to i32
%spec.select42.1 = select i1 %cmp21.not.1, i32 %spec.select42, i32 %22
%indvars.iv.next59.1 = add nsw i64 %indvars.iv58, 2
%arrayidx20.2 = getelementptr inbounds [10000 x i32], ptr %diff, i64 0, i64 %indvars.iv.next59.1
%23 = load i32, ptr %arrayidx20.2, align 4, !tbaa !5
%cmp21.not.2 = icmp slt i32 %23, %spec.select.1
%spec.select.2 = call i32 @llvm.smax.i32(i32 %23, i32 %spec.select.1)
%24 = trunc i64 %indvars.iv.next59.1 to i32
%spec.select42.2 = select i1 %cmp21.not.2, i32 %spec.select42.1, i32 %24
%indvars.iv.next59.2 = add nsw i64 %indvars.iv58, 3
%arrayidx20.3 = getelementptr inbounds [10000 x i32], ptr %diff, i64 0, i64 %indvars.iv.next59.2
%25 = load i32, ptr %arrayidx20.3, align 4, !tbaa !5
%cmp21.not.3 = icmp slt i32 %25, %spec.select.2
%spec.select.3 = call i32 @llvm.smax.i32(i32 %25, i32 %spec.select.2)
%26 = trunc i64 %indvars.iv.next59.2 to i32
%spec.select42.3 = select i1 %cmp21.not.3, i32 %spec.select42.2, i32 %26
%indvars.iv.next59.3 = add nsw i64 %indvars.iv58, 4
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end28.loopexit.unr-lcssa, label %for.body18, !llvm.loop !12
for.end28.loopexit.unr-lcssa: ; preds = %for.body18, %for.body18.preheader
%spec.select42.lcssa.ph = phi i32 [ undef, %for.body18.preheader ], [ %spec.select42.3, %for.body18 ]
%indvars.iv58.unr = phi i64 [ %14, %for.body18.preheader ], [ %indvars.iv.next59.3, %for.body18 ]
%nmax.048.unr = phi i32 [ %13, %for.body18.preheader ], [ %spec.select42.3, %for.body18 ]
%gap.047.unr = phi i32 [ 0, %for.body18.preheader ], [ %spec.select.3, %for.body18 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end28, label %for.body18.epil
for.body18.epil: ; preds = %for.end28.loopexit.unr-lcssa, %for.body18.epil
%indvars.iv58.epil = phi i64 [ %indvars.iv.next59.epil, %for.body18.epil ], [ %indvars.iv58.unr, %for.end28.loopexit.unr-lcssa ]
%nmax.048.epil = phi i32 [ %spec.select42.epil, %for.body18.epil ], [ %nmax.048.unr, %for.end28.loopexit.unr-lcssa ]
%gap.047.epil = phi i32 [ %spec.select.epil, %for.body18.epil ], [ %gap.047.unr, %for.end28.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body18.epil ], [ 0, %for.end28.loopexit.unr-lcssa ]
%arrayidx20.epil = getelementptr inbounds [10000 x i32], ptr %diff, i64 0, i64 %indvars.iv58.epil
%27 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
%cmp21.not.epil = icmp slt i32 %27, %gap.047.epil
%spec.select.epil = call i32 @llvm.smax.i32(i32 %27, i32 %gap.047.epil)
%28 = trunc i64 %indvars.iv58.epil to i32
%spec.select42.epil = select i1 %cmp21.not.epil, i32 %nmax.048.epil, i32 %28
%indvars.iv.next59.epil = add nsw i64 %indvars.iv58.epil, 1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end28, label %for.body18.epil, !llvm.loop !13
for.end28: ; preds = %for.end28.loopexit.unr-lcssa, %for.body18.epil, %for.end
%nmax.0.lcssa = phi i32 [ %13, %for.end ], [ %spec.select42.lcssa.ph, %for.end28.loopexit.unr-lcssa ], [ %spec.select42.epil, %for.body18.epil ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %nmax.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %min, ptr noundef nonnull %max)
%29 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp eq i32 %29, 0
%30 = load i32, ptr %min, align 4
%cmp1 = icmp eq i32 %30, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%31 = load i32, ptr %max, align 4
%cmp3 = icmp eq i32 %31, 0
%or.cond30 = select i1 %or.cond, i1 %cmp3, i1 false
br i1 %or.cond30, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end28, %entry
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %diff) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %max) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %min) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
|
#include<stdio.h>
#include<stdlib.h>
struct node {
int id;
int weight;
struct node *next;
};
struct node **list;
int *maxdis, *premaxdis;
void Insert(int, int, int);
void Dfs(int, int);
void RevDfs(int, int);
int main(void)
{
int i, n, s, t, w;
scanf("%d", &n);
maxdis = (int*)calloc(n, sizeof(int));
premaxdis = (int*)calloc(n, sizeof(int));
list = (struct node**)malloc(sizeof(struct node*) * n);
for (i = 0; i < n; i++) list[i]= NULL;
for (i = 0; i < n - 1; i++) {
scanf("%d %d %d", &s, &t, &w);
Insert(s, t, w);
}
Dfs(s, -1);
RevDfs(s, -1);
for (i = 0; i < n ;i++) {
printf("%d\n", maxdis[i]);
free(list[i]);
}
free(list);
free(maxdis);
free(premaxdis);
}
void Insert(int a, int b, int w)
{
struct node *p = (struct node*)malloc(sizeof(struct node));
p->id = b;
p->weight = w;
p->next = list[a];
list[a] = p;
p = (struct node*)malloc(sizeof(struct node));
p->id = a;
p->weight = w;
p->next = list[b];
list[b] = p;
}
void Dfs(int root, int fa)
{
struct node *i;
for (i = list[root]; i != NULL; i = i->next) {
if (i->id != fa) {
Dfs(i->id, root);
if (maxdis[i->id] + i->weight > maxdis[root]) {
premaxdis[root] = maxdis[root];
maxdis[root] = maxdis[i->id] + i->weight;
} else if (maxdis[i->id] + i->weight > premaxdis[root]) {
premaxdis[root] = maxdis[i->id] + i->weight;
}
}
}
}
void RevDfs(int leaf, int fa)
{
struct node *i;
for (i = list[leaf]; i != NULL; i = i->next) {
if (i->id != fa) {
if (maxdis[i->id] + i->weight == maxdis[leaf]) {
if (premaxdis[leaf] + i->weight > maxdis[i->id]) {
premaxdis[i->id] = maxdis[i->id];
maxdis[i->id] = premaxdis[leaf] + i->weight;
} else if (premaxdis[leaf] + i->weight > premaxdis[i->id]) {
premaxdis[i->id] = premaxdis[leaf] + i->weight;
}
}else {
if (maxdis[leaf] + i->weight > maxdis[i->id]) {
premaxdis[i->id] = maxdis[i->id];
maxdis[i->id] = maxdis[leaf] + i->weight;
} else if (maxdis[leaf] + i->weight > premaxdis[i->id]) {
premaxdis[i->id] = maxdis[leaf] + i->weight;
}
}
RevDfs(i->id, leaf);
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256886/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256886/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.node = type { i32, i32, ptr }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@maxdis = dso_local local_unnamed_addr global ptr null, align 8
@premaxdis = dso_local local_unnamed_addr global ptr null, align 8
@list = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca i32, align 4
%t = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = zext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #10
store ptr %call1, ptr @maxdis, align 8, !tbaa !9
%call3 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #10
store ptr %call3, ptr @premaxdis, align 8, !tbaa !9
%mul = shl nuw nsw i64 %conv, 3
%call5 = call noalias ptr @malloc(i64 noundef %mul) #11
store ptr %call5, ptr @list, align 8, !tbaa !9
%cmp35 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp35)
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond7.preheader.unr-lcssa, label %entry.new
entry.new: ; preds = %entry
%unroll_iter = and i64 %wide.trip.count, 2147483644
br label %for.body
for.cond7.preheader.unr-lcssa: ; preds = %for.body, %entry
%indvars.iv.unr = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond7.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond7.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond7.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond7.preheader.unr-lcssa ]
%2 = load ptr, ptr @list, align 8, !tbaa !9
%arrayidx.epil = getelementptr inbounds ptr, ptr %2, i64 %indvars.iv.epil
store ptr null, ptr %arrayidx.epil, align 8, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond7.preheader, label %for.body.epil, !llvm.loop !11
for.cond7.preheader: ; preds = %for.body.epil, %for.cond7.preheader.unr-lcssa
%cmp838 = icmp ugt i32 %0, 1
call void @llvm.assume(i1 %cmp838)
br label %for.body10
for.body: ; preds = %for.body, %entry.new
%indvars.iv = phi i64 [ 0, %entry.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %entry.new ], [ %niter.next.3, %for.body ]
%3 = load ptr, ptr @list, align 8, !tbaa !9
%arrayidx = getelementptr inbounds ptr, ptr %3, i64 %indvars.iv
store ptr null, ptr %arrayidx, align 8, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%4 = load ptr, ptr @list, align 8, !tbaa !9
%arrayidx.1 = getelementptr inbounds ptr, ptr %4, i64 %indvars.iv.next
store ptr null, ptr %arrayidx.1, align 8, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%5 = load ptr, ptr @list, align 8, !tbaa !9
%arrayidx.2 = getelementptr inbounds ptr, ptr %5, i64 %indvars.iv.next.1
store ptr null, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%6 = load ptr, ptr @list, align 8, !tbaa !9
%arrayidx.3 = getelementptr inbounds ptr, ptr %6, i64 %indvars.iv.next.2
store ptr null, ptr %arrayidx.3, align 8, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond7.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.body10: ; preds = %for.cond7.preheader, %for.body10
%i.139 = phi i32 [ %inc13, %for.body10 ], [ 0, %for.cond7.preheader ]
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %t, ptr noundef nonnull %w)
%7 = load i32, ptr %s, align 4, !tbaa !5
%8 = load i32, ptr %t, align 4, !tbaa !5
%9 = load i32, ptr %w, align 4, !tbaa !5
%call.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #11
store i32 %8, ptr %call.i, align 8, !tbaa !15
%weight.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
store i32 %9, ptr %weight.i, align 4, !tbaa !17
%10 = load ptr, ptr @list, align 8, !tbaa !9
%idxprom.i = sext i32 %7 to i64
%arrayidx.i = getelementptr inbounds ptr, ptr %10, i64 %idxprom.i
%11 = load ptr, ptr %arrayidx.i, align 8, !tbaa !9
%next.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %11, ptr %next.i, align 8, !tbaa !18
store ptr %call.i, ptr %arrayidx.i, align 8, !tbaa !9
%call3.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #11
store i32 %7, ptr %call3.i, align 8, !tbaa !15
%weight5.i = getelementptr inbounds %struct.node, ptr %call3.i, i64 0, i32 1
store i32 %9, ptr %weight5.i, align 4, !tbaa !17
%12 = load ptr, ptr @list, align 8, !tbaa !9
%idxprom6.i = sext i32 %8 to i64
%arrayidx7.i = getelementptr inbounds ptr, ptr %12, i64 %idxprom6.i
%13 = load ptr, ptr %arrayidx7.i, align 8, !tbaa !9
%next8.i = getelementptr inbounds %struct.node, ptr %call3.i, i64 0, i32 2
store ptr %13, ptr %next8.i, align 8, !tbaa !18
store ptr %call3.i, ptr %arrayidx7.i, align 8, !tbaa !9
%inc13 = add nuw nsw i32 %i.139, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%cmp8 = icmp slt i32 %inc13, %sub
br i1 %cmp8, label %for.body10, label %for.end14, !llvm.loop !19
for.end14: ; preds = %for.body10
call void @Dfs(i32 noundef %7, i32 noundef -1)
%15 = load i32, ptr %s, align 4, !tbaa !5
call void @RevDfs(i32 noundef %15, i32 noundef -1)
%16 = load i32, ptr %n, align 4, !tbaa !5
%cmp1640 = icmp sgt i32 %16, 0
br i1 %cmp1640, label %for.body18, label %for.end26
for.body18: ; preds = %for.end14, %for.body18
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body18 ], [ 0, %for.end14 ]
%17 = load ptr, ptr @maxdis, align 8, !tbaa !9
%arrayidx20 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv43
%18 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%19 = load ptr, ptr @list, align 8, !tbaa !9
%arrayidx23 = getelementptr inbounds ptr, ptr %19, i64 %indvars.iv43
%20 = load ptr, ptr %arrayidx23, align 8, !tbaa !9
call void @free(ptr noundef %20) #9
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%21 = load i32, ptr %n, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp16 = icmp slt i64 %indvars.iv.next44, %22
br i1 %cmp16, label %for.body18, label %for.end26, !llvm.loop !20
for.end26: ; preds = %for.body18, %for.end14
%23 = load ptr, ptr @list, align 8, !tbaa !9
call void @free(ptr noundef %23) #9
%24 = load ptr, ptr @maxdis, align 8, !tbaa !9
call void @free(ptr noundef %24) #9
%25 = load ptr, ptr @premaxdis, align 8, !tbaa !9
call void @free(ptr noundef %25) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) 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: mustprogress nofree nounwind willreturn uwtable
define dso_local void @Insert(i32 noundef %a, i32 noundef %b, i32 noundef %w) local_unnamed_addr #5 {
entry:
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #11
store i32 %b, ptr %call, align 8, !tbaa !15
%weight = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
store i32 %w, ptr %weight, align 4, !tbaa !17
%0 = load ptr, ptr @list, align 8, !tbaa !9
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%next = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %1, ptr %next, align 8, !tbaa !18
store ptr %call, ptr %arrayidx, align 8, !tbaa !9
%call3 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #11
store i32 %a, ptr %call3, align 8, !tbaa !15
%weight5 = getelementptr inbounds %struct.node, ptr %call3, i64 0, i32 1
store i32 %w, ptr %weight5, align 4, !tbaa !17
%2 = load ptr, ptr @list, align 8, !tbaa !9
%idxprom6 = sext i32 %b to i64
%arrayidx7 = getelementptr inbounds ptr, ptr %2, i64 %idxprom6
%3 = load ptr, ptr %arrayidx7, align 8, !tbaa !9
%next8 = getelementptr inbounds %struct.node, ptr %call3, i64 0, i32 2
store ptr %3, ptr %next8, align 8, !tbaa !18
store ptr %call3, ptr %arrayidx7, align 8, !tbaa !9
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @Dfs(i32 noundef %root, i32 noundef %fa) local_unnamed_addr #6 {
entry:
%0 = load ptr, ptr @list, align 8, !tbaa !9
%idxprom = sext i32 %root to i64
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom
%i.058 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%cmp.not59 = icmp eq ptr %i.058, null
br i1 %cmp.not59, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.060 = phi ptr [ %i.0, %for.inc ], [ %i.058, %entry ]
%1 = load i32, ptr %i.060, align 8, !tbaa !15
%cmp1.not = icmp eq i32 %1, %fa
br i1 %cmp1.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
tail call void @Dfs(i32 noundef %1, i32 noundef %root)
%2 = load ptr, ptr @maxdis, align 8, !tbaa !9
%3 = load i32, ptr %i.060, align 8, !tbaa !15
%idxprom4 = sext i32 %3 to i64
%arrayidx5 = getelementptr inbounds i32, ptr %2, i64 %idxprom4
%4 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%weight = getelementptr inbounds %struct.node, ptr %i.060, i64 0, i32 1
%5 = load i32, ptr %weight, align 4, !tbaa !17
%add = add nsw i32 %5, %4
%arrayidx7 = getelementptr inbounds i32, ptr %2, i64 %idxprom
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %add, %6
%7 = load ptr, ptr @premaxdis, align 8, !tbaa !9
%arrayidx13 = getelementptr inbounds i32, ptr %7, i64 %idxprom
br i1 %cmp8, label %if.then9, label %if.else
if.then9: ; preds = %if.then
store i32 %6, ptr %arrayidx13, align 4, !tbaa !5
%8 = load i32, ptr %i.060, align 8, !tbaa !15
%idxprom15 = sext i32 %8 to i64
%arrayidx16 = getelementptr inbounds i32, ptr %2, i64 %idxprom15
%9 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%10 = load i32, ptr %weight, align 4, !tbaa !17
%add18 = add nsw i32 %10, %9
store i32 %add18, ptr %arrayidx7, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %if.then
%11 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %add, %11
br i1 %cmp28, label %if.then29, label %for.inc
if.then29: ; preds = %if.else
store i32 %add, ptr %arrayidx13, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.else, %if.then29, %if.then9
%next = getelementptr inbounds %struct.node, ptr %i.060, i64 0, i32 2
%i.0 = load ptr, ptr %next, align 8, !tbaa !9
%cmp.not = icmp eq ptr %i.0, null
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !21
for.end: ; preds = %for.inc, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @RevDfs(i32 noundef %leaf, i32 noundef %fa) local_unnamed_addr #6 {
entry:
%0 = load ptr, ptr @list, align 8, !tbaa !9
%idxprom = sext i32 %leaf to i64
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom
%i.0130 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%cmp.not131 = icmp eq ptr %i.0130, null
br i1 %cmp.not131, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.0132 = phi ptr [ %i.0, %for.inc ], [ %i.0130, %entry ]
%1 = load i32, ptr %i.0132, align 8, !tbaa !15
%cmp1.not = icmp eq i32 %1, %fa
br i1 %cmp1.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%2 = load ptr, ptr @maxdis, align 8, !tbaa !9
%idxprom3 = sext i32 %1 to i64
%arrayidx4 = getelementptr inbounds i32, ptr %2, i64 %idxprom3
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%weight = getelementptr inbounds %struct.node, ptr %i.0132, i64 0, i32 1
%4 = load i32, ptr %weight, align 4, !tbaa !17
%add = add nsw i32 %4, %3
%arrayidx6 = getelementptr inbounds i32, ptr %2, i64 %idxprom
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %add, %5
br i1 %cmp7, label %if.then8, label %if.else48
if.then8: ; preds = %if.then
%6 = load ptr, ptr @premaxdis, align 8, !tbaa !9
%arrayidx10 = getelementptr inbounds i32, ptr %6, i64 %idxprom
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%add12 = add nsw i32 %7, %4
%cmp16 = icmp sgt i32 %add12, %3
%arrayidx23 = getelementptr inbounds i32, ptr %6, i64 %idxprom3
br i1 %cmp16, label %if.then17, label %if.else
if.then17: ; preds = %if.then8
store i32 %3, ptr %arrayidx23, align 4, !tbaa !5
%8 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%9 = load i32, ptr %weight, align 4, !tbaa !17
%add27 = add nsw i32 %9, %8
%10 = load i32, ptr %i.0132, align 8, !tbaa !15
%idxprom29 = sext i32 %10 to i64
%arrayidx30 = getelementptr inbounds i32, ptr %2, i64 %idxprom29
store i32 %add27, ptr %arrayidx30, align 4, !tbaa !5
br label %if.end90
if.else: ; preds = %if.then8
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %add12, %11
br i1 %cmp38, label %if.then39, label %if.end90
if.then39: ; preds = %if.else
store i32 %add12, ptr %arrayidx23, align 4, !tbaa !5
br label %if.end90
if.else48: ; preds = %if.then
%add52 = add nsw i32 %5, %4
%cmp56 = icmp sgt i32 %add52, %3
%12 = load ptr, ptr @premaxdis, align 8, !tbaa !9
%arrayidx63 = getelementptr inbounds i32, ptr %12, i64 %idxprom3
br i1 %cmp56, label %if.then57, label %if.else71
if.then57: ; preds = %if.else48
store i32 %3, ptr %arrayidx63, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%14 = load i32, ptr %weight, align 4, !tbaa !17
%add67 = add nsw i32 %14, %13
%15 = load i32, ptr %i.0132, align 8, !tbaa !15
%idxprom69 = sext i32 %15 to i64
%arrayidx70 = getelementptr inbounds i32, ptr %2, i64 %idxprom69
store i32 %add67, ptr %arrayidx70, align 4, !tbaa !5
br label %if.end90
if.else71: ; preds = %if.else48
%16 = load i32, ptr %arrayidx63, align 4, !tbaa !5
%cmp79 = icmp sgt i32 %add52, %16
br i1 %cmp79, label %if.then80, label %if.end90
if.then80: ; preds = %if.else71
store i32 %add52, ptr %arrayidx63, align 4, !tbaa !5
br label %if.end90
if.end90: ; preds = %if.then57, %if.then80, %if.else71, %if.then17, %if.then39, %if.else
%17 = load i32, ptr %i.0132, align 8, !tbaa !15
tail call void @RevDfs(i32 noundef %17, i32 noundef %leaf)
br label %for.inc
for.inc: ; preds = %for.body, %if.end90
%next = getelementptr inbounds %struct.node, ptr %i.0132, i64 0, i32 2
%i.0 = load ptr, ptr %next, align 8, !tbaa !9
%cmp.not = icmp eq ptr %i.0, null
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !22
for.end: ; preds = %for.inc, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7
; 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 willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #8
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 #6 = { 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 #7 = { 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 #8 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0,1) }
attributes #11 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 0}
!16 = !{!"node", !6, i64 0, !6, i64 4, !10, i64 8}
!17 = !{!16, !6, i64 4}
!18 = !{!16, !10, i64 8}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
|
/*
* FileName: C_fix_4
* CreatedDate: 2020-05-17 16:17:26 +0900
* LastModified: 2020-05-17 16:55:42 +0900
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int dp[100000][3]={0};
int dp_search(int **a,int n,int u,int loc){
if(u==n){
return 0;
}
if(dp[u][loc]!=0){
return dp[u][loc];
}
int one,other;
if(loc==0){
one = dp_search(a,n,u+1,1)+a[u][0];
other = dp_search(a,n,u+1,2)+a[u][0];
}
else if(loc==1){
one = dp_search(a,n,u+1,0)+a[u][1];
other = dp_search(a,n,u+1,2)+a[u][1];
}
else{
one = dp_search(a,n,u+1,0)+a[u][2];
other = dp_search(a,n,u+1,1)+a[u][2];
}
if(one<other){
dp[u][loc]=other;
return other;
}
else{
dp[u][loc]=one;
return one;
}
}
int main(void){
int n;
scanf("%d",&n);
int **a = malloc(n*sizeof(int*));
for(int i=0;i<n;i++){
a[i] = malloc(3*sizeof(int));
scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
}
int ans=0;
for(int i=0;i<3;i++){
int tmp = dp_search(a,n,0,i);
// printf("%d\n",dp_search(a,n,i,0));
if(ans<tmp){
ans=tmp;
}
}
printf("%d\n",ans);
for(int i=0;i<n;i++){
free(a[i]);
}
free(a);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256929/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256929/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dp = dso_local local_unnamed_addr global [100000 x [3 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @dp_search(ptr noundef %a, i32 noundef %n, i32 noundef %u, i32 noundef %loc) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, %n
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%idxprom1 = sext i32 %loc to i64
%arrayidx2 = getelementptr inbounds [100000 x [3 x i32]], ptr @dp, i64 0, i64 %idxprom, i64 %idxprom1
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp3.not = icmp eq i32 %0, 0
br i1 %cmp3.not, label %if.end9, label %return
if.end9: ; preds = %if.end
%add37 = add nsw i32 %u, 1
%arrayidx40 = getelementptr inbounds ptr, ptr %a, i64 %idxprom
switch i32 %loc, label %if.else36 [
i32 0, label %if.then11
i32 1, label %if.then23
]
if.then11: ; preds = %if.end9
%call = tail call i32 @dp_search(ptr noundef %a, i32 noundef %n, i32 noundef %add37, i32 noundef 1)
%1 = load ptr, ptr %arrayidx40, align 8, !tbaa !9
%2 = load i32, ptr %1, align 4, !tbaa !5
%add15 = add nsw i32 %2, %call
%call17 = tail call i32 @dp_search(ptr noundef %a, i32 noundef %n, i32 noundef %add37, i32 noundef 2)
%3 = load ptr, ptr %arrayidx40, align 8, !tbaa !9
br label %if.end50
if.then23: ; preds = %if.end9
%call25 = tail call i32 @dp_search(ptr noundef %a, i32 noundef %n, i32 noundef %add37, i32 noundef 0)
%4 = load ptr, ptr %arrayidx40, align 8, !tbaa !9
%arrayidx28 = getelementptr inbounds i32, ptr %4, i64 1
%5 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%add29 = add nsw i32 %5, %call25
%call31 = tail call i32 @dp_search(ptr noundef %a, i32 noundef %n, i32 noundef %add37, i32 noundef 2)
%6 = load ptr, ptr %arrayidx40, align 8, !tbaa !9
%arrayidx34 = getelementptr inbounds i32, ptr %6, i64 1
br label %if.end50
if.else36: ; preds = %if.end9
%call38 = tail call i32 @dp_search(ptr noundef %a, i32 noundef %n, i32 noundef %add37, i32 noundef 0)
%7 = load ptr, ptr %arrayidx40, align 8, !tbaa !9
%arrayidx41 = getelementptr inbounds i32, ptr %7, i64 2
%8 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%add42 = add nsw i32 %8, %call38
%call44 = tail call i32 @dp_search(ptr noundef %a, i32 noundef %n, i32 noundef %add37, i32 noundef 1)
%9 = load ptr, ptr %arrayidx40, align 8, !tbaa !9
%arrayidx47 = getelementptr inbounds i32, ptr %9, i64 2
br label %if.end50
if.end50: ; preds = %if.then23, %if.else36, %if.then11
%arrayidx34.sink = phi ptr [ %arrayidx34, %if.then23 ], [ %arrayidx47, %if.else36 ], [ %3, %if.then11 ]
%call31.sink = phi i32 [ %call31, %if.then23 ], [ %call44, %if.else36 ], [ %call17, %if.then11 ]
%one.0 = phi i32 [ %add29, %if.then23 ], [ %add42, %if.else36 ], [ %add15, %if.then11 ]
%10 = load i32, ptr %arrayidx34.sink, align 4, !tbaa !5
%add35 = add nsw i32 %10, %call31.sink
%other.0.one.0 = tail call i32 @llvm.smax.i32(i32 %one.0, i32 %add35)
store i32 %other.0.one.0, ptr %arrayidx2, align 4, !tbaa !5
br label %return
return: ; preds = %if.end, %entry, %if.end50
%retval.1 = phi i32 [ %other.0.one.0, %if.end50 ], [ 0, %entry ], [ %0, %if.end ]
ret i32 %retval.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: 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, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp55 = icmp sgt i32 %0, 0
br i1 %cmp55, label %for.body, label %for.cond15.preheader
for.cond15.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %5, %for.body ]
%call20 = call i32 @dp_search(ptr noundef %call1, i32 noundef %1, i32 noundef 0, i32 noundef 0)
%2 = load i32, ptr %n, align 4, !tbaa !5
%call20.1 = call i32 @dp_search(ptr noundef %call1, i32 noundef %2, i32 noundef 0, i32 noundef 1)
%spec.select = call i32 @llvm.smax.i32(i32 %call20, i32 %call20.1)
%3 = load i32, ptr %n, align 4, !tbaa !5
%call20.2 = call i32 @dp_search(ptr noundef %call1, i32 noundef %3, i32 noundef 0, i32 noundef 2)
%spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %call20.2)
%spec.select.2 = call i32 @llvm.smax.i32(i32 %spec.select.1, i32 0)
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select.2)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp2959 = icmp sgt i32 %4, 0
br i1 %cmp2959, label %for.body32, label %for.cond.cleanup31
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call3 = call noalias dereferenceable_or_null(12) ptr @malloc(i64 noundef 12) #8
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call3, ptr %arrayidx, align 8, !tbaa !9
%arrayidx9 = getelementptr inbounds i32, ptr %call3, i64 1
%arrayidx12 = getelementptr inbounds i32, ptr %call3, i64 2
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call3, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %arrayidx12)
%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 !11
for.cond.cleanup31: ; preds = %for.body32, %for.cond15.preheader
call void @free(ptr noundef %call1) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.body32: ; preds = %for.cond15.preheader, %for.body32
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.body32 ], [ 0, %for.cond15.preheader ]
%arrayidx34 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv62
%7 = load ptr, ptr %arrayidx34, align 8, !tbaa !9
call void @free(ptr noundef %7) #7
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp29 = icmp slt i64 %indvars.iv.next63, %9
br i1 %cmp29, label %for.body32, label %for.cond.cleanup31, !llvm.loop !13
}
; 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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
#include<stdlib.h>
long minf(long a,long b){
if(a>b){
return b;
}else{
return a;
}
}
long maxf(long a,long b){
if(a>b){
return a;
}else{
return b;
}
}
int main(){
long n = 0;
long a[100000][3] = {};
long dp[100000][3] = {};
long k = 0;
long i = 0;
long j = 0;
long min = -1;
long max = -1;
scanf("%ld",&n);
for(i=0;i<n;i++){
scanf("%ld %ld %ld",&a[i][0],&a[i][1],&a[i][2]);
}
dp[0][0] = a[0][0];
dp[0][1] = a[0][1];
dp[0][2] = a[0][2];
for(i=1;i<n;i++){
for(j=0;j<3;j++){
max = -1;
for(k=0;k<3;k++){
if(j != k){
if(max == -1){
max = dp[i-1][k] + a[i][j];
}else{
max = maxf(max,dp[i-1][k] + a[i][j]);
}
}
}
dp[i][j] = max;
//printf("%ld.%ld-%ld,",max,i,j);
}
}
max = maxf(dp[n-1][0],dp[n-1][1]);
max = maxf(max,dp[n-1][2]);
printf("%ld",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256972/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256972/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"%ld %ld %ld\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @minf(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%b.a = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %b.a
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @maxf(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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
%a = alloca [100000 x [3 x i64]], align 16
%dp = alloca [100000 x [3 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
store i64 0, ptr %n, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 2400000, ptr nonnull %a) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400000) %a, i8 0, i64 2400000, i1 false)
call void @llvm.lifetime.start.p0(i64 2400000, ptr nonnull %dp) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400000) %dp, i8 0, i64 2400000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp92 = icmp sgt i64 %0, 0
br i1 %cmp92, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %dp, i8 0, i64 24, i1 false)
br label %for.end53
for.body: ; preds = %entry, %for.body
%i.093 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x [3 x i64]], ptr %a, i64 0, i64 %i.093
%arrayidx3 = getelementptr inbounds [100000 x [3 x i64]], ptr %a, i64 0, i64 %i.093, i64 1
%arrayidx5 = getelementptr inbounds [100000 x [3 x i64]], ptr %a, i64 0, i64 %i.093, i64 2
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx5)
%inc = add nuw nsw i64 %i.093, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%arrayidx16.phi.trans.insert = getelementptr inbounds [3 x i64], ptr %a, i64 0, i64 2
%.pre123 = load i64, ptr %arrayidx16.phi.trans.insert, align 16, !tbaa !5
%2 = load <2 x i64>, ptr %a, align 16, !tbaa !5
store <2 x i64> %2, ptr %dp, align 16, !tbaa !5
%arrayidx18 = getelementptr inbounds [3 x i64], ptr %dp, i64 0, i64 2
store i64 %.pre123, ptr %arrayidx18, align 16, !tbaa !5
%cmp2097 = icmp sgt i64 %1, 1
br i1 %cmp2097, label %if.then.2, label %for.end53
if.then.2: ; preds = %for.end, %if.then.2
%i.198 = phi i64 [ %inc52, %if.then.2 ], [ 1, %for.end ]
%sub35 = add nsw i64 %i.198, -1
%arrayidx39 = getelementptr inbounds [100000 x [3 x i64]], ptr %a, i64 0, i64 %i.198, i64 0
%arrayidx32.1 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub35, i64 1
%3 = load i64, ptr %arrayidx32.1, align 8, !tbaa !5
%4 = load i64, ptr %arrayidx39, align 8, !tbaa !5
%add.1 = add nsw i64 %4, %3
%cmp29.2 = icmp eq i64 %add.1, -1
%arrayidx32.2 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub35, i64 2
%5 = load i64, ptr %arrayidx32.2, align 8, !tbaa !5
%add.2 = add nsw i64 %4, %5
%a.b.i.2 = call i64 @llvm.smax.i64(i64 %add.1, i64 %add.2)
%max.1.2 = select i1 %cmp29.2, i64 %add.2, i64 %a.b.i.2
%arrayidx47 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %i.198, i64 0
store i64 %max.1.2, ptr %arrayidx47, align 8, !tbaa !5
%arrayidx39.1 = getelementptr inbounds [100000 x [3 x i64]], ptr %a, i64 0, i64 %i.198, i64 1
%arrayidx32.1106 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub35, i64 0
%6 = load i64, ptr %arrayidx32.1106, align 8, !tbaa !5
%7 = load i64, ptr %arrayidx39.1, align 8, !tbaa !5
%add.1107 = add nsw i64 %7, %6
%cmp29.2.1 = icmp eq i64 %add.1107, -1
%arrayidx32.2.1 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub35, i64 2
%8 = load i64, ptr %arrayidx32.2.1, align 8, !tbaa !5
%add.2.1 = add nsw i64 %7, %8
%a.b.i.2.1 = call i64 @llvm.smax.i64(i64 %add.1107, i64 %add.2.1)
%max.1.2.1 = select i1 %cmp29.2.1, i64 %add.2.1, i64 %a.b.i.2.1
%arrayidx47.1 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %i.198, i64 1
store i64 %max.1.2.1, ptr %arrayidx47.1, align 8, !tbaa !5
%arrayidx39.2 = getelementptr inbounds [100000 x [3 x i64]], ptr %a, i64 0, i64 %i.198, i64 2
%arrayidx32.2117 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub35, i64 0
%9 = load i64, ptr %arrayidx32.2117, align 8, !tbaa !5
%10 = load i64, ptr %arrayidx39.2, align 8, !tbaa !5
%add.2118 = add nsw i64 %10, %9
%cmp29.1.2 = icmp eq i64 %add.2118, -1
%arrayidx32.1.2 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub35, i64 1
%11 = load i64, ptr %arrayidx32.1.2, align 8, !tbaa !5
%add.1.2 = add nsw i64 %10, %11
%a.b.i.1.2 = call i64 @llvm.smax.i64(i64 %add.2118, i64 %add.1.2)
%max.1.1.2 = select i1 %cmp29.1.2, i64 %add.1.2, i64 %a.b.i.1.2
%arrayidx47.2 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %i.198, i64 2
store i64 %max.1.1.2, ptr %arrayidx47.2, align 8, !tbaa !5
%inc52 = add nuw nsw i64 %i.198, 1
%exitcond.not = icmp eq i64 %inc52, %1
br i1 %exitcond.not, label %for.end53, label %if.then.2, !llvm.loop !11
for.end53: ; preds = %if.then.2, %for.end.thread, %for.end
%.lcssa128 = phi i64 [ %0, %for.end.thread ], [ %1, %for.end ], [ %1, %if.then.2 ]
%sub54 = add nsw i64 %.lcssa128, -1
%arrayidx55 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub54
%12 = load i64, ptr %arrayidx55, align 8, !tbaa !5
%arrayidx59 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub54, i64 1
%13 = load i64, ptr %arrayidx59, align 8, !tbaa !5
%a.b.i90 = call i64 @llvm.smax.i64(i64 %12, i64 %13)
%arrayidx63 = getelementptr inbounds [100000 x [3 x i64]], ptr %dp, i64 0, i64 %sub54, i64 2
%14 = load i64, ptr %arrayidx63, align 8, !tbaa !5
%a.b.i91 = call i64 @llvm.smax.i64(i64 %a.b.i90, i64 %14)
%call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %a.b.i91)
call void @llvm.lifetime.end.p0(i64 2400000, ptr nonnull %dp) #6
call void @llvm.lifetime.end.p0(i64 2400000, ptr nonnull %a) #6
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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
// The choice that will maximize Taro's happiness is given by the 2D recurrence A(n, a),
// where n is the current day and a is the activity performed on day n.
//
// A(n, a) = (max_{b != a} A(n-1, b)) + a_n
int max(int a, int b)
{
return a > b ? a : b;
}
int max3(int a, int b, int c)
{
return max(max(a, b), c);
}
int solution(int **arr, int n)
{
int **memo = (int **)malloc(sizeof(int *)*n);
int i, j;
for (i = 0; i < n; i++)
{
int *row = (int *)malloc(sizeof(int)*3);
memo[i] = row;
}
memo[0][0] = arr[0][0];
memo[0][1] = arr[0][1];
memo[0][2] = arr[0][2];
for (i = 1; i < n; i++)
{
int act0 = memo[i-1][0];
int act1 = memo[i-1][1];
int act2 = memo[i-1][2];
memo[i][0] = max(act1, act2) + arr[i][0];
memo[i][1] = max(act0, act2) + arr[i][1];
memo[i][2] = max(act0, act1) + arr[i][2];
}
int act0 = memo[n-1][0];
int act1 = memo[n-1][1];
int act2 = memo[n-1][2];
return max3(act0, act1, act2);
}
int main(int argc, char **argv)
{
int n;
scanf("%d", &n);
int **arr = (int **)malloc(sizeof(int *)*n);
int i, j;
for (i = 0; i < n; i++)
{
int *row = (int *)malloc(sizeof(int *)*3);
for (j = 0; j < 3; j++)
{
scanf("%d", row+j);
}
arr[i] = row;
}
int best = solution(arr, n);
printf("%d\n", best);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257014/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257014/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max3(i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #0 {
entry:
%cond.i = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%cond.i2 = tail call i32 @llvm.smax.i32(i32 %cond.i, i32 %c)
ret i32 %cond.i2
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @solution(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = zext i32 %n to i64
%mul = shl nuw nsw i64 %conv, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #7
%cmp112 = icmp sgt i32 %n, 0
tail call void @llvm.assume(i1 %cmp112)
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%call2 = tail call noalias dereferenceable_or_null(12) ptr @malloc(i64 noundef 12) #7
%arrayidx = getelementptr inbounds ptr, ptr %call, i64 %indvars.iv
store ptr %call2, 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.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.pre = load ptr, ptr %call, align 8, !tbaa !5
%0 = load ptr, ptr %arr, align 8, !tbaa !5
%1 = load i32, ptr %0, align 4, !tbaa !11
store i32 %1, ptr %.pre, align 4, !tbaa !11
%arrayidx8 = getelementptr inbounds i32, ptr %0, i64 1
%2 = load i32, ptr %arrayidx8, align 4, !tbaa !11
%arrayidx10 = getelementptr inbounds i32, ptr %.pre, i64 1
store i32 %2, ptr %arrayidx10, align 4, !tbaa !11
%arrayidx12 = getelementptr inbounds i32, ptr %0, i64 2
%3 = load i32, ptr %arrayidx12, align 4, !tbaa !11
%arrayidx14 = getelementptr inbounds i32, ptr %.pre, i64 2
store i32 %3, ptr %arrayidx14, align 4, !tbaa !11
%cmp16114 = icmp ugt i32 %n, 1
br i1 %cmp16114, label %for.body18.preheader, label %for.end55
for.body18.preheader: ; preds = %for.end.loopexit
%wide.trip.count121 = zext i32 %n to i64
br label %for.body18
for.body18: ; preds = %for.body18.preheader, %for.body18
%4 = phi i32 [ %3, %for.body18.preheader ], [ %add49, %for.body18 ]
%5 = phi i32 [ %2, %for.body18.preheader ], [ %add41, %for.body18 ]
%6 = phi i32 [ %1, %for.body18.preheader ], [ %add, %for.body18 ]
%indvars.iv117 = phi i64 [ 1, %for.body18.preheader ], [ %indvars.iv.next118, %for.body18 ]
%cond.i = tail call i32 @llvm.smax.i32(i32 %5, i32 %4)
%arrayidx32 = getelementptr inbounds ptr, ptr %arr, i64 %indvars.iv117
%7 = load ptr, ptr %arrayidx32, align 8, !tbaa !5
%8 = load i32, ptr %7, align 4, !tbaa !11
%add = add nsw i32 %8, %cond.i
%arrayidx35 = getelementptr inbounds ptr, ptr %call, i64 %indvars.iv117
%9 = load ptr, ptr %arrayidx35, align 8, !tbaa !5
store i32 %add, ptr %9, align 4, !tbaa !11
%cond.i110 = tail call i32 @llvm.smax.i32(i32 %6, i32 %4)
%arrayidx40 = getelementptr inbounds i32, ptr %7, i64 1
%10 = load i32, ptr %arrayidx40, align 4, !tbaa !11
%add41 = add nsw i32 %10, %cond.i110
%arrayidx44 = getelementptr inbounds i32, ptr %9, i64 1
store i32 %add41, ptr %arrayidx44, align 4, !tbaa !11
%cond.i111 = tail call i32 @llvm.smax.i32(i32 %6, i32 %5)
%arrayidx48 = getelementptr inbounds i32, ptr %7, i64 2
%11 = load i32, ptr %arrayidx48, align 4, !tbaa !11
%add49 = add nsw i32 %11, %cond.i111
%arrayidx52 = getelementptr inbounds i32, ptr %9, i64 2
store i32 %add49, ptr %arrayidx52, align 4, !tbaa !11
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%exitcond122.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count121
br i1 %exitcond122.not, label %for.end55, label %for.body18, !llvm.loop !13
for.end55: ; preds = %for.body18, %for.end.loopexit
%sub57 = add nsw i32 %n, -1
%idxprom58 = sext i32 %sub57 to i64
%arrayidx59 = getelementptr inbounds ptr, ptr %call, i64 %idxprom58
%12 = load ptr, ptr %arrayidx59, align 8, !tbaa !5
%13 = load i32, ptr %12, align 4, !tbaa !11
%arrayidx65 = getelementptr inbounds i32, ptr %12, i64 1
%14 = load i32, ptr %arrayidx65, align 4, !tbaa !11
%arrayidx70 = getelementptr inbounds i32, ptr %12, i64 2
%15 = load i32, ptr %arrayidx70, align 4, !tbaa !11
%cond.i.i = tail call i32 @llvm.smax.i32(i32 %13, i32 %14)
%cond.i2.i = tail call i32 @llvm.smax.i32(i32 %cond.i.i, i32 %15)
ret i32 %cond.i2.i
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call3 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #7
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %call3)
%add.ptr.1 = getelementptr inbounds i32, ptr %call3, i64 1
%call8.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.1)
%add.ptr.2 = getelementptr inbounds i32, ptr %call3, i64 2
%call8.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr.2)
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call3, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr %n, align 4, !tbaa !11
%1 = sext i32 %.pr to i64
%cmp = icmp slt i64 %indvars.iv.next, %1
br i1 %cmp, label %for.body, label %for.end11, !llvm.loop !14
for.end11: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %.pr, %for.body ]
%conv.i = zext i32 %.lcssa to i64
%mul.i = shl nuw nsw i64 %conv.i, 3
%call.i = call noalias ptr @malloc(i64 noundef %mul.i) #7
%cmp112.i = icmp sgt i32 %.lcssa, 0
call void @llvm.assume(i1 %cmp112.i)
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.end11
%indvars.iv.i = phi i64 [ 0, %for.end11 ], [ %indvars.iv.next.i, %for.body.i ]
%call2.i = call noalias dereferenceable_or_null(12) ptr @malloc(i64 noundef 12) #7
%arrayidx.i = getelementptr inbounds ptr, ptr %call.i, i64 %indvars.iv.i
store ptr %call2.i, ptr %arrayidx.i, align 8, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %conv.i
br i1 %exitcond.not.i, label %for.end.loopexit.i, label %for.body.i, !llvm.loop !9
for.end.loopexit.i: ; preds = %for.body.i
%.pre.i = load ptr, ptr %call.i, align 8, !tbaa !5
%2 = load ptr, ptr %call1, align 8, !tbaa !5
%3 = load i32, ptr %2, align 4, !tbaa !11
store i32 %3, ptr %.pre.i, align 4, !tbaa !11
%arrayidx8.i = getelementptr inbounds i32, ptr %2, i64 1
%4 = load i32, ptr %arrayidx8.i, align 4, !tbaa !11
%arrayidx10.i = getelementptr inbounds i32, ptr %.pre.i, i64 1
store i32 %4, ptr %arrayidx10.i, align 4, !tbaa !11
%arrayidx12.i = getelementptr inbounds i32, ptr %2, i64 2
%5 = load i32, ptr %arrayidx12.i, align 4, !tbaa !11
%arrayidx14.i = getelementptr inbounds i32, ptr %.pre.i, i64 2
store i32 %5, ptr %arrayidx14.i, align 4, !tbaa !11
%cmp16114.i = icmp ugt i32 %.lcssa, 1
br i1 %cmp16114.i, label %for.body18.i, label %solution.exit
for.body18.i: ; preds = %for.end.loopexit.i, %for.body18.i
%6 = phi i32 [ %add49.i, %for.body18.i ], [ %5, %for.end.loopexit.i ]
%7 = phi i32 [ %add41.i, %for.body18.i ], [ %4, %for.end.loopexit.i ]
%8 = phi i32 [ %add.i, %for.body18.i ], [ %3, %for.end.loopexit.i ]
%indvars.iv117.i = phi i64 [ %indvars.iv.next118.i, %for.body18.i ], [ 1, %for.end.loopexit.i ]
%cond.i.i = call i32 @llvm.smax.i32(i32 %7, i32 %6)
%arrayidx32.i = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv117.i
%9 = load ptr, ptr %arrayidx32.i, align 8, !tbaa !5
%10 = load i32, ptr %9, align 4, !tbaa !11
%add.i = add nsw i32 %10, %cond.i.i
%arrayidx35.i = getelementptr inbounds ptr, ptr %call.i, i64 %indvars.iv117.i
%11 = load ptr, ptr %arrayidx35.i, align 8, !tbaa !5
store i32 %add.i, ptr %11, align 4, !tbaa !11
%cond.i110.i = call i32 @llvm.smax.i32(i32 %8, i32 %6)
%arrayidx40.i = getelementptr inbounds i32, ptr %9, i64 1
%12 = load i32, ptr %arrayidx40.i, align 4, !tbaa !11
%add41.i = add nsw i32 %12, %cond.i110.i
%arrayidx44.i = getelementptr inbounds i32, ptr %11, i64 1
store i32 %add41.i, ptr %arrayidx44.i, align 4, !tbaa !11
%cond.i111.i = call i32 @llvm.smax.i32(i32 %8, i32 %7)
%arrayidx48.i = getelementptr inbounds i32, ptr %9, i64 2
%13 = load i32, ptr %arrayidx48.i, align 4, !tbaa !11
%add49.i = add nsw i32 %13, %cond.i111.i
%arrayidx52.i = getelementptr inbounds i32, ptr %11, i64 2
store i32 %add49.i, ptr %arrayidx52.i, align 4, !tbaa !11
%indvars.iv.next118.i = add nuw nsw i64 %indvars.iv117.i, 1
%exitcond122.not.i = icmp eq i64 %indvars.iv.next118.i, %conv.i
br i1 %exitcond122.not.i, label %solution.exit, label %for.body18.i, !llvm.loop !13
solution.exit: ; preds = %for.body18.i, %for.end.loopexit.i
%sub57.i = add nsw i32 %.lcssa, -1
%idxprom58.i = zext i32 %sub57.i to i64
%arrayidx59.i = getelementptr inbounds ptr, ptr %call.i, i64 %idxprom58.i
%14 = load ptr, ptr %arrayidx59.i, align 8, !tbaa !5
%15 = load i32, ptr %14, align 4, !tbaa !11
%arrayidx65.i = getelementptr inbounds i32, ptr %14, i64 1
%16 = load i32, ptr %arrayidx65.i, align 4, !tbaa !11
%arrayidx70.i = getelementptr inbounds i32, ptr %14, i64 2
%17 = load i32, ptr %arrayidx70.i, align 4, !tbaa !11
%cond.i.i.i = call i32 @llvm.smax.i32(i32 %15, i32 %16)
%cond.i2.i.i = call i32 @llvm.smax.i32(i32 %cond.i.i.i, i32 %17)
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond.i2.i.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !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 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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)
ll n,k;
ll a[100010][3];
ll dp[100010][3];
int main(){
scanf("%lld",&n);
rep(i,0,n)scanf("%lld%lld%lld",&a[i][0],&a[i][1],&a[i][2]);
rep(i,0,n)rep(j,0,3){
rep(k,0,3)if(j!=k)dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i][k]);
}
printf("%lld\n",max(dp[n][0],max(dp[n][1],dp[n][2])));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257065/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257065/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@n = dso_local global i64 0, align 8
@.str.1 = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@a = dso_local global [100010 x [3 x i64]] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [100010 x [3 x i64]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@k = dso_local local_unnamed_addr global i64 0, align 8
; 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) #6
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) #6
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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i64, ptr @n, align 8, !tbaa !5
%cmp114 = icmp sgt i64 %0, 0
br i1 %cmp114, label %for.body, label %for.cond.cleanup10
for.cond8.preheader: ; preds = %for.body
%cmp9118 = icmp sgt i64 %1, 0
br i1 %cmp9118, label %for.inc40.2.2, label %for.cond.cleanup10
for.body: ; preds = %entry, %for.body
%i.0115 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 x [3 x i64]], ptr @a, i64 0, i64 %i.0115
%arrayidx3 = getelementptr inbounds [100010 x [3 x i64]], ptr @a, i64 0, i64 %i.0115, i64 1
%arrayidx5 = getelementptr inbounds [100010 x [3 x i64]], ptr @a, i64 0, i64 %i.0115, i64 2
%call6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx5)
%inc = add nuw nsw i64 %i.0115, 1
%1 = load i64, ptr @n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !11
for.cond.cleanup10: ; preds = %for.inc40.2.2, %entry, %for.cond8.preheader
%.lcssa137 = phi i64 [ %1, %for.cond8.preheader ], [ %0, %entry ], [ %1, %for.inc40.2.2 ]
%arrayidx49 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %.lcssa137
%2 = load i64, ptr %arrayidx49, align 8, !tbaa !5
%arrayidx52 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %.lcssa137, i64 1
%3 = load i64, ptr %arrayidx52, align 8, !tbaa !5
%arrayidx54 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %.lcssa137, i64 2
%4 = load i64, ptr %arrayidx54, align 8, !tbaa !5
%. = tail call i64 @llvm.smax.i64(i64 %3, i64 %4)
%spec.select = tail call i64 @llvm.smax.i64(i64 %2, i64 %.)
%call84 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select)
ret i32 0
for.inc40.2.2: ; preds = %for.cond8.preheader, %for.inc40.2.2
%i7.0119 = phi i64 [ %add, %for.inc40.2.2 ], [ 0, %for.cond8.preheader ]
%add = add nuw nsw i64 %i7.0119, 1
%arrayidx24 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %i7.0119, i64 0
%arrayidx22.2 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %add, i64 2
%5 = load i64, ptr %arrayidx22.2, align 8, !tbaa !5
%6 = load i64, ptr %arrayidx24, align 8, !tbaa !5
%arrayidx26.2 = getelementptr inbounds [100010 x [3 x i64]], ptr @a, i64 0, i64 %i7.0119, i64 2
%7 = load i64, ptr %arrayidx26.2, align 8, !tbaa !5
%add27.2 = add nsw i64 %7, %6
%.add27.2 = tail call i64 @llvm.smax.i64(i64 %5, i64 %add27.2)
store i64 %.add27.2, ptr %arrayidx22.2, align 8, !tbaa !5
%arrayidx24.1 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %i7.0119, i64 1
%arrayidx22.1122 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %add, i64 0
%arrayidx26.1123 = getelementptr inbounds [100010 x [3 x i64]], ptr @a, i64 0, i64 %i7.0119, i64 0
%8 = load <2 x i64>, ptr %arrayidx22.1122, align 8, !tbaa !5
%9 = load <2 x i64>, ptr %arrayidx24, align 8, !tbaa !5
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
%11 = load <2 x i64>, ptr %arrayidx26.1123, align 8, !tbaa !5
%12 = add nsw <2 x i64> %11, %10
%13 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %8, <2 x i64> %12)
store <2 x i64> %13, ptr %arrayidx22.1122, align 8, !tbaa !5
%arrayidx24.2 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %i7.0119, i64 2
%arrayidx22.2129 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %add, i64 0
%14 = load i64, ptr %arrayidx22.2129, align 8, !tbaa !5
%15 = load i64, ptr %arrayidx24.2, align 8, !tbaa !5
%arrayidx26.2130 = getelementptr inbounds [100010 x [3 x i64]], ptr @a, i64 0, i64 %i7.0119, i64 0
%16 = load i64, ptr %arrayidx26.2130, align 8, !tbaa !5
%add27.2131 = add nsw i64 %16, %15
%.add27.2132 = tail call i64 @llvm.smax.i64(i64 %14, i64 %add27.2131)
store i64 %.add27.2132, ptr %arrayidx22.2129, align 8, !tbaa !5
%arrayidx22.1.2 = getelementptr inbounds [100010 x [3 x i64]], ptr @dp, i64 0, i64 %add, i64 1
%arrayidx26.1.2 = getelementptr inbounds [100010 x [3 x i64]], ptr @a, i64 0, i64 %i7.0119, i64 1
%17 = load <2 x i64>, ptr %arrayidx22.1.2, align 8, !tbaa !5
%18 = load <2 x i64>, ptr %arrayidx24.1, align 8, !tbaa !5
%19 = shufflevector <2 x i64> %18, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
%20 = load <2 x i64>, ptr %arrayidx26.1.2, align 8, !tbaa !5
%21 = add nsw <2 x i64> %20, %19
%22 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %17, <2 x i64> %21)
store <2 x i64> %22, ptr %arrayidx22.1.2, align 8, !tbaa !5
%exitcond.not = icmp eq i64 %add, %1
br i1 %exitcond.not, label %for.cond.cleanup10, label %for.inc40.2.2, !llvm.loop !12
}
; 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 i64 @llvm.smax.i64(i64, i64) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nofree nounwind "no-trapping-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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
int a,b,c,d,n,h=7,flag=0;
scanf("%d",&n);
d=n%10;
c=(n/10)%10;
b=(n/100)%10;
a=(n/1000)%10;
if(a+b+c+d==7&&flag==0)
{
printf("%d+%d+%d+%d=7",a,b,c,d);
flag=1;
}
else if(a-b+c-d==7&&flag==0)
{
printf("%d-%d+%d-%d=7",a,b,c,d);
flag=1;
}
else if(a+b+c-d==7&&flag==0)
{
printf("%d+%d+%d-%d=7",a,b,c,d);
flag=1;
}
else if(a+b-c+d==7&&flag==0)
{
printf("%d+%d-%d+%d=7",a,b,c,d);
flag=1;
}
else if(a+b-c-d==7&&flag==0)
{
printf("%d+%d-%d-%d=7",a,b,c,d);
flag=1;
}
else if(a-b-c-d==7&&flag==0)
{
printf("%d-%d-%d-%d=7",a,b,c,d);
flag=1;
}
else if(a-b-c+d==7&&flag==0)
{
printf("%d-%d-%d+%d=7",a,b,c,d);
flag=1;
}
else if(a-b+c+d==7&&flag==0)
{
printf("%d-%d+%d+%d=7",a,b,c,d);
flag=1;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257115/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257115/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [14 x i8] c"%d+%d+%d+%d=7\00", align 1
@.str.2 = private unnamed_addr constant [14 x i8] c"%d-%d+%d-%d=7\00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"%d+%d+%d-%d=7\00", align 1
@.str.4 = private unnamed_addr constant [14 x i8] c"%d+%d-%d+%d=7\00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"%d+%d-%d-%d=7\00", align 1
@.str.6 = private unnamed_addr constant [14 x i8] c"%d-%d-%d-%d=7\00", align 1
@.str.7 = private unnamed_addr constant [14 x i8] c"%d-%d-%d+%d=7\00", align 1
@.str.8 = private unnamed_addr constant [14 x i8] c"%d-%d+%d+%d=7\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
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%rem1 = srem i32 %div, 10
%div2 = sdiv i32 %0, 100
%rem3 = srem i32 %div2, 10
%div4 = sdiv i32 %0, 1000
%rem5 = srem i32 %div4, 10
%add = add nsw i32 %rem5, %rem3
%add6 = add nsw i32 %add, %rem1
%add7 = add nsw i32 %add6, %rem
%cmp = icmp eq i32 %add7, 7
br i1 %cmp, label %if.end77.sink.split, label %if.else
if.else: ; preds = %entry
%sub = sub nsw i32 %rem5, %rem3
%add10 = add nsw i32 %sub, %rem1
%sub11 = sub nsw i32 %add10, %rem
%cmp12 = icmp eq i32 %sub11, 7
br i1 %cmp12, label %if.end77.sink.split, label %if.else17
if.else17: ; preds = %if.else
%sub20 = sub nsw i32 %add6, %rem
%cmp21 = icmp eq i32 %sub20, 7
br i1 %cmp21, label %if.end77.sink.split, label %if.else26
if.else26: ; preds = %if.else17
%sub28 = sub nsw i32 %add, %rem1
%add29 = add nsw i32 %sub28, %rem
%cmp30 = icmp eq i32 %add29, 7
br i1 %cmp30, label %if.end77.sink.split, label %if.else35
if.else35: ; preds = %if.else26
%sub38 = sub nsw i32 %sub28, %rem
%cmp39 = icmp eq i32 %sub38, 7
br i1 %cmp39, label %if.end77.sink.split, label %if.else44
if.else44: ; preds = %if.else35
%sub46 = sub nsw i32 %sub, %rem1
%sub47 = sub nsw i32 %sub46, %rem
%cmp48 = icmp eq i32 %sub47, 7
br i1 %cmp48, label %if.end77.sink.split, label %if.else53
if.else53: ; preds = %if.else44
%add56 = add nsw i32 %sub46, %rem
%cmp57 = icmp eq i32 %add56, 7
br i1 %cmp57, label %if.end77.sink.split, label %if.else62
if.else62: ; preds = %if.else53
%add65 = add nsw i32 %add10, %rem
%cmp66 = icmp eq i32 %add65, 7
br i1 %cmp66, label %if.end77.sink.split, label %if.end77
if.end77.sink.split: ; preds = %if.else62, %if.else53, %if.else44, %if.else35, %if.else26, %if.else17, %if.else, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ @.str.3, %if.else17 ], [ @.str.4, %if.else26 ], [ @.str.5, %if.else35 ], [ @.str.6, %if.else44 ], [ @.str.7, %if.else53 ], [ @.str.8, %if.else62 ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink, i32 noundef %rem5, i32 noundef %rem3, i32 noundef %rem1, i32 noundef %rem)
br label %if.end77
if.end77: ; preds = %if.end77.sink.split, %if.else62
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define bit(n,m)((n>>m)&1)
int main(){
char a[5];
scanf("%s",a);
rep(i,0,8){
int ans=a[0]-48;
rep(j,0,3)ans+=bit(i,j)?a[j+1]-48:48-a[j+1];
if(ans==7){
rep(j,0,3)printf("%c%c",a[j],bit(i,j)?'+':'-');
printf("%c=7",a[3]);
return 0;
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257166/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257166/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%c%c\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%c=7\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
cond.end.2:
%a = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%arrayidx34 = getelementptr inbounds [5 x i8], ptr %a, i64 0, i64 3
%0 = load i8, ptr %a, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%sub = add nsw i32 %conv, -48
%arrayidx11 = getelementptr inbounds [5 x i8], ptr %a, i64 0, i64 1
%1 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%conv12 = sext i8 %1 to i32
%arrayidx11.1 = getelementptr inbounds [5 x i8], ptr %a, i64 0, i64 2
%2 = load i8, ptr %arrayidx11.1, align 1, !tbaa !5
%conv12.1 = sext i8 %2 to i32
%3 = add nsw i32 %conv12, %conv12.1
%4 = load i8, ptr %arrayidx34, align 1, !tbaa !5
%conv12.2 = sext i8 %4 to i32
%5 = add nsw i32 %3, %conv12.2
%6 = sub nsw i32 %conv, %5
%cmp15.not = icmp eq i32 %6, -89
br i1 %cmp15.not, label %for.body22.preheader, label %cond.end.2.1
for.body22.preheader: ; preds = %cond.end.2.7, %cond.end.2.6, %cond.end.2.5, %cond.end.2.4, %cond.end.2.3, %cond.end.2.2, %cond.end.2.1, %cond.end.2
%tobool28.not.2 = phi i32 [ 45, %cond.end.2 ], [ 45, %cond.end.2.1 ], [ 45, %cond.end.2.2 ], [ 45, %cond.end.2.3 ], [ 43, %cond.end.2.4 ], [ 43, %cond.end.2.5 ], [ 43, %cond.end.2.6 ], [ 43, %cond.end.2.7 ]
%i.062.lcssa = phi i32 [ 0, %cond.end.2 ], [ 1, %cond.end.2.1 ], [ 2, %cond.end.2.2 ], [ 3, %cond.end.2.3 ], [ 4, %cond.end.2.4 ], [ 5, %cond.end.2.5 ], [ 6, %cond.end.2.6 ], [ 7, %cond.end.2.7 ]
%7 = and i32 %i.062.lcssa, 1
%tobool28.not = icmp eq i32 %7, 0
%cond29 = select i1 %tobool28.not, i32 45, i32 43
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %cond29)
%arrayidx24.1 = getelementptr inbounds [5 x i8], ptr %a, i64 0, i64 1
%8 = load i8, ptr %arrayidx24.1, align 1, !tbaa !5
%conv25.1 = sext i8 %8 to i32
%9 = and i32 %i.062.lcssa, 2
%tobool28.not.1 = icmp eq i32 %9, 0
%cond29.1 = select i1 %tobool28.not.1, i32 45, i32 43
%call30.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv25.1, i32 noundef %cond29.1)
%arrayidx24.2 = getelementptr inbounds [5 x i8], ptr %a, i64 0, i64 2
%10 = load i8, ptr %arrayidx24.2, align 1, !tbaa !5
%conv25.2 = sext i8 %10 to i32
%call30.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv25.2, i32 noundef %tobool28.not.2)
%11 = load i8, ptr %arrayidx34, align 1, !tbaa !5
%conv35 = sext i8 %11 to i32
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv35)
br label %cleanup39
cond.end.2.1: ; preds = %cond.end.2
%conv7.169 = sext i8 %1 to i32
%sub8.170 = add nsw i32 %conv7.169, -48
%add14.177 = add nsw i32 %sub8.170, %sub
%conv12.1.1 = sext i8 %2 to i32
%conv12.2.1 = sext i8 %4 to i32
%12 = add nsw i32 %conv12.1.1, %conv12.2.1
%13 = sub nsw i32 %add14.177, %12
%cmp15.not.1 = icmp eq i32 %13, -89
br i1 %cmp15.not.1, label %for.body22.preheader, label %cond.end.2.2
cond.end.2.2: ; preds = %cond.end.2.1
%conv12.285 = sext i8 %1 to i32
%conv7.1.2 = sext i8 %2 to i32
%sub8.1.2 = add nsw i32 %conv7.1.2, -48
%conv12.2.2 = sext i8 %4 to i32
%14 = add nsw i32 %sub8.1.2, %conv
%15 = add nsw i32 %conv12.285, %conv12.2.2
%reass.sub = sub nsw i32 %14, %15
%cmp15.not.2 = icmp eq i32 %reass.sub, -41
br i1 %cmp15.not.2, label %for.body22.preheader, label %cond.end.2.3
cond.end.2.3: ; preds = %cond.end.2.2
%conv7.3 = sext i8 %1 to i32
%conv7.1.3 = sext i8 %2 to i32
%op.rdx101 = add nsw i32 %conv7.3, -96
%op.rdx102 = add nsw i32 %sub, %conv7.1.3
%op.rdx103 = add nsw i32 %op.rdx101, %op.rdx102
%conv12.2.3 = sext i8 %4 to i32
%reass.sub92 = sub nsw i32 %op.rdx103, %conv12.2.3
%cmp15.not.3 = icmp eq i32 %reass.sub92, -41
br i1 %cmp15.not.3, label %for.body22.preheader, label %cond.end.2.4
cond.end.2.4: ; preds = %cond.end.2.3
%conv12.4 = sext i8 %1 to i32
%conv12.1.4 = sext i8 %2 to i32
%16 = add nsw i32 %conv12.4, %conv12.1.4
%reass.sub93 = sub nsw i32 %conv, %16
%conv7.2.4 = sext i8 %4 to i32
%add14.2.4 = add nsw i32 %reass.sub93, %conv7.2.4
%cmp15.not.4 = icmp eq i32 %add14.2.4, 7
br i1 %cmp15.not.4, label %for.body22.preheader, label %cond.end.2.5
cond.end.2.5: ; preds = %cond.end.2.4
%conv7.5 = sext i8 %1 to i32
%sub8.5 = add nsw i32 %conv7.5, -48
%add14.5 = add nsw i32 %sub8.5, %sub
%conv12.1.5 = sext i8 %2 to i32
%reass.sub94 = sub nsw i32 %add14.5, %conv12.1.5
%conv7.2.5 = sext i8 %4 to i32
%add14.2.5 = add nsw i32 %reass.sub94, %conv7.2.5
%cmp15.not.5 = icmp eq i32 %add14.2.5, 7
br i1 %cmp15.not.5, label %for.body22.preheader, label %cond.end.2.6
cond.end.2.6: ; preds = %cond.end.2.5
%conv12.6 = sext i8 %1 to i32
%17 = sub nsw i32 %conv, %conv12.6
%conv7.1.6 = sext i8 %2 to i32
%conv7.2.6 = sext i8 %4 to i32
%op.rdx98 = add nsw i32 %conv7.1.6, -96
%op.rdx99 = add nsw i32 %17, %conv7.2.6
%op.rdx100 = add nsw i32 %op.rdx98, %op.rdx99
%cmp15.not.6 = icmp eq i32 %op.rdx100, 7
br i1 %cmp15.not.6, label %for.body22.preheader, label %cond.end.2.7
cond.end.2.7: ; preds = %cond.end.2.6
%conv7.7 = sext i8 %1 to i32
%conv7.1.7 = sext i8 %2 to i32
%conv7.2.7 = sext i8 %4 to i32
%op.rdx = add nsw i32 %conv7.7, -144
%op.rdx95 = add nsw i32 %conv7.1.7, %conv7.2.7
%op.rdx96 = add nsw i32 %op.rdx, %op.rdx95
%op.rdx97 = add nsw i32 %op.rdx96, %sub
%cmp15.not.7 = icmp eq i32 %op.rdx97, 7
br i1 %cmp15.not.7, label %for.body22.preheader, label %cleanup39
cleanup39: ; preds = %cond.end.2.7, %for.body22.preheader
call void @llvm.lifetime.end.p0(i64 5, 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#define MAX 4
int main(void) {
int i, j, k, a[4], tmp;
char s[4], m[3];
scanf("%s", s);
for(i=0; i<4; i++) {
a[i] = s[i] - '0';
}
for(i=0; i<1<<3; i++) {
tmp=a[0];
for(k=0; k<3; k++)
m[k]='\0';
k=0;
for(j=0; j<3; j++) {
if(1&i>>j) {
tmp += a[j+1];
m[k] = '+';
k++;
}else {
tmp -= a[j+1];
m[k] = '-';
k++;
}
}
if(tmp==7) {
printf("%d%c%d%c%d%c%d=7\n", a[0], m[0], a[1], m[1], a[2], m[2], a[3]);
return 0;
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257216/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257216/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [18 x i8] c"%d%c%d%c%d%c%d=7\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
for.inc34.2:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%sub = add nsw i32 %conv, -48
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%conv.1 = sext i8 %1 to i32
%sub.1 = add nsw i32 %conv.1, -48
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%conv.2 = sext i8 %2 to i32
%sub.2 = add nsw i32 %conv.2, -48
%arrayidx.3 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
%conv.3 = sext i8 %3 to i32
%sub.3 = add nsw i32 %conv.3, -48
%4 = add nsw i32 %sub.1, %sub.2
%5 = add nsw i32 %4, %sub.3
%sub30.2 = sub nsw i32 %sub, %5
%cmp37 = icmp eq i32 %sub30.2, 7
br i1 %cmp37, label %if.then39, label %for.inc34.2.1
for.inc34.2.1: ; preds = %for.inc34.2
%add23.194 = add nsw i32 %sub.1, %sub
%6 = add nsw i32 %sub.2, %sub.3
%sub30.2.1 = sub nsw i32 %add23.194, %6
%cmp37.1 = icmp eq i32 %sub30.2.1, 7
br i1 %cmp37.1, label %if.then39, label %for.inc34.2.2
for.inc34.2.2: ; preds = %for.inc34.2.1
%7 = add nsw i32 %sub, %sub.2
%8 = add nsw i32 %sub.1, %sub.3
%sub30.2.2 = sub nsw i32 %7, %8
%cmp37.2 = icmp eq i32 %sub30.2.2, 7
br i1 %cmp37.2, label %if.then39, label %for.inc34.2.3
for.inc34.2.3: ; preds = %for.inc34.2.2
%add23.3 = add nsw i32 %sub.1, %sub
%add23.1.3 = add nsw i32 %sub.2, %add23.3
%sub30.2.3 = sub nsw i32 %add23.1.3, %sub.3
%cmp37.3 = icmp eq i32 %sub30.2.3, 7
br i1 %cmp37.3, label %if.then39, label %for.inc34.2.4
for.inc34.2.4: ; preds = %for.inc34.2.3
%9 = add nsw i32 %sub.1, %sub.2
%sub30.1.4 = sub nsw i32 %sub, %9
%add23.2.4 = add nsw i32 %sub.3, %sub30.1.4
%cmp37.4 = icmp eq i32 %add23.2.4, 7
br i1 %cmp37.4, label %if.then39, label %for.inc34.2.5
for.inc34.2.5: ; preds = %for.inc34.2.4
%add23.5 = add nsw i32 %sub.1, %sub
%sub30.1.5 = sub nsw i32 %add23.5, %sub.2
%add23.2.5 = add nsw i32 %sub.3, %sub30.1.5
%cmp37.5 = icmp eq i32 %add23.2.5, 7
br i1 %cmp37.5, label %if.then39, label %for.inc34.2.6
for.inc34.2.6: ; preds = %for.inc34.2.5
%sub30.6 = sub nsw i32 %sub, %sub.1
%add23.1.6 = add nsw i32 %sub.2, %sub30.6
%add23.2.6 = add nsw i32 %sub.3, %add23.1.6
%cmp37.6 = icmp eq i32 %add23.2.6, 7
br i1 %cmp37.6, label %if.then39, label %for.inc34.2.7
for.inc34.2.7: ; preds = %for.inc34.2.6
%add23.7 = add nsw i32 %sub.1, %sub
%add23.1.7 = add nsw i32 %sub.2, %add23.7
%add23.2.7 = add nsw i32 %sub.3, %add23.1.7
%cmp37.7 = icmp eq i32 %add23.2.7, 7
br i1 %cmp37.7, label %if.then39, label %cleanup
if.then39: ; preds = %for.inc34.2.7, %for.inc34.2.6, %for.inc34.2.5, %for.inc34.2.4, %for.inc34.2.3, %for.inc34.2.2, %for.inc34.2.1, %for.inc34.2
%m.sroa.0.8 = phi i32 [ 45, %for.inc34.2 ], [ 43, %for.inc34.2.1 ], [ 45, %for.inc34.2.2 ], [ 43, %for.inc34.2.3 ], [ 45, %for.inc34.2.4 ], [ 43, %for.inc34.2.5 ], [ 45, %for.inc34.2.6 ], [ 43, %for.inc34.2.7 ]
%m.sroa.27.8 = phi i32 [ 45, %for.inc34.2 ], [ 45, %for.inc34.2.1 ], [ 43, %for.inc34.2.2 ], [ 43, %for.inc34.2.3 ], [ 45, %for.inc34.2.4 ], [ 45, %for.inc34.2.5 ], [ 43, %for.inc34.2.6 ], [ 43, %for.inc34.2.7 ]
%m.sroa.44.8 = phi i32 [ 45, %for.inc34.2 ], [ 45, %for.inc34.2.1 ], [ 45, %for.inc34.2.2 ], [ 45, %for.inc34.2.3 ], [ 43, %for.inc34.2.4 ], [ 43, %for.inc34.2.5 ], [ 43, %for.inc34.2.6 ], [ 43, %for.inc34.2.7 ]
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub, i32 noundef %m.sroa.0.8, i32 noundef %sub.1, i32 noundef %m.sroa.27.8, i32 noundef %sub.2, i32 noundef %m.sroa.44.8, i32 noundef %sub.3)
br label %cleanup
cleanup: ; preds = %for.inc34.2.7, %if.then39
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int a;
scanf("%d",&a);
if(a%2==1)
printf("Ehab");
else
printf("Mahmoud");
// your code goes here
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25731/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25731/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"Ehab\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"Mahmoud\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = and i32 %0, -2147483647
%cmp = icmp eq i32 %1, 1
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int n;
scanf("%d",&n);
long long ans = 0;
long long a[n];
for(int i = 0;i < n;i ++){
scanf("%lld",&a[i]);
ans += (a[i]-1);
}
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257353/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257353/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [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
%cmp9 = icmp sgt i32 %3, 0
br i1 %cmp9, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]
%call4 = 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.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%ans.010 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%4 = load i64, ptr %arrayidx, align 8, !tbaa !9
%sub = add i64 %ans.010, -1
%add = add i64 %sub, %4
%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.cond.cleanup, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
//set many funcs template
//Ver.20181228
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
void shuffledget(int x[],int n){
srand(time(0));
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
void prarr(int arr[],int n){
int i;
for(i=0;i<n;i++){
if(i){printf(" ");}
printf("%d",arr[i]);
}
printf("\n");
return;
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
int main(void){
int i,j,n,m,k,a[524288],b,c,h,w,r=0,l,t;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
r+=(a[i]-1);
}
printf("%d\n",r);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257397/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257397/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@.str.3 = 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 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !16
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !17
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !17
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !19
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !22
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !23
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !24
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #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 #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp sgt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext 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 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #7 {
entry:
%b = alloca [524288 x i32], align 16
%call = tail call i64 @time(ptr noundef null) #15
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #15
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #15
%cmp44 = icmp sgt i32 %n, 0
br i1 %cmp44, label %for.body.preheader, label %for.end29
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !25
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !25
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !34
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block
br i1 %cmp44, label %for.body5.preheader, label %for.end29
for.body5.preheader: ; preds = %for.cond2.preheader
%3 = zext i32 %n to i64
br label %for.body5
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !25
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !35
for.cond18.preheader: ; preds = %for.body5
br i1 %cmp44, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.cond18.preheader
%wide.trip.count58 = zext i32 %n to i64
br label %for.body21
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv51 = phi i64 [ %3, %for.body5.preheader ], [ %indvars.iv.next52, %for.body5 ]
%call6 = tail call i32 @rand() #15
%5 = trunc i64 %indvars.iv51 to i32
%rem = srem i32 %call6, %5
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom7 = and i64 %indvars.iv.next52, 4294967295
%arrayidx8 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !25
%idxprom9 = sext i32 %rem to i64
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom9
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !25
store i32 %7, ptr %arrayidx8, align 4, !tbaa !25
store i32 %6, ptr %arrayidx10, align 4, !tbaa !25
%cmp3 = icmp ugt i64 %indvars.iv51, 1
br i1 %cmp3, label %for.body5, label %for.cond18.preheader, !llvm.loop !36
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv54 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next55, %for.body21 ]
%arrayidx23 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !25
%idxprom24 = sext i32 %8 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %x, i64 %idxprom24
%call26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx25)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count58
br i1 %exitcond59.not, label %for.end29, label %for.body21, !llvm.loop !37
for.end29: ; preds = %for.body21, %entry, %for.cond2.preheader, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #15
ret void
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #10 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !25
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !38
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #11 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %arr, align 4, !tbaa !25
%call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar6 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !25
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !39
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !41
%1 = load i32, ptr %b, align 4, !tbaa !41
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 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 #11 {
entry:
%n = alloca i32, align 4
%a = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #15
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %a) #15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !25
%cmp9 = icmp sgt i32 %0, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%r.010 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !25
%sub = add i32 %r.010, -1
%add = add i32 %sub, %1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !25
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !43
for.end: ; preds = %for.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %r.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %a) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #15
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #13
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree 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 #11 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 nounwind }
attributes #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C/C++ TBAA"}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !27, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !27, i64 0}
!33 = !{!27, !27, i64 0}
!34 = distinct !{!34, !6, !9, !10}
!35 = distinct !{!35, !6, !10, !9}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = distinct !{!38, !6}
!39 = distinct !{!39, !6, !40}
!40 = !{!"llvm.loop.peeled.count", i32 1}
!41 = !{!42, !26, i64 0}
!42 = !{!"", !26, i64 0, !26, i64 4}
!43 = distinct !{!43, !6}
|
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
if(n%2==0){
printf("Mahmoud");
}
else{
printf("Ehab");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25744/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25744/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [8 x i8] c"Mahmoud\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Ehab\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%cmp = icmp eq i32 %1, 0
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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,a;
while (scanf ("%d",&n)==1&&n)
{
int sum=0;
while (n--)
{
scanf ("%d",&a);
sum+=a-1;
}
printf ("%d\n",sum);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257483/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257483/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp11 = icmp eq i32 %call10, 1
%0 = load i32, ptr %n, align 4
%tobool12 = icmp ne i32 %0, 0
%1 = select i1 %cmp11, i1 %tobool12, i1 false
br i1 %1, label %while.cond1.preheader, label %while.end6
while.cond1.preheader: ; preds = %entry, %while.end
%2 = phi i32 [ %4, %while.end ], [ %0, %entry ]
%dec8 = add nsw i32 %2, -1
store i32 %dec8, ptr %n, align 4, !tbaa !5
br label %while.body3
while.body3: ; preds = %while.cond1.preheader, %while.body3
%sum.09 = phi i32 [ 0, %while.cond1.preheader ], [ %add, %while.body3 ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !5
%sub = add i32 %sum.09, -1
%add = add i32 %sub, %3
%.pr = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %.pr, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool2.not = icmp eq i32 %.pr, 0
br i1 %tobool2.not, label %while.end, label %while.body3, !llvm.loop !9
while.end: ; preds = %while.body3
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp = icmp eq i32 %call, 1
%4 = load i32, ptr %n, align 4
%tobool = icmp ne i32 %4, 0
%5 = select i1 %cmp, i1 %tobool, i1 false
br i1 %5, label %while.cond1.preheader, label %while.end6, !llvm.loop !11
while.end6: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (void){
int N;
long long int a,ans=0;
scanf("%d",&N);
for (int i = 0; i < N; i++) {
scanf("%d",&a);
ans=ans+a-1;
}
printf("%lld",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257526/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257526/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 8, 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
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %sub, %for.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%i.07 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%ans.06 = phi i64 [ %sub, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i64, ptr %a, align 8, !tbaa !9
%add = add i64 %ans.06, -1
%sub = add i64 %add, %1
%inc = add nuw nsw i32 %i.07, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
/*
cat <<EOF >mistaken-paste
*/
#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
#define M_MAX 200000
#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;
#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;
}
// double distance (sll x1, sll y1, sll x2, sll y2) {
// double xdist2, ydist2, origindist, dist;
// xdist2 = (x1 - x2) * (x1 - x2);
// ydist2 = (y1 - y2) * (y1 - y2);
// return sqrt(xdist2 + ydist2);
// }
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;
}
int32_t psllcomp (const void *left, const void *right) {
sll l = *(sll*)left;
sll r = *(sll*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t pcharcomp (const void *left, const void *right) {
char l = *(char*)left;
char r = *(char*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t pdoublecomp (const void *left, const void *right) {
double l = *(double*)left;
double r = *(double*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t pstrcomp (const void *left, const void *right) {
char* l = *(char**)left;
char* r = *(char**)right;
return strcmp(l, r);
}
int32_t phwllABcomp (const void *left, const void *right) {
hwll l = *(hwll*)left;
hwll r = *(hwll*)right;
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
return 0;
}
int32_t phwllREVcomp (const void *left, const void *right) {
hwll l = *(hwll*)left;
hwll r = *(hwll*)right;
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
return 0;
}
int32_t ptriplecomp (const void *left, const void *right) {
hwllc l = *(hwllc*)left;
hwllc r = *(hwllc*)right;
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
if (l.c < r.c) {
return -1;
}
if (l.c > r.c) {
return +1;
}
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];
// sll a[3001][3001];
sll b[N_MAX];
// sll b[3001][3001];
sll c[N_MAX];
// sll d[N_MAX];
// sll e[N_MAX];
char s[N_MAX + 1];
// char s[3010][3010];
char t[N_MAX + 1];
// char t[3010][3010];
// hwll xy[N_MAX];
// sll table[1000][1000];
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;
if (k & 1) {
dresult = (100.0 / n) * ((k + 1) / 2);
} else {
dresult = 50.0 * k / n;
}
// 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(":(");
return 1;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
// scanf("%llu%llu", &n, &m);
scanf("%llu%llu", &k, &n, &m);
// scanf("%llu%llu", &h, &w);
// scanf("%lld", &va, &vb, &vc, &vd);
// scanf("%llu%llu", &ua, &ub, &uc, &ud);
// scanf("%llu", &q);
// scanf("%s", s);
// scanf("%s", t);
// for (i = 0; i < n; i++) {
// // scanf("%lld%lld", &xy[i].a, &xy[i].b);
// scanf("%lld", &a[i]);
// // scanf("%lld", &b[i]);
// // scanf("%lld", &c[i]);
// // scanf("%lld", &d[i]);
// // a[i]--;
// // b[i]--;
// // c[i]--;
// }
// scanf("%llu", &m, &k);
// scanf("%llu", &q);
// for (i = 0; i < n; i++) {
// scanf("%lld", &b[i]);
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < n; j++) {
// scanf("%llu", &table[i][j]);
// }
// }
// for (i = 0; i < h; i++) {
// scanf("%s", &s[i]);
// }
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257577/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257577/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@k = dso_local global i64 0, align 8
@n = dso_local global i64 0, align 8
@.str = private unnamed_addr constant [8 x i8] c"%.15lf\0A\00", align 1
@.str.3 = private unnamed_addr constant [9 x i8] c"%llu%llu\00", align 1
@m = dso_local global i64 0, align 8
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = 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 [1000000 x i64] zeroinitializer, align 16
@b = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [1000001 x i8] 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 @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) #9
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(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 nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #6 {
entry:
%0 = load i64, ptr @k, align 8, !tbaa !8
%and = and i64 %0, 1
%tobool.not = icmp eq i64 %and, 0
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %entry
%1 = load i64, ptr @n, align 8, !tbaa !8
%conv = uitofp i64 %1 to double
%div = fdiv double 1.000000e+02, %conv
%add = add i64 %0, 1
%div118 = lshr i64 %add, 1
%conv2 = uitofp i64 %div118 to double
%mul = fmul double %div, %conv2
br label %if.end
if.else: ; preds = %entry
%conv3 = uitofp i64 %0 to double
%mul4 = fmul double %conv3, 5.000000e+01
%2 = load i64, ptr @n, align 8, !tbaa !8
%conv5 = uitofp i64 %2 to double
%div6 = fdiv double %mul4, %conv5
br label %if.end
if.end: ; preds = %if.else, %if.then
%dresult.0 = phi double [ %mul, %if.then ], [ %div6, %if.else ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %dresult.0)
ret i64 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @k, ptr noundef nonnull @n, ptr noundef nonnull @m)
%0 = load i64, ptr @k, align 8, !tbaa !8
%and.i = and i64 %0, 1
%tobool.not.i = icmp eq i64 %and.i, 0
br i1 %tobool.not.i, label %if.else.i, label %if.then.i
if.then.i: ; preds = %entry
%1 = load i64, ptr @n, align 8, !tbaa !8
%conv.i = uitofp i64 %1 to double
%div.i = fdiv double 1.000000e+02, %conv.i
%add.i = add i64 %0, 1
%div118.i = lshr i64 %add.i, 1
%conv2.i = uitofp i64 %div118.i to double
%mul.i = fmul double %div.i, %conv2.i
br label %solve.exit
if.else.i: ; preds = %entry
%conv3.i = uitofp i64 %0 to double
%mul4.i = fmul double %conv3.i, 5.000000e+01
%2 = load i64, ptr @n, align 8, !tbaa !8
%conv5.i = uitofp i64 %2 to double
%div6.i = fdiv double %mul4.i, %conv5.i
br label %solve.exit
solve.exit: ; preds = %if.then.i, %if.else.i
%dresult.0.i = phi double [ %mul.i, %if.then.i ], [ %div6.i, %if.else.i ]
%call.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %dresult.0.i)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.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 i64 @llvm.smax.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #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 = { 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = 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}
|
#include<stdio.h>
int main(){
long int n;
scanf("%ld",&n);
if(n%2==0)
printf("Mahmoud");
else
printf("Ehab");
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25762/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25762/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"Mahmoud\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Ehab\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = and i64 %0, 1
%cmp = icmp eq i64 %1, 0
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct List {
struct List *next;
int v;
} list;
int main()
{
int i, u, w, N, M;
scanf("%d %d", &N, &M);
list **adj = (list**)malloc(sizeof(list*) * (N + 1)), *d = (list*)malloc(sizeof(list) * M * 2);
for (i = 1; i <= N; i++) adj[i] = NULL;
for (i = 0; i < M; i++) {
scanf("%d %d", &u, &w);
d[i*2].v = w;
d[i*2+1].v = u;
d[i*2].next = adj[u];
d[i*2+1].next = adj[w];
adj[u] = &(d[i*2]);
adj[w] = &(d[i*2+1]);
}
int ans = 0, l;
list *p;
for (i = 2, l = 1; i <= N; i++) {
for (p = adj[i]; p != NULL; p = p->next) {
if (p->v >= l && p->v < i) {
ans++;
l = i;
break;
}
}
}
printf("%d\n", ans);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257663/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257663/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.List = type { ptr, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%u = alloca i32, align 4
%w = alloca i32, align 4
%N = alloca i32, align 4
%M = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%1 = load i32, ptr %M, align 4, !tbaa !5
%conv2 = sext i32 %1 to i64
%mul4 = shl nsw i64 %conv2, 5
%call5 = call noalias ptr @malloc(i64 noundef %mul4) #6
%cmp.not100 = icmp slt i32 %0, 1
br i1 %cmp.not100, label %for.cond7.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%scevgep = getelementptr i8, ptr %call1, i64 8
%2 = zext i32 %0 to i64
%3 = shl nuw nsw i64 %2, 3
call void @llvm.memset.p0.i64(ptr align 8 %scevgep, i8 0, i64 %3, i1 false), !tbaa !9
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp8102 = icmp sgt i32 %1, 0
br i1 %cmp8102, label %for.body10, label %for.cond46.preheader
for.cond46.preheader.loopexit: ; preds = %for.body10
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.cond46.preheader
for.cond46.preheader: ; preds = %for.cond46.preheader.loopexit, %for.cond7.preheader
%4 = phi i32 [ %.pre, %for.cond46.preheader.loopexit ], [ %0, %for.cond7.preheader ]
%cmp47.not104 = icmp slt i32 %4, 2
br i1 %cmp47.not104, label %for.end68, label %for.body49.preheader
for.body49.preheader: ; preds = %for.cond46.preheader
%5 = add i32 %4, 1
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 1
%6 = icmp eq i32 %5, 3
br i1 %6, label %for.end68.loopexit.unr-lcssa, label %for.body49.preheader.new
for.body49.preheader.new: ; preds = %for.body49.preheader
%7 = and i64 %wide.trip.count, 4294967294
%8 = add nsw i64 %7, -4
br label %for.body49
for.body10: ; preds = %for.cond7.preheader, %for.body10
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body10 ], [ 0, %for.cond7.preheader ]
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u, ptr noundef nonnull %w)
%9 = load i32, ptr %w, align 4, !tbaa !5
%10 = shl nuw nsw i64 %indvars.iv, 1
%arrayidx14 = getelementptr inbounds %struct.List, ptr %call5, i64 %10
%v = getelementptr inbounds %struct.List, ptr %call5, i64 %10, i32 1
store i32 %9, ptr %v, align 8, !tbaa !11
%11 = load i32, ptr %u, align 4, !tbaa !5
%12 = or i64 %10, 1
%arrayidx18 = getelementptr inbounds %struct.List, ptr %call5, i64 %12
%v19 = getelementptr inbounds %struct.List, ptr %call5, i64 %12, i32 1
store i32 %11, ptr %v19, align 8, !tbaa !11
%idxprom20 = sext i32 %11 to i64
%arrayidx21 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom20
%13 = load ptr, ptr %arrayidx21, align 8, !tbaa !9
store ptr %13, ptr %arrayidx14, align 8, !tbaa !13
%idxprom25 = sext i32 %9 to i64
%arrayidx26 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom25
%14 = load ptr, ptr %arrayidx26, align 8, !tbaa !9
store ptr %14, ptr %arrayidx18, align 8, !tbaa !13
store ptr %arrayidx14, ptr %arrayidx21, align 8, !tbaa !9
store ptr %arrayidx18, ptr %arrayidx26, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i32, ptr %M, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp8 = icmp slt i64 %indvars.iv.next, %16
br i1 %cmp8, label %for.body10, label %for.cond46.preheader.loopexit, !llvm.loop !14
for.body49: ; preds = %for.inc66.1, %for.body49.preheader.new
%indvars.iv112 = phi i64 [ 2, %for.body49.preheader.new ], [ %indvars.iv.next113.1, %for.inc66.1 ]
%l.0107 = phi i32 [ 1, %for.body49.preheader.new ], [ %l.1.1, %for.inc66.1 ]
%ans.0106 = phi i32 [ 0, %for.body49.preheader.new ], [ %ans.1.1, %for.inc66.1 ]
%niter = phi i64 [ 0, %for.body49.preheader.new ], [ %niter.next.1, %for.inc66.1 ]
%arrayidx51 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv112
br label %for.cond52
for.cond52: ; preds = %for.body55, %for.body49
%p.0.in = phi ptr [ %arrayidx51, %for.body49 ], [ %p.0, %for.body55 ]
%p.0 = load ptr, ptr %p.0.in, align 8, !tbaa !9
%cmp53.not = icmp eq ptr %p.0, null
br i1 %cmp53.not, label %for.inc66, label %for.body55
for.body55: ; preds = %for.cond52
%v56 = getelementptr inbounds %struct.List, ptr %p.0, i64 0, i32 1
%17 = load i32, ptr %v56, align 8, !tbaa !11
%cmp57.not = icmp sge i32 %17, %l.0107
%18 = sext i32 %17 to i64
%cmp60 = icmp sgt i64 %indvars.iv112, %18
%or.cond = and i1 %cmp57.not, %cmp60
br i1 %or.cond, label %if.then, label %for.cond52, !llvm.loop !16
if.then: ; preds = %for.body55
%inc62 = add nsw i32 %ans.0106, 1
%19 = trunc i64 %indvars.iv112 to i32
br label %for.inc66
for.inc66: ; preds = %for.cond52, %if.then
%ans.1 = phi i32 [ %inc62, %if.then ], [ %ans.0106, %for.cond52 ]
%l.1 = phi i32 [ %19, %if.then ], [ %l.0107, %for.cond52 ]
%indvars.iv.next113 = or i64 %indvars.iv112, 1
%arrayidx51.1 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv.next113
br label %for.cond52.1
for.cond52.1: ; preds = %for.body55.1, %for.inc66
%p.0.in.1 = phi ptr [ %arrayidx51.1, %for.inc66 ], [ %p.0.1, %for.body55.1 ]
%p.0.1 = load ptr, ptr %p.0.in.1, align 8, !tbaa !9
%cmp53.not.1 = icmp eq ptr %p.0.1, null
br i1 %cmp53.not.1, label %for.inc66.1, label %for.body55.1
for.body55.1: ; preds = %for.cond52.1
%v56.1 = getelementptr inbounds %struct.List, ptr %p.0.1, i64 0, i32 1
%20 = load i32, ptr %v56.1, align 8, !tbaa !11
%cmp57.not.1 = icmp sge i32 %20, %l.1
%21 = sext i32 %20 to i64
%cmp60.1 = icmp sgt i64 %indvars.iv.next113, %21
%or.cond.1 = and i1 %cmp57.not.1, %cmp60.1
br i1 %or.cond.1, label %if.then.1, label %for.cond52.1, !llvm.loop !16
if.then.1: ; preds = %for.body55.1
%inc62.1 = add nsw i32 %ans.1, 1
%22 = trunc i64 %indvars.iv.next113 to i32
br label %for.inc66.1
for.inc66.1: ; preds = %for.cond52.1, %if.then.1
%ans.1.1 = phi i32 [ %inc62.1, %if.then.1 ], [ %ans.1, %for.cond52.1 ]
%l.1.1 = phi i32 [ %22, %if.then.1 ], [ %l.1, %for.cond52.1 ]
%indvars.iv.next113.1 = add nuw nsw i64 %indvars.iv112, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter, %8
br i1 %niter.ncmp.1, label %for.end68.loopexit.unr-lcssa, label %for.body49, !llvm.loop !17
for.end68.loopexit.unr-lcssa: ; preds = %for.inc66.1, %for.body49.preheader
%ans.1.lcssa.ph = phi i32 [ undef, %for.body49.preheader ], [ %ans.1.1, %for.inc66.1 ]
%indvars.iv112.unr = phi i64 [ 2, %for.body49.preheader ], [ %indvars.iv.next113.1, %for.inc66.1 ]
%l.0107.unr = phi i32 [ 1, %for.body49.preheader ], [ %l.1.1, %for.inc66.1 ]
%ans.0106.unr = phi i32 [ 0, %for.body49.preheader ], [ %ans.1.1, %for.inc66.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end68, label %for.body49.epil
for.body49.epil: ; preds = %for.end68.loopexit.unr-lcssa
%arrayidx51.epil = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv112.unr
br label %for.cond52.epil
for.cond52.epil: ; preds = %for.body55.epil, %for.body49.epil
%p.0.in.epil = phi ptr [ %arrayidx51.epil, %for.body49.epil ], [ %p.0.epil, %for.body55.epil ]
%p.0.epil = load ptr, ptr %p.0.in.epil, align 8, !tbaa !9
%cmp53.not.epil = icmp eq ptr %p.0.epil, null
br i1 %cmp53.not.epil, label %for.end68, label %for.body55.epil
for.body55.epil: ; preds = %for.cond52.epil
%v56.epil = getelementptr inbounds %struct.List, ptr %p.0.epil, i64 0, i32 1
%23 = load i32, ptr %v56.epil, align 8, !tbaa !11
%cmp57.not.epil = icmp sge i32 %23, %l.0107.unr
%24 = sext i32 %23 to i64
%cmp60.epil = icmp sgt i64 %indvars.iv112.unr, %24
%or.cond.epil = and i1 %cmp57.not.epil, %cmp60.epil
br i1 %or.cond.epil, label %if.then.epil, label %for.cond52.epil, !llvm.loop !16
if.then.epil: ; preds = %for.body55.epil
%inc62.epil = add nsw i32 %ans.0106.unr, 1
br label %for.end68
for.end68: ; preds = %for.end68.loopexit.unr-lcssa, %for.cond52.epil, %if.then.epil, %for.cond46.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond46.preheader ], [ %ans.1.lcssa.ph, %for.end68.loopexit.unr-lcssa ], [ %inc62.epil, %if.then.epil ], [ %ans.0106.unr, %for.cond52.epil ]
%call69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
%25 = load ptr, ptr @stdout, align 8, !tbaa !9
%call70 = call i32 @fflush(ptr noundef %25)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"List", !10, i64 0, !6, i64 8}
!13 = !{!12, !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
|
#include <unistd.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
char ibuf[1400100];
char *ibufe = ibuf-1;
inline void readall(){
int k, t = 0;
while((k=read(STDIN_FILENO, ibuf+t, sizeof(ibuf)-t))>0) t += k;
}
int read_uint(){
int x=0;
while(*(++ibufe) <'0');
do {
x *= 10;
x += *ibufe-'0';
} while(*(++ibufe) >='0');
return x;
}
char buf[6];
char *bufe = buf;
void write_uintln(int x){
int i;
static char tmp[6];
if(x==0){
*bufe++ = '0';
*bufe++ = '\n';
return;
}
for(i=0; x; i++){
tmp[i] = '0' + x % 10;
x /= 10;
}
for(i--; i >= 0; i--){
*bufe++ = tmp[i];
}
*bufe++ = '\n';
}
inline void writeall(){
int k, t = 0;
while((k=write(STDOUT_FILENO, buf+t, bufe-buf-t))>0) t += k;
}
int n, m;
int A[100000];
int main(){
int i;
readall();
n = read_uint();
m = read_uint();
for(i=0;i<m;i++){
int a, b;
a = read_uint();
b = read_uint();
A[a-1] = MAX(A[a-1], n-b+1);
}
int min = 0;
int count = 0;
for(i=0;i<n-1;i++){
min = MAX(min, A[i]);
if(i == n-min-1){
min = 0;
count++;
}
}
write_uintln(count);
writeall();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257706/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257706/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@ibuf = dso_local global [1400100 x i8] zeroinitializer, align 16
@ibufe = dso_local local_unnamed_addr global ptr getelementptr ([1400100 x i8], ptr @ibuf, i64 -1, i64 1400099), align 8
@buf = dso_local global [6 x i8] zeroinitializer, align 1
@bufe = dso_local local_unnamed_addr global ptr @buf, align 8
@write_uintln.tmp = internal unnamed_addr global [6 x i8] zeroinitializer, align 1
@n = dso_local local_unnamed_addr global i32 0, align 4
@m = dso_local local_unnamed_addr global i32 0, align 4
@A = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @read_uint() local_unnamed_addr #0 {
entry:
%ibufe.promoted = load ptr, ptr @ibufe, align 8, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%incdec.ptr9 = phi ptr [ %incdec.ptr, %while.cond ], [ %ibufe.promoted, %entry ]
%incdec.ptr = getelementptr inbounds i8, ptr %incdec.ptr9, i64 1
store ptr %incdec.ptr, ptr @ibufe, align 8, !tbaa !5
%0 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%cmp = icmp slt i8 %0, 48
br i1 %cmp, label %while.cond, label %do.body, !llvm.loop !10
do.body: ; preds = %while.cond, %do.body
%1 = phi i8 [ %2, %do.body ], [ %0, %while.cond ]
%incdec.ptr311 = phi ptr [ %incdec.ptr3, %do.body ], [ %incdec.ptr, %while.cond ]
%x.0 = phi i32 [ %add, %do.body ], [ 0, %while.cond ]
%mul = mul nsw i32 %x.0, 10
%conv2 = zext i8 %1 to i32
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv2
%incdec.ptr3 = getelementptr inbounds i8, ptr %incdec.ptr311, i64 1
store ptr %incdec.ptr3, ptr @ibufe, align 8, !tbaa !5
%2 = load i8, ptr %incdec.ptr3, align 1, !tbaa !9
%cmp5 = icmp sgt i8 %2, 47
br i1 %cmp5, label %do.body, label %do.end, !llvm.loop !12
do.end: ; preds = %do.body
ret i32 %add
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: write, inaccessiblemem: none) uwtable
define dso_local void @write_uintln(i32 noundef %x) local_unnamed_addr #1 {
entry:
%cmp = icmp eq i32 %x, 0
br i1 %cmp, label %if.then, label %for.body
if.then: ; preds = %entry
%0 = load ptr, ptr @bufe, align 8, !tbaa !5
%incdec.ptr = getelementptr inbounds i8, ptr %0, i64 1
store ptr %incdec.ptr, ptr @bufe, align 8, !tbaa !5
store i8 48, ptr %0, align 1, !tbaa !9
br label %cleanup
for.body: ; preds = %entry, %for.body
%indvars.iv25 = phi i64 [ %indvars.iv.next26, %for.body ], [ 1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%x.addr.021 = phi i32 [ %div, %for.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.021, 10
%1 = trunc i32 %rem to i8
%conv = add nsw i8 %1, 48
%arrayidx = getelementptr inbounds [6 x i8], ptr @write_uintln.tmp, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !9
%div = sdiv i32 %x.addr.021, 10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%x.addr.021.off = add i32 %x.addr.021, 9
%tobool.not = icmp ult i32 %x.addr.021.off, 19
%indvars.iv.next26 = add nuw i64 %indvars.iv25, 1
br i1 %tobool.not, label %for.body5, label %for.body, !llvm.loop !13
for.body5: ; preds = %for.body, %for.body5
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body5 ], [ %indvars.iv25, %for.body ]
%indvars.iv.next28 = add i64 %indvars.iv27, -1
%idxprom6 = and i64 %indvars.iv.next28, 4294967295
%arrayidx7 = getelementptr inbounds [6 x i8], ptr @write_uintln.tmp, i64 0, i64 %idxprom6
%2 = load i8, ptr %arrayidx7, align 1, !tbaa !9
%3 = load ptr, ptr @bufe, align 8, !tbaa !5
%incdec.ptr8 = getelementptr inbounds i8, ptr %3, i64 1
store ptr %incdec.ptr8, ptr @bufe, align 8, !tbaa !5
store i8 %2, ptr %3, align 1, !tbaa !9
%4 = trunc i64 %indvars.iv27 to i32
%cmp3 = icmp sgt i32 %4, 1
br i1 %cmp3, label %for.body5, label %cleanup, !llvm.loop !14
cleanup: ; preds = %for.body5, %if.then
%5 = load ptr, ptr @bufe, align 8, !tbaa !5
%incdec.ptr12 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr12, ptr @bufe, align 8, !tbaa !5
store i8 10, ptr %5, align 1, !tbaa !9
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %entry
%t.0.i = phi i32 [ 0, %entry ], [ %add.i, %while.cond.i ]
%idx.ext.i = sext i32 %t.0.i to i64
%add.ptr.i = getelementptr inbounds i8, ptr @ibuf, i64 %idx.ext.i
%sub.i = sub nsw i64 1400100, %idx.ext.i
%call.i = tail call i64 @read(i32 noundef 0, ptr noundef nonnull %add.ptr.i, i64 noundef %sub.i) #5
%conv1.i = trunc i64 %call.i to i32
%cmp.i = icmp sgt i32 %conv1.i, 0
%add.i = add nsw i32 %t.0.i, %conv1.i
br i1 %cmp.i, label %while.cond.i, label %readall.exit, !llvm.loop !15
readall.exit: ; preds = %while.cond.i
%ibufe.promoted.i = load ptr, ptr @ibufe, align 8, !tbaa !5
br label %while.cond.i47
while.cond.i47: ; preds = %while.cond.i47, %readall.exit
%incdec.ptr9.i = phi ptr [ %incdec.ptr.i, %while.cond.i47 ], [ %ibufe.promoted.i, %readall.exit ]
%incdec.ptr.i = getelementptr inbounds i8, ptr %incdec.ptr9.i, i64 1
store ptr %incdec.ptr.i, ptr @ibufe, align 8, !tbaa !5
%0 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !9
%cmp.i48 = icmp slt i8 %0, 48
br i1 %cmp.i48, label %while.cond.i47, label %do.body.i, !llvm.loop !10
do.body.i: ; preds = %while.cond.i47, %do.body.i
%1 = phi i8 [ %2, %do.body.i ], [ %0, %while.cond.i47 ]
%incdec.ptr311.i = phi ptr [ %incdec.ptr3.i, %do.body.i ], [ %incdec.ptr.i, %while.cond.i47 ]
%x.0.i = phi i32 [ %add.i50, %do.body.i ], [ 0, %while.cond.i47 ]
%mul.i = mul i32 %x.0.i, 10
%conv2.i = zext i8 %1 to i32
%sub.i49 = add nsw i32 %conv2.i, -48
%add.i50 = add i32 %sub.i49, %mul.i
%incdec.ptr3.i = getelementptr inbounds i8, ptr %incdec.ptr311.i, i64 1
store ptr %incdec.ptr3.i, ptr @ibufe, align 8, !tbaa !5
%2 = load i8, ptr %incdec.ptr3.i, align 1, !tbaa !9
%cmp5.i = icmp sgt i8 %2, 47
br i1 %cmp5.i, label %do.body.i, label %read_uint.exit, !llvm.loop !12
read_uint.exit: ; preds = %do.body.i
store i32 %add.i50, ptr @n, align 4, !tbaa !16
br label %while.cond.i52
while.cond.i52: ; preds = %while.cond.i52, %read_uint.exit
%incdec.ptr9.i53 = phi ptr [ %incdec.ptr.i54, %while.cond.i52 ], [ %incdec.ptr3.i, %read_uint.exit ]
%incdec.ptr.i54 = getelementptr inbounds i8, ptr %incdec.ptr9.i53, i64 1
store ptr %incdec.ptr.i54, ptr @ibufe, align 8, !tbaa !5
%3 = load i8, ptr %incdec.ptr.i54, align 1, !tbaa !9
%cmp.i55 = icmp slt i8 %3, 48
br i1 %cmp.i55, label %while.cond.i52, label %do.body.i56, !llvm.loop !10
do.body.i56: ; preds = %while.cond.i52, %do.body.i56
%4 = phi i8 [ %5, %do.body.i56 ], [ %3, %while.cond.i52 ]
%incdec.ptr311.i57 = phi ptr [ %incdec.ptr3.i63, %do.body.i56 ], [ %incdec.ptr.i54, %while.cond.i52 ]
%x.0.i58 = phi i32 [ %add.i62, %do.body.i56 ], [ 0, %while.cond.i52 ]
%mul.i59 = mul nsw i32 %x.0.i58, 10
%conv2.i60 = zext i8 %4 to i32
%sub.i61 = add nsw i32 %conv2.i60, -48
%add.i62 = add i32 %sub.i61, %mul.i59
%incdec.ptr3.i63 = getelementptr inbounds i8, ptr %incdec.ptr311.i57, i64 1
store ptr %incdec.ptr3.i63, ptr @ibufe, align 8, !tbaa !5
%5 = load i8, ptr %incdec.ptr3.i63, align 1, !tbaa !9
%cmp5.i64 = icmp sgt i8 %5, 47
br i1 %cmp5.i64, label %do.body.i56, label %read_uint.exit65, !llvm.loop !12
read_uint.exit65: ; preds = %do.body.i56
store i32 %add.i62, ptr @m, align 4, !tbaa !16
%cmp111 = icmp sgt i32 %add.i62, 0
br i1 %cmp111, label %for.body.lr.ph, label %for.cond14.preheader
for.body.lr.ph: ; preds = %read_uint.exit65
%sub4 = add i32 %add.i50, 1
br label %for.body
for.cond14.preheader: ; preds = %read_uint.exit95, %read_uint.exit65
%cmp16114 = icmp sgt i32 %add.i50, 1
br i1 %cmp16114, label %for.body17.preheader, label %if.then.i
for.body17.preheader: ; preds = %for.cond14.preheader
%sub15 = add nsw i32 %add.i50, -1
%wide.trip.count = zext i32 %sub15 to i64
%xtraiter = and i64 %wide.trip.count, 1
%6 = icmp eq i32 %sub15, 1
br i1 %6, label %for.end33.unr-lcssa, label %for.body17.preheader.new
for.body17.preheader.new: ; preds = %for.body17.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body17
for.body: ; preds = %for.body.lr.ph, %read_uint.exit95
%i.0113 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %read_uint.exit95 ]
%incdec.ptr3.i93110112 = phi ptr [ %incdec.ptr3.i63, %for.body.lr.ph ], [ %incdec.ptr3.i93, %read_uint.exit95 ]
br label %while.cond.i67
while.cond.i67: ; preds = %while.cond.i67, %for.body
%incdec.ptr9.i68 = phi ptr [ %incdec.ptr.i69, %while.cond.i67 ], [ %incdec.ptr3.i93110112, %for.body ]
%incdec.ptr.i69 = getelementptr inbounds i8, ptr %incdec.ptr9.i68, i64 1
store ptr %incdec.ptr.i69, ptr @ibufe, align 8, !tbaa !5
%7 = load i8, ptr %incdec.ptr.i69, align 1, !tbaa !9
%cmp.i70 = icmp slt i8 %7, 48
br i1 %cmp.i70, label %while.cond.i67, label %do.body.i71, !llvm.loop !10
do.body.i71: ; preds = %while.cond.i67, %do.body.i71
%8 = phi i8 [ %9, %do.body.i71 ], [ %7, %while.cond.i67 ]
%incdec.ptr311.i72 = phi ptr [ %incdec.ptr3.i78, %do.body.i71 ], [ %incdec.ptr.i69, %while.cond.i67 ]
%x.0.i73 = phi i32 [ %add.i77, %do.body.i71 ], [ 0, %while.cond.i67 ]
%mul.i74 = mul nsw i32 %x.0.i73, 10
%conv2.i75 = zext i8 %8 to i32
%sub.i76 = add nsw i32 %conv2.i75, -48
%add.i77 = add i32 %sub.i76, %mul.i74
%incdec.ptr3.i78 = getelementptr inbounds i8, ptr %incdec.ptr311.i72, i64 1
store ptr %incdec.ptr3.i78, ptr @ibufe, align 8, !tbaa !5
%9 = load i8, ptr %incdec.ptr3.i78, align 1, !tbaa !9
%cmp5.i79 = icmp sgt i8 %9, 47
br i1 %cmp5.i79, label %do.body.i71, label %while.cond.i82, !llvm.loop !12
while.cond.i82: ; preds = %do.body.i71, %while.cond.i82
%incdec.ptr9.i83 = phi ptr [ %incdec.ptr.i84, %while.cond.i82 ], [ %incdec.ptr3.i78, %do.body.i71 ]
%incdec.ptr.i84 = getelementptr inbounds i8, ptr %incdec.ptr9.i83, i64 1
store ptr %incdec.ptr.i84, ptr @ibufe, align 8, !tbaa !5
%10 = load i8, ptr %incdec.ptr.i84, align 1, !tbaa !9
%cmp.i85 = icmp slt i8 %10, 48
br i1 %cmp.i85, label %while.cond.i82, label %do.body.i86, !llvm.loop !10
do.body.i86: ; preds = %while.cond.i82, %do.body.i86
%11 = phi i8 [ %12, %do.body.i86 ], [ %10, %while.cond.i82 ]
%incdec.ptr311.i87 = phi ptr [ %incdec.ptr3.i93, %do.body.i86 ], [ %incdec.ptr.i84, %while.cond.i82 ]
%x.0.i88 = phi i32 [ %add.i92, %do.body.i86 ], [ 0, %while.cond.i82 ]
%mul.i89 = mul nsw i32 %x.0.i88, 10
%conv2.i90 = zext i8 %11 to i32
%sub.i91 = add nsw i32 %conv2.i90, -48
%add.i92 = add i32 %sub.i91, %mul.i89
%incdec.ptr3.i93 = getelementptr inbounds i8, ptr %incdec.ptr311.i87, i64 1
store ptr %incdec.ptr3.i93, ptr @ibufe, align 8, !tbaa !5
%12 = load i8, ptr %incdec.ptr3.i93, align 1, !tbaa !9
%cmp5.i94 = icmp sgt i8 %12, 47
br i1 %cmp5.i94, label %do.body.i86, label %read_uint.exit95, !llvm.loop !12
read_uint.exit95: ; preds = %do.body.i86
%sub = add nsw i32 %add.i77, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom
%13 = load i32, ptr %arrayidx, align 4, !tbaa !16
%add = sub i32 %sub4, %add.i92
%.add = tail call i32 @llvm.smax.i32(i32 %13, i32 %add)
store i32 %.add, ptr %arrayidx, align 4, !tbaa !16
%inc = add nuw nsw i32 %i.0113, 1
%exitcond.not = icmp eq i32 %inc, %add.i62
br i1 %exitcond.not, label %for.cond14.preheader, label %for.body, !llvm.loop !18
for.body17: ; preds = %for.body17, %for.body17.preheader.new
%indvars.iv = phi i64 [ 0, %for.body17.preheader.new ], [ %indvars.iv.next.1, %for.body17 ]
%count.0117 = phi i32 [ 0, %for.body17.preheader.new ], [ %count.1.1, %for.body17 ]
%min.0116 = phi i32 [ 0, %for.body17.preheader.new ], [ %min.1.1, %for.body17 ]
%niter = phi i64 [ 0, %for.body17.preheader.new ], [ %niter.next.1, %for.body17 ]
%arrayidx19 = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %indvars.iv
%14 = load i32, ptr %arrayidx19, align 8, !tbaa !16
%min.0. = tail call i32 @llvm.smax.i32(i32 %min.0116, i32 %14)
%15 = xor i32 %min.0., -1
%sub28 = add i32 %add.i50, %15
%16 = zext i32 %sub28 to i64
%cmp29 = icmp eq i64 %indvars.iv, %16
%min.1 = select i1 %cmp29, i32 0, i32 %min.0.
%inc30 = zext i1 %cmp29 to i32
%count.1 = add nuw nsw i32 %count.0117, %inc30
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx19.1 = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %indvars.iv.next
%17 = load i32, ptr %arrayidx19.1, align 4, !tbaa !16
%min.0..1 = tail call i32 @llvm.smax.i32(i32 %min.1, i32 %17)
%18 = xor i32 %min.0..1, -1
%sub28.1 = add i32 %add.i50, %18
%19 = zext i32 %sub28.1 to i64
%cmp29.1 = icmp eq i64 %indvars.iv.next, %19
%min.1.1 = select i1 %cmp29.1, i32 0, i32 %min.0..1
%inc30.1 = zext i1 %cmp29.1 to i32
%count.1.1 = add nuw nsw i32 %count.1, %inc30.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.end33.unr-lcssa, label %for.body17, !llvm.loop !19
for.end33.unr-lcssa: ; preds = %for.body17, %for.body17.preheader
%count.1.lcssa.ph = phi i32 [ undef, %for.body17.preheader ], [ %count.1.1, %for.body17 ]
%indvars.iv.unr = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next.1, %for.body17 ]
%count.0117.unr = phi i32 [ 0, %for.body17.preheader ], [ %count.1.1, %for.body17 ]
%min.0116.unr = phi i32 [ 0, %for.body17.preheader ], [ %min.1.1, %for.body17 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end33, label %for.body17.epil
for.body17.epil: ; preds = %for.end33.unr-lcssa
%arrayidx19.epil = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %indvars.iv.unr
%20 = load i32, ptr %arrayidx19.epil, align 4, !tbaa !16
%min.0..epil = tail call i32 @llvm.smax.i32(i32 %min.0116.unr, i32 %20)
%21 = xor i32 %min.0..epil, -1
%sub28.epil = add i32 %add.i50, %21
%22 = zext i32 %sub28.epil to i64
%cmp29.epil = icmp eq i64 %indvars.iv.unr, %22
%inc30.epil = zext i1 %cmp29.epil to i32
%count.1.epil = add nuw nsw i32 %count.0117.unr, %inc30.epil
br label %for.end33
for.end33: ; preds = %for.end33.unr-lcssa, %for.body17.epil
%count.1.lcssa = phi i32 [ %count.1.lcssa.ph, %for.end33.unr-lcssa ], [ %count.1.epil, %for.body17.epil ]
%cmp.i96 = icmp eq i32 %count.1.lcssa, 0
br i1 %cmp.i96, label %if.then.i, label %for.body.i
if.then.i: ; preds = %for.cond14.preheader, %for.end33
%23 = load ptr, ptr @bufe, align 8, !tbaa !5
%incdec.ptr.i97 = getelementptr inbounds i8, ptr %23, i64 1
store ptr %incdec.ptr.i97, ptr @bufe, align 8, !tbaa !5
store i8 48, ptr %23, align 1, !tbaa !9
br label %write_uintln.exit
for.body.i: ; preds = %for.end33, %for.body.i
%indvars.iv25.i = phi i64 [ %indvars.iv.next26.i, %for.body.i ], [ 1, %for.end33 ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 0, %for.end33 ]
%x.addr.021.i = phi i32 [ %div.i, %for.body.i ], [ %count.1.lcssa, %for.end33 ]
%rem.i = srem i32 %x.addr.021.i, 10
%24 = trunc i32 %rem.i to i8
%conv.i = add nsw i8 %24, 48
%arrayidx.i = getelementptr inbounds [6 x i8], ptr @write_uintln.tmp, i64 0, i64 %indvars.iv.i
store i8 %conv.i, ptr %arrayidx.i, align 1, !tbaa !9
%div.i = sdiv i32 %x.addr.021.i, 10
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%x.addr.021.off.i = add i32 %x.addr.021.i, 9
%tobool.not.i = icmp ult i32 %x.addr.021.off.i, 19
%indvars.iv.next26.i = add nuw i64 %indvars.iv25.i, 1
br i1 %tobool.not.i, label %for.body5.i, label %for.body.i, !llvm.loop !13
for.body5.i: ; preds = %for.body.i, %for.body5.i
%indvars.iv27.i = phi i64 [ %indvars.iv.next28.i, %for.body5.i ], [ %indvars.iv25.i, %for.body.i ]
%indvars.iv.next28.i = add i64 %indvars.iv27.i, -1
%idxprom6.i = and i64 %indvars.iv.next28.i, 4294967295
%arrayidx7.i = getelementptr inbounds [6 x i8], ptr @write_uintln.tmp, i64 0, i64 %idxprom6.i
%25 = load i8, ptr %arrayidx7.i, align 1, !tbaa !9
%26 = load ptr, ptr @bufe, align 8, !tbaa !5
%incdec.ptr8.i = getelementptr inbounds i8, ptr %26, i64 1
store ptr %incdec.ptr8.i, ptr @bufe, align 8, !tbaa !5
store i8 %25, ptr %26, align 1, !tbaa !9
%27 = trunc i64 %indvars.iv27.i to i32
%cmp3.i = icmp sgt i32 %27, 1
br i1 %cmp3.i, label %for.body5.i, label %write_uintln.exit, !llvm.loop !14
write_uintln.exit: ; preds = %for.body5.i, %if.then.i
%28 = load ptr, ptr @bufe, align 8, !tbaa !5
%incdec.ptr12.i = getelementptr inbounds i8, ptr %28, i64 1
store ptr %incdec.ptr12.i, ptr @bufe, align 8, !tbaa !5
store i8 10, ptr %28, align 1, !tbaa !9
br label %while.cond.i98
while.cond.i98: ; preds = %while.cond.i98, %write_uintln.exit
%t.0.i99 = phi i32 [ 0, %write_uintln.exit ], [ %add.i106, %while.cond.i98 ]
%idx.ext.i100 = sext i32 %t.0.i99 to i64
%add.ptr.i101 = getelementptr inbounds i8, ptr @buf, i64 %idx.ext.i100
%29 = load ptr, ptr @bufe, align 8, !tbaa !5
%sub.ptr.lhs.cast.i = ptrtoint ptr %29 to i64
%.neg.i = sub i64 sub (i64 0, i64 ptrtoint (ptr @buf to i64)), %idx.ext.i100
%sub.i102 = add i64 %.neg.i, %sub.ptr.lhs.cast.i
%call.i103 = tail call i64 @write(i32 noundef 1, ptr noundef nonnull %add.ptr.i101, i64 noundef %sub.i102) #5
%conv1.i104 = trunc i64 %call.i103 to i32
%cmp.i105 = icmp sgt i32 %conv1.i104, 0
%add.i106 = add nsw i32 %t.0.i99, %conv1.i104
br i1 %cmp.i105, label %while.cond.i98, label %writeall.exit, !llvm.loop !20
writeall.exit: ; preds = %while.cond.i98
ret i32 0
}
; Function Attrs: nofree
declare noundef i64 @read(i32 noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(readwrite, argmem: write, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 "no-trapping-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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n%2 == 0)
printf("Mahmoud\n");
else
printf("Ehab\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25775/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25775/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [5 x i8] c"Ehab\00", align 1
@str.3 = private unnamed_addr constant [8 x i8] c"Mahmoud\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 = and i32 %0, 1
%cmp = icmp eq i32 %1, 0
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int i, taka, aoki, k;
scanf("%d%d%d",&taka,&aoki,&k);
for(i=0;i<k;i++){
if(i%2 == 0){
taka /= 2;
aoki += taka;
}else{
aoki /= 2;
taka += aoki;
}
}
printf("%d %d",taka,aoki);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257793/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257793/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%taka = alloca i32, align 4
%aoki = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %taka) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %aoki) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %taka, ptr noundef nonnull %aoki, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%aoki.promoted = load i32, ptr %aoki, align 4, !tbaa !5
%taka.promoted = load i32, ptr %taka, 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.014 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%div2713 = phi i32 [ %div2.sink, %for.inc ], [ %aoki.promoted, %entry ]
%add3912 = phi i32 [ %add3.sink, %for.inc ], [ %taka.promoted, %entry ]
%rem = and i32 %i.014, 1
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %for.body
%div = sdiv i32 %add3912, 2
%add = add nsw i32 %div2713, %div
br label %for.inc
if.else: ; preds = %for.body
%div2 = sdiv i32 %div2713, 2
%add3 = add nsw i32 %add3912, %div2
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%add3.sink = phi i32 [ %div, %if.then ], [ %add3, %if.else ]
%div2.sink = phi i32 [ %add, %if.then ], [ %div2, %if.else ]
%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.inc
store i32 %add3.sink, ptr %taka, align 4
store i32 %div2.sink, ptr %aoki, align 4
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%1 = phi i32 [ %aoki.promoted, %entry ], [ %div2.sink, %for.end.loopexit ]
%2 = phi i32 [ %taka.promoted, %entry ], [ %add3.sink, %for.end.loopexit ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2, i32 noundef %1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %aoki) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %taka) #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 k,s,cnt=0;
scanf("%d%d", &k ,&s);
for(int x=0; x<=k; x++){
for(int y=0; y<=k; y++){
int z = s - x- y;
if( z >= 0 && z <= k ){ cnt++; }
}
}
printf("%d",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257836/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257836/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%k = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not22 = icmp slt i32 %0, 0
br i1 %cmp.not22, label %for.cond.cleanup, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %s, align 4
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
%n.vec = and i32 %2, -8
%broadcast.splatinsert29 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat30 = shufflevector <4 x i32> %broadcast.splatinsert29, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert31 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat32 = shufflevector <4 x i32> %broadcast.splatinsert31, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %2, %n.vec
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.cond.cleanup3_crit_edge
%x.024 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc10, %for.cond1.for.cond.cleanup3_crit_edge ]
%cnt.023 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %cnt.2.lcssa, %for.cond1.for.cond.cleanup3_crit_edge ]
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %cnt.023, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %x.024, 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.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %3, %vector.ph ], [ %16, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%4 = add nuw <4 x i32> %vec.ind, %broadcast.splat
%5 = add nuw <4 x i32> %step.add, %broadcast.splat
%6 = sub <4 x i32> %broadcast.splat30, %4
%7 = sub <4 x i32> %broadcast.splat30, %5
%8 = icmp sgt <4 x i32> %6, <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = icmp sgt <4 x i32> %7, <i32 -1, i32 -1, i32 -1, i32 -1>
%10 = icmp sle <4 x i32> %6, %broadcast.splat32
%11 = icmp sle <4 x i32> %7, %broadcast.splat32
%12 = and <4 x i1> %8, %10
%13 = and <4 x i1> %9, %11
%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> %vec.phi, %14
%17 = add <4 x i32> %vec.phi28, %15
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%18 = icmp eq i32 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader, %middle.block
%y.021.ph = phi i32 [ 0, %for.cond1.preheader ], [ %n.vec, %middle.block ]
%cnt.120.ph = phi i32 [ %cnt.023, %for.cond1.preheader ], [ %19, %middle.block ]
br label %for.body4
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.2.lcssa, %for.cond1.for.cond.cleanup3_crit_edge ]
%call12 = 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 %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
ret i32 0
for.cond1.for.cond.cleanup3_crit_edge: ; preds = %for.body4, %middle.block
%cnt.2.lcssa = phi i32 [ %19, %middle.block ], [ %cnt.2, %for.body4 ]
%inc10 = add nuw i32 %x.024, 1
%exitcond26.not = icmp eq i32 %x.024, %0
br i1 %exitcond26.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%y.021 = phi i32 [ %inc8, %for.body4 ], [ %y.021.ph, %for.body4.preheader ]
%cnt.120 = phi i32 [ %cnt.2, %for.body4 ], [ %cnt.120.ph, %for.body4.preheader ]
%20 = add nuw i32 %y.021, %x.024
%sub5 = sub i32 %1, %20
%cmp6 = icmp sgt i32 %sub5, -1
%cmp7.not = icmp sle i32 %sub5, %0
%or.cond.not = and i1 %cmp6, %cmp7.not
%inc = zext i1 %or.cond.not to i32
%cnt.2 = add nsw i32 %cnt.120, %inc
%inc8 = add nuw i32 %y.021, 1
%exitcond.not = icmp eq i32 %y.021, %0
br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge, label %for.body4, !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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include <stdio.h>
int main(void)
{
int n, m, min, max, t;
scanf("%d%d", &n, &m);
min = n/2+n%2;
max = n;
if (max < m) {
puts("-1");
return 0;
}
t = min-min/m*m;
if (t)
t = min+m-t;
else
t = min;
if (t > max)
puts("-1");
else
printf("%d\n", t);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25788/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25788/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.2 = private unnamed_addr constant [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
%m = 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 %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%call1 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
if.end: ; preds = %entry
%div = sdiv i32 %0, 2
%rem = srem i32 %0, 2
%add = add nsw i32 %div, %rem
%add.fr = freeze i32 %add
%2 = srem i32 %add.fr, %1
%tobool.not = icmp eq i32 %2, 0
%add4 = add nsw i32 %add.fr, %1
%sub5 = sub i32 %add4, %2
%t.0 = select i1 %tobool.not, i32 %add.fr, i32 %sub5
%cmp7 = icmp sgt i32 %t.0, %0
br i1 %cmp7, label %if.then8, label %if.else10
if.then8: ; preds = %if.end
%call9 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
if.else10: ; preds = %if.end
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %t.0)
br label %cleanup
cleanup: ; preds = %if.then8, %if.else10, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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 @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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main(){
int k,s;
int ans = 0;
int x,y;
scanf("%d %d",&k,&s);
for(x=0;x<=k;x++){
for(y=0;y<=k;y++){
if((s-(x+y) <= k) && (x+y <= s)){
ans += 1;
}
}
}
printf("%d",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257922/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257922/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not22 = icmp slt i32 %0, 0
br i1 %cmp.not22, label %for.end10, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %s, align 4
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
%n.vec = and i32 %2, -8
%broadcast.splatinsert29 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat30 = shufflevector <4 x i32> %broadcast.splatinsert29, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert31 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat32 = shufflevector <4 x i32> %broadcast.splatinsert31, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %2, %n.vec
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.inc8_crit_edge
%x.024 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc9, %for.cond1.for.inc8_crit_edge ]
%ans.023 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %ans.2.lcssa, %for.cond1.for.inc8_crit_edge ]
br i1 %min.iters.check, label %for.body3.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %ans.023, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %x.024, 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.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %3, %vector.ph ], [ %16, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%4 = add nuw nsw <4 x i32> %vec.ind, %broadcast.splat
%5 = add nuw nsw <4 x i32> %step.add, %broadcast.splat
%6 = sub nsw <4 x i32> %broadcast.splat30, %4
%7 = sub nsw <4 x i32> %broadcast.splat30, %5
%8 = icmp sle <4 x i32> %6, %broadcast.splat32
%9 = icmp sle <4 x i32> %7, %broadcast.splat32
%10 = icmp sle <4 x i32> %4, %broadcast.splat30
%11 = icmp sle <4 x i32> %5, %broadcast.splat30
%12 = and <4 x i1> %10, %8
%13 = and <4 x i1> %11, %9
%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> %vec.phi, %14
%17 = add <4 x i32> %vec.phi28, %15
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%18 = icmp eq i32 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond1.for.inc8_crit_edge, label %for.body3.preheader
for.body3.preheader: ; preds = %for.cond1.preheader, %middle.block
%y.021.ph = phi i32 [ 0, %for.cond1.preheader ], [ %n.vec, %middle.block ]
%ans.120.ph = phi i32 [ %ans.023, %for.cond1.preheader ], [ %19, %middle.block ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%y.021 = phi i32 [ %inc, %for.body3 ], [ %y.021.ph, %for.body3.preheader ]
%ans.120 = phi i32 [ %ans.2, %for.body3 ], [ %ans.120.ph, %for.body3.preheader ]
%add = add nuw nsw i32 %y.021, %x.024
%sub = sub nsw i32 %1, %add
%cmp4.not = icmp sle i32 %sub, %0
%cmp6.not = icmp sle i32 %add, %1
%or.cond.not = and i1 %cmp6.not, %cmp4.not
%add7 = zext i1 %or.cond.not to i32
%ans.2 = add nsw i32 %ans.120, %add7
%inc = add nuw i32 %y.021, 1
%exitcond.not = icmp eq i32 %y.021, %0
br i1 %exitcond.not, label %for.cond1.for.inc8_crit_edge, label %for.body3, !llvm.loop !13
for.cond1.for.inc8_crit_edge: ; preds = %for.body3, %middle.block
%ans.2.lcssa = phi i32 [ %19, %middle.block ], [ %ans.2, %for.body3 ]
%inc9 = add nuw i32 %x.024, 1
%exitcond26.not = icmp eq i32 %x.024, %0
br i1 %exitcond26.not, label %for.end10, label %for.cond1.preheader, !llvm.loop !14
for.end10: ; preds = %for.cond1.for.inc8_crit_edge, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %ans.2.lcssa, %for.cond1.for.inc8_crit_edge ]
%call11 = 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 %s) #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.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, !12, !11}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int k,s,a,b,c,cnt=0;
scanf("%d %d", &k, &s);
for(a=0; a<=k; a++){
for(b=0; b<=k; b++){
c=s-a-b;
if(c<=k && c>=0)
cnt+=1;
}
}
printf("%d",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257966/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not20 = icmp slt i32 %0, 0
br i1 %cmp.not20, label %for.end9, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %s, align 4
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
%n.vec = and i32 %2, -8
%broadcast.splatinsert27 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat28 = shufflevector <4 x i32> %broadcast.splatinsert27, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert29 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat30 = shufflevector <4 x i32> %broadcast.splatinsert29, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %2, %n.vec
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.inc7_crit_edge
%cnt.022 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %spec.select.lcssa, %for.cond1.for.inc7_crit_edge ]
%a.021 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc8, %for.cond1.for.inc7_crit_edge ]
br i1 %min.iters.check, label %for.body3.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %cnt.022, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a.021, 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> [ %3, %vector.ph ], [ %16, %vector.body ]
%vec.phi25 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%4 = add nuw <4 x i32> %vec.ind, %broadcast.splat
%5 = add nuw <4 x i32> %step.add, %broadcast.splat
%6 = sub <4 x i32> %broadcast.splat28, %4
%7 = sub <4 x i32> %broadcast.splat28, %5
%8 = icmp sle <4 x i32> %6, %broadcast.splat30
%9 = icmp sle <4 x i32> %7, %broadcast.splat30
%10 = icmp sgt <4 x i32> %6, <i32 -1, i32 -1, i32 -1, i32 -1>
%11 = icmp sgt <4 x i32> %7, <i32 -1, i32 -1, i32 -1, i32 -1>
%12 = and <4 x i1> %8, %10
%13 = and <4 x i1> %9, %11
%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> %vec.phi, %14
%17 = add <4 x i32> %vec.phi25, %15
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%18 = icmp eq i32 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond1.for.inc7_crit_edge, label %for.body3.preheader
for.body3.preheader: ; preds = %for.cond1.preheader, %middle.block
%cnt.119.ph = phi i32 [ %cnt.022, %for.cond1.preheader ], [ %19, %middle.block ]
%b.018.ph = phi i32 [ 0, %for.cond1.preheader ], [ %n.vec, %middle.block ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%cnt.119 = phi i32 [ %spec.select, %for.body3 ], [ %cnt.119.ph, %for.body3.preheader ]
%b.018 = phi i32 [ %inc, %for.body3 ], [ %b.018.ph, %for.body3.preheader ]
%20 = add nuw i32 %b.018, %a.021
%sub4 = sub i32 %1, %20
%cmp5 = icmp sle i32 %sub4, %0
%cmp6 = icmp sgt i32 %sub4, -1
%or.cond = and i1 %cmp5, %cmp6
%add = zext i1 %or.cond to i32
%spec.select = add nsw i32 %cnt.119, %add
%inc = add nuw i32 %b.018, 1
%exitcond.not = icmp eq i32 %b.018, %0
br i1 %exitcond.not, label %for.cond1.for.inc7_crit_edge, label %for.body3, !llvm.loop !13
for.cond1.for.inc7_crit_edge: ; preds = %for.body3, %middle.block
%spec.select.lcssa = phi i32 [ %19, %middle.block ], [ %spec.select, %for.body3 ]
%inc8 = add nuw i32 %a.021, 1
%exitcond24.not = icmp eq i32 %a.021, %0
br i1 %exitcond24.not, label %for.end9, label %for.cond1.preheader, !llvm.loop !14
for.end9: ; preds = %for.cond1.for.inc7_crit_edge, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select.lcssa, %for.cond1.for.inc7_crit_edge ]
%call10 = 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 %s) #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.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, !12, !11}
!14 = distinct !{!14, !10}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.