Source_Code
stringlengths 69
484k
| IR_Original
stringlengths 2.05k
17.9M
|
---|---|
#include<stdio.h>
#include<stdlib.h>
#define N 500000
#define INFTY 1000000001
void merge(int[],int,int,int);
void mergeSort(int[],int,int);
int count=0,S[N];
int main(){
int n;
int i;
/* i n p u t */
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
/* m e r g e S o r t */
mergeSort(S, 0, n);
/* o u t p u t */
for(i=0;i<n;i++){
if(i!=0) printf(" ");
printf("%d",S[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
void merge(int *A, int left, int mid, int right){
int n1,n2;
int i,j,k;
int *L,*R;
n1=mid-left;
n2=right-mid;
L=(int *)malloc(sizeof(int)*(n1+1));
R=(int *)malloc(sizeof(int)*(n2+1));
for(i=0;i<n1;i++){
L[i]=A[left+i];
}
for(i=0;i<n2;i++){
R[i]=A[mid+i];
}
L[n1] = INFTY;
R[n2] = INFTY;
i=0;
j=0;
for(k=left;k<right;k++){
count++;
if(L[i]<=R[j]){
A[k]=L[i];
i=i+1;
}
else{
A[k]=R[j];
j=j+1;
}
}
free(L);
free(R);
return;
}
void mergeSort(int *A,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
return;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147698/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147698/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@S = dso_local global [500000 x i32] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull @S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 0
br i1 %cmp324, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr @S, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %if.end ], [ 1, %if.end.peel ]
%putchar21 = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv28
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next29, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !11
for.end12: ; preds = %if.end, %if.end.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: 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: nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #9
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #9
%cmp86 = icmp sgt i32 %sub, 0
br i1 %cmp86, label %for.body.preheader, label %for.cond10.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.body.preheader, %entry
%cmp1188 = icmp sgt i32 %sub1, 0
br i1 %cmp1188, label %for.body13.preheader, label %for.end21
for.body13.preheader: ; preds = %for.cond10.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep96 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep96, i64 %13, i1 false), !tbaa !5
br label %for.end21
for.end21: ; preds = %for.body13.preheader, %for.cond10.preheader
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds i32, ptr %call, i64 %idxprom22
store i32 1000000001, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %sub1 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call5, i64 %idxprom24
store i32 1000000001, ptr %arrayidx25, align 4, !tbaa !5
%cmp2790 = icmp slt i32 %left, %right
br i1 %cmp2790, label %for.body29.preheader, label %for.end49
for.body29.preheader: ; preds = %for.end21
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body29
for.body29: ; preds = %for.body29.preheader, %for.body29
%indvars.iv = phi i64 [ %14, %for.body29.preheader ], [ %indvars.iv.next, %for.body29 ]
%i.293 = phi i32 [ 0, %for.body29.preheader ], [ %i.3, %for.body29 ]
%j.092 = phi i32 [ 0, %for.body29.preheader ], [ %j.1, %for.body29 ]
%15 = load i32, ptr @count, align 4, !tbaa !5
%inc30 = add nsw i32 %15, 1
store i32 %inc30, ptr @count, align 4, !tbaa !5
%idxprom31 = zext i32 %i.293 to i64
%arrayidx32 = getelementptr inbounds i32, ptr %call, i64 %idxprom31
%16 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%idxprom33 = zext i32 %j.092 to i64
%arrayidx34 = getelementptr inbounds i32, ptr %call5, i64 %idxprom33
%17 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%cmp35.not = icmp sgt i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%add46 = zext i1 %cmp35.not to i32
%j.1 = add nuw nsw i32 %j.092, %add46
%not.cmp35.not = xor i1 %cmp35.not, true
%add41 = zext i1 %not.cmp35.not to i32
%i.3 = add nuw nsw i32 %i.293, %add41
%18 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end49, label %for.body29, !llvm.loop !13
for.end49: ; preds = %for.body29, %for.end21
tail call void @free(ptr noundef nonnull %call) #8
tail call void @free(ptr noundef nonnull %call5) #8
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 #3
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<stdio.h>
#define N 500000
void Merge(int *, int, int, int);
void Merge_Sort(int *, int, int);
int cnt=0;
int main(void)
{
int i,n,A[N];
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%d",&A[i]);
}
Merge_Sort(A, 0, n);
for(i=0; i<n; i++){
if(i != 0) printf(" ");
printf("%d",A[i]);
}
printf("\n%d\n",cnt);
return 0;
}
void Merge(int *A,int left,int mid,int right)
{
int n1,n2,i,j,k;
int L[N],R[N];
n1=mid-left;
n2=right-mid;
for(i=0;i<n1;i++){
L[i] = A[left + i];
}
for(i=0;i<n2;i++){
R[i] = A[mid+i];
}
L[n1] = 1000000000;
R[n2] = 1000000000;
i = j = 0;
for(k=left; k<right; k++){
if(L[i] <= R[j]){
A[k] = L[i];
i++;
}
else{
A[k] = R[j];
j++;
}
cnt++;
}
}
void Merge_Sort(int *A,int left,int right)
{
int mid;
if(left+1 < right){
mid = (left + right)/2;
Merge_Sort(A, left, mid);
Merge_Sort(A, mid, right);
Merge(A, left, mid, right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147740/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147740/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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 ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @Merge_Sort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv26
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !11
for.end12: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @Merge_Sort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @Merge_Sort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @Merge_Sort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @Merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: 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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @Merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%L = alloca [500000 x i32], align 16
%R = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %L) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %R) #7
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep77 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep77, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr %L, i64 0, i64 %idxprom15
store i32 1000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom17
store i32 1000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%idxprom22 = zext i32 %i.272 to i64
%arrayidx23 = getelementptr inbounds [500000 x i32], ptr %L, i64 0, i64 %idxprom22
%15 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = zext i32 %j.073 to i64
%arrayidx25 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom24
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.not = icmp sle i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%inc31 = zext i1 %cmp26.not to i32
%i.3 = add nuw nsw i32 %i.272, %inc31
%not.cmp26.not = xor i1 %cmp26.not, true
%inc36 = zext i1 %not.cmp26.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc36
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%18 = load i32, ptr @cnt, align 4, !tbaa !5
%inc37 = add nsw i32 %18, 1
store i32 %inc37, ptr @cnt, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body21, !llvm.loop !13
for.end40: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %R) #7
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %L) #7
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { 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 #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define INFTY 1000000001
int N,n[500000],i,j,k,C=0;
int n1,n2,Lf[500000],Rf[500000];
void merge (int L,int M,int R){
n1= M-L;
n2= R-M;
for (i=0;i<n1;i++){
Lf[i]=n[L+i];
// printf("%d",Lf[i]);
}
for (i=0;i<n2;i++){
Rf[i]=n[M+i];
// printf("%d",Rf[i]);
}
Lf[n1]=INFTY;
Rf[n2]=INFTY;
i=0;
j=0;
for (k=L;k<R;k++){
if (Lf[i]<Rf[j]){
n[k]=Lf[i];
// printf("\n%d",n[k]);
i=i+1;
}else{
n[k]=Rf[j];
// printf("\n%d",n[k]);
j=j+1;
}
C++;
}
}
void mergeSort(int L,int R){
if (L+1<R){
int M;
M=(L+R)/2;
mergeSort(L,M);
mergeSort(M,R);
merge(L,M,R);
}
}
int main(void){
scanf("%d\n",&N);
for (i=0;i<N;i++){
scanf("%d",&n[i]);
}
mergeSort(0,N);
for (i=0;i<N;i++){
printf("%d",n[i]);
if (i!=N-1){
printf(" ");
}
}
printf("\n");
printf("%d\n",C);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147784/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147784/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@C = dso_local local_unnamed_addr global i32 0, align 4
@n1 = dso_local local_unnamed_addr global i32 0, align 4
@n2 = dso_local local_unnamed_addr global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@n = dso_local global [500000 x i32] zeroinitializer, align 16
@Lf = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@Rf = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@j = dso_local local_unnamed_addr global i32 0, align 4
@k = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@N = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @merge(i32 noundef %L, i32 noundef %M, i32 noundef %R) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %M, %L
store i32 %sub, ptr @n1, align 4, !tbaa !5
%sub1 = sub i32 %R, %M
store i32 %sub1, ptr @n2, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %sub, 0
br i1 %cmp52, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %L to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr @n, i64 %1
%2 = xor i32 %L, -1
%3 = add i32 %2, %M
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @Lf, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp554 = icmp sgt i32 %sub1, 0
br i1 %cmp554, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %M to i64
%8 = shl nsw i64 %7, 2
%scevgep70 = getelementptr i8, ptr @n, i64 %8
%9 = xor i32 %M, -1
%10 = add i32 %9, %R
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @Rf, ptr noundef nonnull align 4 dereferenceable(1) %scevgep70, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr @Lf, i64 0, i64 %idxprom15
store i32 1000000001, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr @Rf, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
store i32 0, ptr @j, align 4, !tbaa !5
%cmp2062 = icmp slt i32 %L, %R
br i1 %cmp2062, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%C.promoted = load i32, ptr @C, align 4, !tbaa !5
%14 = sext i32 %L to i64
%15 = add i32 %C.promoted, %R
%wide.trip.count75 = sext i32 %R to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %if.end
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %if.end ]
%add315865 = phi i32 [ 0, %for.body21.preheader ], [ %add3157, %if.end ]
%add366064 = phi i32 [ 0, %for.body21.preheader ], [ %add3659, %if.end ]
%idxprom22 = sext i32 %add315865 to i64
%arrayidx23 = getelementptr inbounds [500000 x i32], ptr @Lf, i64 0, i64 %idxprom22
%16 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %add366064 to i64
%arrayidx25 = getelementptr inbounds [500000 x i32], ptr @Rf, i64 0, i64 %idxprom24
%17 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp slt i32 %16, %17
br i1 %cmp26, label %if.then, label %if.else
if.then: ; preds = %for.body21
%add31 = add nsw i32 %add315865, 1
store i32 %add31, ptr @i, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %for.body21
%add36 = add nsw i32 %add366064, 1
store i32 %add36, ptr @j, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%.sink = phi i32 [ %16, %if.then ], [ %17, %if.else ]
%add3659 = phi i32 [ %add366064, %if.then ], [ %add36, %if.else ]
%add3157 = phi i32 [ %add31, %if.then ], [ %add315865, %if.else ]
%18 = getelementptr inbounds [500000 x i32], ptr @n, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count75
br i1 %exitcond.not, label %for.cond19.for.end40_crit_edge, label %for.body21, !llvm.loop !9
for.cond19.for.end40_crit_edge: ; preds = %if.end
%19 = sub i32 %15, %L
store i32 %19, ptr @C, align 4, !tbaa !5
br label %for.end40
for.end40: ; preds = %for.cond19.for.end40_crit_edge, %for.end14
%storemerge51.lcssa = phi i32 [ %R, %for.cond19.for.end40_crit_edge ], [ %L, %for.end14 ]
store i32 %storemerge51.lcssa, ptr @k, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(i32 noundef %L, i32 noundef %R) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %L, 1
%cmp = icmp slt i32 %add, %R
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %R, %L
%div = sdiv i32 %add1, 2
tail call void @mergeSort(i32 noundef %L, i32 noundef %div)
tail call void @mergeSort(i32 noundef %div, i32 noundef %R)
%sub.i = sub nsw i32 %div, %L
store i32 %sub.i, ptr @n1, align 4, !tbaa !5
%sub1.i = sub i32 %R, %div
store i32 %sub1.i, ptr @n2, align 4, !tbaa !5
%cmp52.i = icmp sgt i32 %sub.i, 0
br i1 %cmp52.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %L to i64
%1 = shl nsw i64 %0, 2
%scevgep.i = getelementptr i8, ptr @n, i64 %1
%2 = xor i32 %L, -1
%3 = add i32 %div, %2
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @Lf, ptr noundef nonnull align 4 dereferenceable(1) %scevgep.i, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader.i
for.cond4.preheader.i: ; preds = %for.body.preheader.i, %if.then
%cmp554.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp554.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%7 = sext i32 %div to i64
%8 = shl nsw i64 %7, 2
%scevgep70.i = getelementptr i8, ptr @n, i64 %8
%9 = xor i32 %div, -1
%10 = add i32 %9, %R
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @Rf, ptr noundef nonnull align 4 dereferenceable(1) %scevgep70.i, i64 %13, i1 false), !tbaa !5
br label %for.end14.i
for.end14.i: ; preds = %for.body6.preheader.i, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [500000 x i32], ptr @Lf, i64 0, i64 %idxprom15.i
store i32 1000000001, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [500000 x i32], ptr @Rf, i64 0, i64 %idxprom17.i
store i32 1000000001, ptr %arrayidx18.i, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
store i32 0, ptr @j, align 4, !tbaa !5
%C.promoted.i = load i32, ptr @C, align 4, !tbaa !5
%14 = sext i32 %L to i64
%wide.trip.count75.i = sext i32 %R to i64
br label %for.body21.i
for.body21.i: ; preds = %if.end.i, %for.end14.i
%indvars.iv.i = phi i64 [ %14, %for.end14.i ], [ %indvars.iv.next.i, %if.end.i ]
%add315865.i = phi i32 [ 0, %for.end14.i ], [ %add3157.i, %if.end.i ]
%add366064.i = phi i32 [ 0, %for.end14.i ], [ %add3659.i, %if.end.i ]
%idxprom22.i = sext i32 %add315865.i to i64
%arrayidx23.i = getelementptr inbounds [500000 x i32], ptr @Lf, i64 0, i64 %idxprom22.i
%15 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%idxprom24.i = sext i32 %add366064.i to i64
%arrayidx25.i = getelementptr inbounds [500000 x i32], ptr @Rf, i64 0, i64 %idxprom24.i
%16 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%cmp26.i = icmp slt i32 %15, %16
br i1 %cmp26.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %for.body21.i
%add31.i = add nsw i32 %add315865.i, 1
store i32 %add31.i, ptr @i, align 4, !tbaa !5
br label %if.end.i
if.else.i: ; preds = %for.body21.i
%add36.i = add nsw i32 %add366064.i, 1
store i32 %add36.i, ptr @j, align 4, !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.else.i, %if.then.i
%.sink.i = phi i32 [ %15, %if.then.i ], [ %16, %if.else.i ]
%add3659.i = phi i32 [ %add366064.i, %if.then.i ], [ %add36.i, %if.else.i ]
%add3157.i = phi i32 [ %add31.i, %if.then.i ], [ %add315865.i, %if.else.i ]
%17 = getelementptr inbounds [500000 x i32], ptr @n, i64 0, i64 %indvars.iv.i
store i32 %.sink.i, ptr %17, align 4
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count75.i
br i1 %exitcond.not.i, label %for.cond19.for.end40_crit_edge.i, label %for.body21.i, !llvm.loop !9
for.cond19.for.end40_crit_edge.i: ; preds = %if.end.i
%18 = sub i32 %R, %L
%19 = add i32 %18, %C.promoted.i
store i32 %19, ptr @C, align 4, !tbaa !5
store i32 %R, ptr @k, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %for.cond19.for.end40_crit_edge.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
store i32 0, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%storemerge20 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%idxprom = sext i32 %storemerge20 to i64
%arrayidx = getelementptr inbounds [500000 x i32], ptr @n, i64 0, i64 %idxprom
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
tail call void @mergeSort(i32 noundef 0, i32 noundef %.lcssa)
store i32 0, ptr @i, align 4, !tbaa !5
%3 = load i32, ptr @N, align 4, !tbaa !5
%cmp321 = icmp sgt i32 %3, 0
br i1 %cmp321, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%storemerge1722 = phi i32 [ %inc11, %for.inc10 ], [ 0, %for.end ]
%idxprom5 = sext i32 %storemerge1722 to i64
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr @n, i64 0, i64 %idxprom5
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%5 = load i32, ptr @i, align 4, !tbaa !5
%6 = load i32, ptr @N, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp8.not = icmp eq i32 %5, %sub
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar18 = tail call i32 @putchar(i32 32)
%.pre = load i32, ptr @i, align 4, !tbaa !5
%.pre24 = load i32, ptr @N, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %6, %for.body4 ], [ %.pre24, %if.then ]
%8 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%inc11 = add nsw i32 %8, 1
store i32 %inc11, ptr @i, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc11, %7
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.inc10, %for.end
%putchar = tail call i32 @putchar(i32 10)
%9 = load i32, ptr @C, align 4, !tbaa !5
%call14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
void merge(int *,int,int,int);
void mergeSort(int *,int,int);
int count=0;
int main(){
int n,A[500000],i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
mergeSort(A,0,n);
for(i=0;i<n;i++){
if(i != 0)printf(" ");
printf("%d",A[i]);
}
printf("\n%d\n",count);
return 0;
}
void merge(int A[],int left,int mid,int right)
{
int n1,n2,i,j,k;
int L[500000],R[500000];
n1 = mid -left;
n2 = right -mid;
for(i=0;i<n1;i++){
L[i] = A[left + i];
}
for(i=0;i<n2;i++){
R[i] = A[mid + i];
}
L[n1] = 1000000005;
R[n2] = 1000000005;
i = 0;
j = 0;
for(k=left;k<right;k++){
if(L[i] <= R[j]){
A[k] = L[i];
i = i + 1;
}
else{
A[k] = R[j];
j = j + 1;
}
count++;
}
}
void mergeSort(int A[],int left,int right)
{
int mid;
if((left+1) < right){
mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147834/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147834/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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 ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv26
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !11
for.end12: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: 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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%L = alloca [500000 x i32], align 16
%R = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %L) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %R) #7
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep77 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep77, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr %L, i64 0, i64 %idxprom15
store i32 1000000005, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom17
store i32 1000000005, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%idxprom22 = zext i32 %i.272 to i64
%arrayidx23 = getelementptr inbounds [500000 x i32], ptr %L, i64 0, i64 %idxprom22
%15 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = zext i32 %j.073 to i64
%arrayidx25 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom24
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.not = icmp sle i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%add31 = zext i1 %cmp26.not to i32
%i.3 = add nuw nsw i32 %i.272, %add31
%not.cmp26.not = xor i1 %cmp26.not, true
%add36 = zext i1 %not.cmp26.not to i32
%j.1 = add nuw nsw i32 %j.073, %add36
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%18 = load i32, ptr @count, align 4, !tbaa !5
%inc37 = add nsw i32 %18, 1
store i32 %inc37, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body21, !llvm.loop !13
for.end40: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %R) #7
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %L) #7
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { 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 #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#define INFTY 1000000001
void merge(int *, int, int, int);
void mergeSort(int *, int, int);
int count;
int main()
{
int i, n, S[500000];
scanf("%d", &n);
for(i=0; i<n; i++)
{
scanf("%d", &S[i]);
}
mergeSort(S, 0, n);
for(i=0; i<n; i++)
{
printf("%d", S[i]);
if(i+1 < n) printf(" ");
}
printf("\n");
printf("%d\n", count);
return 0;
}
void merge(int *A, int left, int mid, int right)
{
int i, j, k;
int n1 = mid-left;
int n2 = right-mid;
int L[n1+1], R[n2+1];
for(i=0; i<n1; i++)
{
L[i] = A[left+i];
}
for(i=0; i<n2; i++)
{
R[i] = A[mid+i];
}
L[n1] = R[n2] = INFTY;
i = j = 0;
for(k=left; k<right; k++)
{
count++;
if(L[i] <= R[j])
{
A[k] = L[i];
i = i+1;
}
else
{
A[k] = R[j];
j = j+1;
}
}
}
void mergeSort(int *A, int left, int right)
{
int mid;
if(left+1 < right)
{
mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147878/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147878/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@count = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 0
br i1 %cmp324, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv28
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp8 = icmp slt i64 %indvars.iv.next29, %6
br i1 %cmp8, label %if.then, label %for.inc10
if.then: ; preds = %for.body4
%putchar21 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
%.pre31 = sext i32 %.pre to i64
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%.pre-phi = phi i64 [ %6, %for.body4 ], [ %.pre31, %if.then ]
%cmp3 = icmp slt i64 %indvars.iv.next29, %.pre-phi
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %for.end
%putchar = call i32 @putchar(i32 10)
%7 = load i32, ptr @count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %7)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: 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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp72 = icmp sgt i32 %sub, 0
br i1 %cmp72, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %A, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp874 = icmp sgt i32 %sub1, 0
br i1 %cmp874, label %for.body9.preheader, label %for.end17
for.body9.preheader: ; preds = %for.cond7.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep82 = getelementptr i8, ptr %A, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep82, i64 %15, i1 false), !tbaa !5
br label %for.end17
for.end17: ; preds = %for.body9.preheader, %for.cond7.preheader
%idxprom18 = sext i32 %sub1 to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom18
store i32 1000000001, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %sub to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla, i64 %idxprom20
store i32 1000000001, ptr %arrayidx21, align 4, !tbaa !5
%cmp2376 = icmp slt i32 %left, %right
br i1 %cmp2376, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.end17
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %16, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%i.279 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%j.078 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%17 = load i32, ptr @count, align 4, !tbaa !5
%inc25 = add nsw i32 %17, 1
store i32 %inc25, ptr @count, align 4, !tbaa !5
%idxprom26 = zext i32 %i.279 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %idxprom26
%18 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%idxprom28 = zext i32 %j.078 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom28
%19 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.not = icmp sgt i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%add40 = zext i1 %cmp30.not to i32
%j.1 = add nuw nsw i32 %j.078, %add40
%not.cmp30.not = xor i1 %cmp30.not, true
%add35 = zext i1 %not.cmp30.not to i32
%i.3 = add nuw nsw i32 %i.279, %add35
%20 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end43, label %for.body24, !llvm.loop !12
for.end43: ; preds = %for.body24, %for.end17
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { 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 #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
int A[500000], compare;
void merge(int left, int mid, int right){
int n1 = mid - left, n2 = right - mid, L[n1 + 1], R[n2 + 1], i, j, k;
for(i=0;i<n1;i++)
L[i] = A[left + i];
for(i=0;i<n2;i++)
R[i] = A[mid + i];
L[n1] = INFINITY;
R[n2] = INFINITY;
i = 0;
j = 0;
for(k=left;k<right;k++){
if(L[i] <= R[j]){
A[k] = L[i];
i++;
} else {
A[k] = R[j];
j++;
}
compare++;
}
}
void mergeSort(int left, int right){
int mid;
if(left + 1 < right){
mid = (left + right)/2;
mergeSort(left, mid);
mergeSort(mid, right);
merge(left, mid, right);
}
}
int main(void){
int n, i;
scanf("%d", &n);
for(i=0;i<n;i++)
scanf("%d", &A[i]);
mergeSort(0, n);
for(i=0;i<n-1;i++)
printf("%d ", A[i]);
printf("%d\n%d\n", A[n-1], compare);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147935/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147935/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@A = dso_local global [500000 x i32] zeroinitializer, align 16
@compare = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @merge(i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp69 = icmp sgt i32 %sub, 0
br i1 %cmp69, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr @A, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp871 = icmp sgt i32 %sub1, 0
br i1 %cmp871, label %for.body9.preheader, label %for.cond22.preheader
for.body9.preheader: ; preds = %for.cond7.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep81 = getelementptr i8, ptr @A, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep81, i64 %15, i1 false), !tbaa !5
br label %for.cond22.preheader
for.cond22.preheader: ; preds = %for.body9.preheader, %for.cond7.preheader
%cmp2374 = icmp slt i32 %left, %right
br i1 %cmp2374, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.cond22.preheader
%compare.promoted = load i32, ptr @compare, align 4, !tbaa !5
%16 = sext i32 %left to i64
%17 = add i32 %compare.promoted, %right
%wide.trip.count = sext i32 %right to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %16, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%j.077 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%i.276 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%idxprom25 = zext i32 %i.276 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %idxprom25
%18 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%idxprom27 = zext i32 %j.077 to i64
%arrayidx28 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom27
%19 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29.not = icmp sle i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc34 = zext i1 %cmp29.not to i32
%i.3 = add nuw nsw i32 %i.276, %inc34
%not.cmp29.not = xor i1 %cmp29.not, true
%inc39 = zext i1 %not.cmp29.not to i32
%j.1 = add nuw nsw i32 %j.077, %inc39
%20 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.for.end43_crit_edge, label %for.body24, !llvm.loop !9
for.cond22.for.end43_crit_edge: ; preds = %for.body24
%21 = sub i32 %17, %left
store i32 %21, ptr @compare, align 4, !tbaa !5
br label %for.end43
for.end43: ; preds = %for.cond22.for.end43_crit_edge, %for.cond22.preheader
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(i32 noundef %left, i32 noundef %right) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret10
common.ret10: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(i32 noundef %div, i32 noundef %right)
tail call void @merge(i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret10
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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 ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp323 = icmp sgt i32 %3, 1
br i1 %cmp323, label %for.body4, label %for.end.for.end10_crit_edge
for.end.for.end10_crit_edge: ; preds = %for.end
%sub22 = add nsw i32 %3, -1
%.pre = sext i32 %sub22 to i64
br label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv29
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next30, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !12
for.end10: ; preds = %for.body4, %for.end.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.end.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%8 = load i32, ptr @compare, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
// AOJ ALDS1_5_B Merge Sort
// 2018.4.30 bal4u
#include <stdio.h>
#include <string.h>
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
int n = 0, c = gc();
do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
return n;
}
char buf[20];
void mypr(int n)
{
int w;
if (!n) { pc('0'); return; }
w = 0; while (n) buf[w++] = n%10 + '0', n/=10;
while (w--) pc(buf[w]);
}
#define MAX_N 500002
#define INF 0x7f7f7f7f
int a[MAX_N];
int w[MAX_N/2+2];
int cnt;
void merge_sort(int low, int high)
{
int i, j, k, p, mid;
if (low < high) {
mid = (low + high) >> 1;
merge_sort(low, mid);
merge_sort(mid+1, high);
cnt += high-low+1;
p = mid-low+1;
memcpy(w, a+low, p << 2);
i = mid+1, j = 0; k = low;
w[p] = INF;
while (i <= high) {
if (w[j] <= a[i]) a[k++] = w[j++];
else a[k++] = a[i++];
}
memcpy(a+k, w+j, (p-j) << 2);
}
}
int main()
{
int n, i;
n = in(); for (i = 0; i < n; i++) a[i] = in();
cnt = 0;
merge_sort(0, n-1);
mypr(a[0]); for (i = 1; i < n; i++) pc(' '), mypr(a[i]); pc('\n');
mypr(cnt); pc('\n');
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147979/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147979/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@buf = dso_local local_unnamed_addr global [20 x i8] zeroinitializer, align 16
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@w = dso_local local_unnamed_addr global [250003 x i32] zeroinitializer, align 16
@a = dso_local local_unnamed_addr global [500002 x i32] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5
%.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre14.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit13
%4 = phi ptr [ %8, %getchar_unlocked.exit13 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit13 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i9, %getchar_unlocked.exit13 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4, align 8, !tbaa !9
%_IO_read_end.i5 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5, align 8, !tbaa !14
%cmp.not.i6 = icmp ult ptr %5, %6
br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !15
cond.true.i7: ; preds = %do.body
%call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #5
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13
cond.false.i10: ; preds = %do.body
%incdec.ptr.i11 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11, ptr %_IO_read_ptr.i4, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i12 = zext i8 %7 to i32
br label %getchar_unlocked.exit13
getchar_unlocked.exit13: ; preds = %cond.true.i7, %cond.false.i10
%8 = phi ptr [ %.pre, %cond.true.i7 ], [ %4, %cond.false.i10 ]
%cond.i9 = phi i32 [ %call.i8, %cond.true.i7 ], [ %conv3.i12, %cond.false.i10 ]
%cmp = icmp sgt i32 %cond.i9, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !17
do.end: ; preds = %getchar_unlocked.exit13
ret i32 %add
}
; Function Attrs: nounwind uwtable
define dso_local void @mypr(i32 noundef %n) local_unnamed_addr #0 {
entry:
%tobool.not = icmp eq i32 %n, 0
br i1 %tobool.not, label %if.then, label %while.body
if.then: ; preds = %entry
%0 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5
%1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !19
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6
%2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !20
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %if.then
%call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 48) #5
br label %cleanup
cond.false.i: ; preds = %if.then
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !19
store i8 48, ptr %1, align 1, !tbaa !16
br label %cleanup
while.body: ; preds = %entry, %while.body
%indvars.iv28 = phi i32 [ %indvars.iv.next29, %while.body ], [ 1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%n.addr.024 = phi i32 [ %div, %while.body ], [ %n, %entry ]
%rem = srem i32 %n.addr.024, 10
%3 = trunc i32 %rem to i8
%conv = add nsw i8 %3, 48
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [20 x i8], ptr @buf, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !16
%div = sdiv i32 %n.addr.024, 10
%n.addr.024.off = add i32 %n.addr.024, 9
%tobool1.not = icmp ult i32 %n.addr.024.off, 19
%indvars.iv.next29 = add nuw i32 %indvars.iv28, 1
br i1 %tobool1.not, label %while.body4.preheader, label %while.body, !llvm.loop !21
while.body4.preheader: ; preds = %while.body
%4 = sext i32 %indvars.iv28 to i64
br label %while.body4
while.body4: ; preds = %while.body4.preheader, %putchar_unlocked.exit23
%indvars.iv30 = phi i64 [ %4, %while.body4.preheader ], [ %indvars.iv.next31, %putchar_unlocked.exit23 ]
%indvars.iv.next31 = add nsw i64 %indvars.iv30, -1
%arrayidx6 = getelementptr inbounds [20 x i8], ptr @buf, i64 0, i64 %indvars.iv.next31
%5 = load i8, ptr %arrayidx6, align 1, !tbaa !16
%6 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i15 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 5
%7 = load ptr, ptr %_IO_write_ptr.i15, align 8, !tbaa !19
%_IO_write_end.i16 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 6
%8 = load ptr, ptr %_IO_write_end.i16, align 8, !tbaa !20
%cmp.not.i17 = icmp ult ptr %7, %8
br i1 %cmp.not.i17, label %cond.false.i21, label %cond.true.i18, !prof !15
cond.true.i18: ; preds = %while.body4
%conv7 = zext i8 %5 to i32
%call.i19 = tail call i32 @__overflow(ptr noundef nonnull %6, i32 noundef %conv7) #5
br label %putchar_unlocked.exit23
cond.false.i21: ; preds = %while.body4
%incdec.ptr.i22 = getelementptr inbounds i8, ptr %7, i64 1
store ptr %incdec.ptr.i22, ptr %_IO_write_ptr.i15, align 8, !tbaa !19
store i8 %5, ptr %7, align 1, !tbaa !16
br label %putchar_unlocked.exit23
putchar_unlocked.exit23: ; preds = %cond.true.i18, %cond.false.i21
%9 = and i64 %indvars.iv.next31, 4294967295
%tobool3.not = icmp eq i64 %9, 0
br i1 %tobool3.not, label %cleanup, label %while.body4, !llvm.loop !22
cleanup: ; preds = %putchar_unlocked.exit23, %cond.false.i, %cond.true.i
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @merge_sort(i32 noundef %low, i32 noundef %high) local_unnamed_addr #1 {
entry:
%cmp = icmp slt i32 %low, %high
br i1 %cmp, label %if.then, label %if.end34
if.then: ; preds = %entry
%add = add nsw i32 %high, %low
%shr = ashr i32 %add, 1
tail call void @merge_sort(i32 noundef %low, i32 noundef %shr)
%add1 = add nsw i32 %shr, 1
tail call void @merge_sort(i32 noundef %add1, i32 noundef %high)
%0 = load i32, ptr @cnt, align 4, !tbaa !23
%reass.sub = sub i32 %high, %low
%add2 = add i32 %reass.sub, 1
%add3 = add nsw i32 %add2, %0
store i32 %add3, ptr @cnt, align 4, !tbaa !23
%sub4 = sub nsw i32 %shr, %low
%add5 = add nsw i32 %sub4, 1
%idx.ext = sext i32 %low to i64
%add.ptr = getelementptr inbounds i32, ptr @a, i64 %idx.ext
%shl = shl i32 %add5, 2
%conv = sext i32 %shl to i64
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @w, ptr nonnull align 4 %add.ptr, i64 %conv, i1 false)
%idxprom = sext i32 %add5 to i64
%arrayidx = getelementptr inbounds [250003 x i32], ptr @w, i64 0, i64 %idxprom
store i32 2139062143, ptr %arrayidx, align 4, !tbaa !23
%cmp7.not58.not = icmp slt i32 %shr, %high
br i1 %cmp7.not58.not, label %while.body, label %while.end
while.body: ; preds = %if.then, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ %idx.ext, %if.then ]
%i.061 = phi i32 [ %i.1, %while.body ], [ %add1, %if.then ]
%j.060 = phi i32 [ %j.1, %while.body ], [ 0, %if.then ]
%idxprom9 = zext i32 %j.060 to i64
%arrayidx10 = getelementptr inbounds [250003 x i32], ptr @w, i64 0, i64 %idxprom9
%1 = load i32, ptr %arrayidx10, align 4, !tbaa !23
%idxprom11 = sext i32 %i.061 to i64
%arrayidx12 = getelementptr inbounds [500002 x i32], ptr @a, i64 0, i64 %idxprom11
%2 = load i32, ptr %arrayidx12, align 4, !tbaa !23
%cmp13.not = icmp sle i32 %1, %2
%.sink = tail call i32 @llvm.smin.i32(i32 %1, i32 %2)
%inc = zext i1 %cmp13.not to i32
%j.1 = add nuw nsw i32 %j.060, %inc
%not.cmp13.not = xor i1 %cmp13.not, true
%inc21 = zext i1 %not.cmp13.not to i32
%i.1 = add nsw i32 %i.061, %inc21
%3 = getelementptr inbounds [500002 x i32], ptr @a, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %3, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
%cmp7.not = icmp sgt i32 %i.1, %high
br i1 %cmp7.not, label %while.end.loopexit, label %while.body, !llvm.loop !24
while.end.loopexit: ; preds = %while.body
%sext = shl i64 %indvars.iv.next, 32
%.pre = ashr exact i64 %sext, 32
br label %while.end
while.end: ; preds = %while.end.loopexit, %if.then
%idx.ext27.pre-phi = phi i64 [ %.pre, %while.end.loopexit ], [ %idx.ext, %if.then ]
%j.0.lcssa = phi i32 [ %j.1, %while.end.loopexit ], [ 0, %if.then ]
%add.ptr28 = getelementptr inbounds i32, ptr @a, i64 %idx.ext27.pre-phi
%idx.ext29 = sext i32 %j.0.lcssa to i64
%add.ptr30 = getelementptr inbounds i32, ptr @w, i64 %idx.ext29
%sub31 = sub nsw i32 %add5, %j.0.lcssa
%shl32 = shl i32 %sub31, 2
%conv33 = sext i32 %shl32 to i64
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %add.ptr28, ptr nonnull align 4 %add.ptr30, i64 %conv33, i1 false)
br label %if.end34
if.end34: ; preds = %while.end, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15
cond.true.i.i: ; preds = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5
%.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i.preheader
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph161 = phi ptr [ %0, %cond.false.i.i ], [ %.pre14.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit13.i
%4 = phi ptr [ %8, %getchar_unlocked.exit13.i ], [ %.ph161, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit13.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i9.i, %getchar_unlocked.exit13.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul nsw i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !9
%_IO_read_end.i5.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5.i, align 8, !tbaa !14
%cmp.not.i6.i = icmp ult ptr %5, %6
br i1 %cmp.not.i6.i, label %cond.false.i10.i, label %cond.true.i7.i, !prof !15
cond.true.i7.i: ; preds = %do.body.i
%call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %4) #5
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i
cond.false.i10.i: ; preds = %do.body.i
%incdec.ptr.i11.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11.i, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i12.i = zext i8 %7 to i32
br label %getchar_unlocked.exit13.i
getchar_unlocked.exit13.i: ; preds = %cond.false.i10.i, %cond.true.i7.i
%8 = phi ptr [ %.pre.i, %cond.true.i7.i ], [ %4, %cond.false.i10.i ]
%cond.i9.i = phi i32 [ %call.i8.i, %cond.true.i7.i ], [ %conv3.i12.i, %cond.false.i10.i ]
%cmp.i = icmp sgt i32 %cond.i9.i, 47
br i1 %cmp.i, label %do.body.i, label %for.cond.preheader, !llvm.loop !17
for.cond.preheader: ; preds = %getchar_unlocked.exit13.i
%cmp148 = icmp sgt i32 %add.i, 0
br i1 %cmp148, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %add.i to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %in.exit50
%9 = phi ptr [ %8, %for.body.preheader ], [ %18, %in.exit50 ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %in.exit50 ]
%_IO_read_ptr.i.i20 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 1
%10 = load ptr, ptr %_IO_read_ptr.i.i20, align 8, !tbaa !9
%_IO_read_end.i.i21 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 2
%11 = load ptr, ptr %_IO_read_end.i.i21, align 8, !tbaa !14
%cmp.not.i.i22 = icmp ult ptr %10, %11
br i1 %cmp.not.i.i22, label %cond.false.i.i47, label %cond.true.i.i23, !prof !15
cond.true.i.i23: ; preds = %for.body
%call.i.i24 = tail call i32 @__uflow(ptr noundef nonnull %9) #5
%.pre14.pre.i25 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i29.preheader
cond.false.i.i47: ; preds = %for.body
%incdec.ptr.i.i48 = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr.i.i48, ptr %_IO_read_ptr.i.i20, align 8, !tbaa !9
%12 = load i8, ptr %10, align 1, !tbaa !16
%conv3.i.i49 = zext i8 %12 to i32
br label %do.body.i29.preheader
do.body.i29.preheader: ; preds = %cond.false.i.i47, %cond.true.i.i23
%.ph160 = phi ptr [ %9, %cond.false.i.i47 ], [ %.pre14.pre.i25, %cond.true.i.i23 ]
%c.0.i31.ph = phi i32 [ %conv3.i.i49, %cond.false.i.i47 ], [ %call.i.i24, %cond.true.i.i23 ]
br label %do.body.i29
do.body.i29: ; preds = %do.body.i29.preheader, %getchar_unlocked.exit13.i41
%13 = phi ptr [ %18, %getchar_unlocked.exit13.i41 ], [ %.ph160, %do.body.i29.preheader ]
%14 = phi ptr [ %19, %getchar_unlocked.exit13.i41 ], [ %.ph160, %do.body.i29.preheader ]
%n.0.i30 = phi i32 [ %add.i34, %getchar_unlocked.exit13.i41 ], [ 0, %do.body.i29.preheader ]
%c.0.i31 = phi i32 [ %cond.i9.i42, %getchar_unlocked.exit13.i41 ], [ %c.0.i31.ph, %do.body.i29.preheader ]
%mul.i32 = mul nsw i32 %n.0.i30, 10
%and.i33 = and i32 %c.0.i31, 15
%add.i34 = add nsw i32 %and.i33, %mul.i32
%_IO_read_ptr.i4.i35 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 1
%15 = load ptr, ptr %_IO_read_ptr.i4.i35, align 8, !tbaa !9
%_IO_read_end.i5.i36 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 2
%16 = load ptr, ptr %_IO_read_end.i5.i36, align 8, !tbaa !14
%cmp.not.i6.i37 = icmp ult ptr %15, %16
br i1 %cmp.not.i6.i37, label %cond.false.i10.i44, label %cond.true.i7.i38, !prof !15
cond.true.i7.i38: ; preds = %do.body.i29
%call.i8.i39 = tail call i32 @__uflow(ptr noundef nonnull %14) #5
%.pre.i40 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i41
cond.false.i10.i44: ; preds = %do.body.i29
%incdec.ptr.i11.i45 = getelementptr inbounds i8, ptr %15, i64 1
store ptr %incdec.ptr.i11.i45, ptr %_IO_read_ptr.i4.i35, align 8, !tbaa !9
%17 = load i8, ptr %15, align 1, !tbaa !16
%conv3.i12.i46 = zext i8 %17 to i32
br label %getchar_unlocked.exit13.i41
getchar_unlocked.exit13.i41: ; preds = %cond.false.i10.i44, %cond.true.i7.i38
%18 = phi ptr [ %.pre.i40, %cond.true.i7.i38 ], [ %13, %cond.false.i10.i44 ]
%19 = phi ptr [ %.pre.i40, %cond.true.i7.i38 ], [ %14, %cond.false.i10.i44 ]
%cond.i9.i42 = phi i32 [ %call.i8.i39, %cond.true.i7.i38 ], [ %conv3.i12.i46, %cond.false.i10.i44 ]
%cmp.i43 = icmp sgt i32 %cond.i9.i42, 47
br i1 %cmp.i43, label %do.body.i29, label %in.exit50, !llvm.loop !17
in.exit50: ; preds = %getchar_unlocked.exit13.i41
%arrayidx = getelementptr inbounds [500002 x i32], ptr @a, i64 0, i64 %indvars.iv
store i32 %add.i34, ptr %arrayidx, align 4, !tbaa !23
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !25
for.end: ; preds = %in.exit50, %for.cond.preheader
store i32 0, ptr @cnt, align 4, !tbaa !23
%sub = add nsw i32 %add.i, -1
tail call void @merge_sort(i32 noundef 0, i32 noundef %sub)
%20 = load i32, ptr @a, align 16, !tbaa !23
%tobool.not.i = icmp eq i32 %20, 0
br i1 %tobool.not.i, label %if.then.i, label %while.body.i
if.then.i: ; preds = %for.end
%21 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %21, i64 0, i32 5
%22 = load ptr, ptr %_IO_write_ptr.i.i, align 8, !tbaa !19
%_IO_write_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %21, i64 0, i32 6
%23 = load ptr, ptr %_IO_write_end.i.i, align 8, !tbaa !20
%cmp.not.i.i51 = icmp ult ptr %22, %23
br i1 %cmp.not.i.i51, label %cond.false.i.i54, label %cond.true.i.i52, !prof !15
cond.true.i.i52: ; preds = %if.then.i
%call.i.i53 = tail call i32 @__overflow(ptr noundef nonnull %21, i32 noundef 48) #5
br label %mypr.exit
cond.false.i.i54: ; preds = %if.then.i
%incdec.ptr.i.i55 = getelementptr inbounds i8, ptr %22, i64 1
store ptr %incdec.ptr.i.i55, ptr %_IO_write_ptr.i.i, align 8, !tbaa !19
store i8 48, ptr %22, align 1, !tbaa !16
br label %mypr.exit
while.body.i: ; preds = %for.end, %while.body.i
%indvars.iv28.i = phi i32 [ %indvars.iv.next29.i, %while.body.i ], [ 1, %for.end ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.body.i ], [ 0, %for.end ]
%n.addr.024.i = phi i32 [ %div.i, %while.body.i ], [ %20, %for.end ]
%rem.i = srem i32 %n.addr.024.i, 10
%24 = trunc i32 %rem.i to i8
%conv.i = add nsw i8 %24, 48
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds [20 x i8], ptr @buf, i64 0, i64 %indvars.iv.i
store i8 %conv.i, ptr %arrayidx.i, align 1, !tbaa !16
%div.i = sdiv i32 %n.addr.024.i, 10
%n.addr.024.off.i = add i32 %n.addr.024.i, 9
%tobool1.not.i = icmp ult i32 %n.addr.024.off.i, 19
%indvars.iv.next29.i = add nuw i32 %indvars.iv28.i, 1
br i1 %tobool1.not.i, label %while.body4.preheader.i, label %while.body.i, !llvm.loop !21
while.body4.preheader.i: ; preds = %while.body.i
%25 = sext i32 %indvars.iv28.i to i64
br label %while.body4.i
while.body4.i: ; preds = %putchar_unlocked.exit23.i, %while.body4.preheader.i
%indvars.iv30.i = phi i64 [ %25, %while.body4.preheader.i ], [ %indvars.iv.next31.i, %putchar_unlocked.exit23.i ]
%indvars.iv.next31.i = add nsw i64 %indvars.iv30.i, -1
%arrayidx6.i = getelementptr inbounds [20 x i8], ptr @buf, i64 0, i64 %indvars.iv.next31.i
%26 = load i8, ptr %arrayidx6.i, align 1, !tbaa !16
%27 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i15.i = getelementptr inbounds %struct._IO_FILE, ptr %27, i64 0, i32 5
%28 = load ptr, ptr %_IO_write_ptr.i15.i, align 8, !tbaa !19
%_IO_write_end.i16.i = getelementptr inbounds %struct._IO_FILE, ptr %27, i64 0, i32 6
%29 = load ptr, ptr %_IO_write_end.i16.i, align 8, !tbaa !20
%cmp.not.i17.i = icmp ult ptr %28, %29
br i1 %cmp.not.i17.i, label %cond.false.i21.i, label %cond.true.i18.i, !prof !15
cond.true.i18.i: ; preds = %while.body4.i
%conv7.i = zext i8 %26 to i32
%call.i19.i = tail call i32 @__overflow(ptr noundef nonnull %27, i32 noundef %conv7.i) #5
br label %putchar_unlocked.exit23.i
cond.false.i21.i: ; preds = %while.body4.i
%incdec.ptr.i22.i = getelementptr inbounds i8, ptr %28, i64 1
store ptr %incdec.ptr.i22.i, ptr %_IO_write_ptr.i15.i, align 8, !tbaa !19
store i8 %26, ptr %28, align 1, !tbaa !16
br label %putchar_unlocked.exit23.i
putchar_unlocked.exit23.i: ; preds = %cond.false.i21.i, %cond.true.i18.i
%30 = and i64 %indvars.iv.next31.i, 4294967295
%tobool3.not.i = icmp eq i64 %30, 0
br i1 %tobool3.not.i, label %mypr.exit, label %while.body4.i, !llvm.loop !22
mypr.exit: ; preds = %putchar_unlocked.exit23.i, %cond.true.i.i52, %cond.false.i.i54
%cmp3150 = icmp sgt i32 %add.i, 1
br i1 %cmp3150, label %for.body4.preheader, label %for.end10
for.body4.preheader: ; preds = %mypr.exit
%wide.trip.count156 = zext i32 %add.i to i64
br label %for.body4
for.body4: ; preds = %for.body4.preheader, %mypr.exit92
%indvars.iv153 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next154, %mypr.exit92 ]
%31 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %31, i64 0, i32 5
%32 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !19
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %31, i64 0, i32 6
%33 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !20
%cmp.not.i = icmp ult ptr %32, %33
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %for.body4
%call.i = tail call i32 @__overflow(ptr noundef nonnull %31, i32 noundef 32) #5
br label %putchar_unlocked.exit
cond.false.i: ; preds = %for.body4
%incdec.ptr.i = getelementptr inbounds i8, ptr %32, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !19
store i8 32, ptr %32, align 1, !tbaa !16
br label %putchar_unlocked.exit
putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%arrayidx7 = getelementptr inbounds [500002 x i32], ptr @a, i64 0, i64 %indvars.iv153
%34 = load i32, ptr %arrayidx7, align 4, !tbaa !23
%tobool.not.i56 = icmp eq i32 %34, 0
br i1 %tobool.not.i56, label %if.then.i84, label %while.body.i57
if.then.i84: ; preds = %putchar_unlocked.exit
%35 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i.i85 = getelementptr inbounds %struct._IO_FILE, ptr %35, i64 0, i32 5
%36 = load ptr, ptr %_IO_write_ptr.i.i85, align 8, !tbaa !19
%_IO_write_end.i.i86 = getelementptr inbounds %struct._IO_FILE, ptr %35, i64 0, i32 6
%37 = load ptr, ptr %_IO_write_end.i.i86, align 8, !tbaa !20
%cmp.not.i.i87 = icmp ult ptr %36, %37
br i1 %cmp.not.i.i87, label %cond.false.i.i90, label %cond.true.i.i88, !prof !15
cond.true.i.i88: ; preds = %if.then.i84
%call.i.i89 = tail call i32 @__overflow(ptr noundef nonnull %35, i32 noundef 48) #5
br label %mypr.exit92
cond.false.i.i90: ; preds = %if.then.i84
%incdec.ptr.i.i91 = getelementptr inbounds i8, ptr %36, i64 1
store ptr %incdec.ptr.i.i91, ptr %_IO_write_ptr.i.i85, align 8, !tbaa !19
store i8 48, ptr %36, align 1, !tbaa !16
br label %mypr.exit92
while.body.i57: ; preds = %putchar_unlocked.exit, %while.body.i57
%indvars.iv28.i58 = phi i32 [ %indvars.iv.next29.i68, %while.body.i57 ], [ 1, %putchar_unlocked.exit ]
%indvars.iv.i59 = phi i64 [ %indvars.iv.next.i63, %while.body.i57 ], [ 0, %putchar_unlocked.exit ]
%n.addr.024.i60 = phi i32 [ %div.i65, %while.body.i57 ], [ %34, %putchar_unlocked.exit ]
%rem.i61 = srem i32 %n.addr.024.i60, 10
%38 = trunc i32 %rem.i61 to i8
%conv.i62 = add nsw i8 %38, 48
%indvars.iv.next.i63 = add nuw i64 %indvars.iv.i59, 1
%arrayidx.i64 = getelementptr inbounds [20 x i8], ptr @buf, i64 0, i64 %indvars.iv.i59
store i8 %conv.i62, ptr %arrayidx.i64, align 1, !tbaa !16
%div.i65 = sdiv i32 %n.addr.024.i60, 10
%n.addr.024.off.i66 = add i32 %n.addr.024.i60, 9
%tobool1.not.i67 = icmp ult i32 %n.addr.024.off.i66, 19
%indvars.iv.next29.i68 = add nuw i32 %indvars.iv28.i58, 1
br i1 %tobool1.not.i67, label %while.body4.preheader.i69, label %while.body.i57, !llvm.loop !21
while.body4.preheader.i69: ; preds = %while.body.i57
%39 = sext i32 %indvars.iv28.i58 to i64
br label %while.body4.i70
while.body4.i70: ; preds = %putchar_unlocked.exit23.i80, %while.body4.preheader.i69
%indvars.iv30.i71 = phi i64 [ %39, %while.body4.preheader.i69 ], [ %indvars.iv.next31.i72, %putchar_unlocked.exit23.i80 ]
%indvars.iv.next31.i72 = add nsw i64 %indvars.iv30.i71, -1
%arrayidx6.i73 = getelementptr inbounds [20 x i8], ptr @buf, i64 0, i64 %indvars.iv.next31.i72
%40 = load i8, ptr %arrayidx6.i73, align 1, !tbaa !16
%41 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i15.i74 = getelementptr inbounds %struct._IO_FILE, ptr %41, i64 0, i32 5
%42 = load ptr, ptr %_IO_write_ptr.i15.i74, align 8, !tbaa !19
%_IO_write_end.i16.i75 = getelementptr inbounds %struct._IO_FILE, ptr %41, i64 0, i32 6
%43 = load ptr, ptr %_IO_write_end.i16.i75, align 8, !tbaa !20
%cmp.not.i17.i76 = icmp ult ptr %42, %43
br i1 %cmp.not.i17.i76, label %cond.false.i21.i82, label %cond.true.i18.i77, !prof !15
cond.true.i18.i77: ; preds = %while.body4.i70
%conv7.i78 = zext i8 %40 to i32
%call.i19.i79 = tail call i32 @__overflow(ptr noundef nonnull %41, i32 noundef %conv7.i78) #5
br label %putchar_unlocked.exit23.i80
cond.false.i21.i82: ; preds = %while.body4.i70
%incdec.ptr.i22.i83 = getelementptr inbounds i8, ptr %42, i64 1
store ptr %incdec.ptr.i22.i83, ptr %_IO_write_ptr.i15.i74, align 8, !tbaa !19
store i8 %40, ptr %42, align 1, !tbaa !16
br label %putchar_unlocked.exit23.i80
putchar_unlocked.exit23.i80: ; preds = %cond.false.i21.i82, %cond.true.i18.i77
%44 = and i64 %indvars.iv.next31.i72, 4294967295
%tobool3.not.i81 = icmp eq i64 %44, 0
br i1 %tobool3.not.i81, label %mypr.exit92, label %while.body4.i70, !llvm.loop !22
mypr.exit92: ; preds = %putchar_unlocked.exit23.i80, %cond.true.i.i88, %cond.false.i.i90
%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.end10, label %for.body4, !llvm.loop !26
for.end10: ; preds = %mypr.exit92, %mypr.exit
%45 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i93 = getelementptr inbounds %struct._IO_FILE, ptr %45, i64 0, i32 5
%46 = load ptr, ptr %_IO_write_ptr.i93, align 8, !tbaa !19
%_IO_write_end.i94 = getelementptr inbounds %struct._IO_FILE, ptr %45, i64 0, i32 6
%47 = load ptr, ptr %_IO_write_end.i94, align 8, !tbaa !20
%cmp.not.i95 = icmp ult ptr %46, %47
br i1 %cmp.not.i95, label %cond.false.i99, label %cond.true.i96, !prof !15
cond.true.i96: ; preds = %for.end10
%call.i97 = tail call i32 @__overflow(ptr noundef nonnull %45, i32 noundef 10) #5
br label %putchar_unlocked.exit101
cond.false.i99: ; preds = %for.end10
%incdec.ptr.i100 = getelementptr inbounds i8, ptr %46, i64 1
store ptr %incdec.ptr.i100, ptr %_IO_write_ptr.i93, align 8, !tbaa !19
store i8 10, ptr %46, align 1, !tbaa !16
br label %putchar_unlocked.exit101
putchar_unlocked.exit101: ; preds = %cond.true.i96, %cond.false.i99
%48 = load i32, ptr @cnt, align 4, !tbaa !23
%tobool.not.i102 = icmp eq i32 %48, 0
br i1 %tobool.not.i102, label %if.then.i130, label %while.body.i103
if.then.i130: ; preds = %putchar_unlocked.exit101
%49 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i.i131 = getelementptr inbounds %struct._IO_FILE, ptr %49, i64 0, i32 5
%50 = load ptr, ptr %_IO_write_ptr.i.i131, align 8, !tbaa !19
%_IO_write_end.i.i132 = getelementptr inbounds %struct._IO_FILE, ptr %49, i64 0, i32 6
%51 = load ptr, ptr %_IO_write_end.i.i132, align 8, !tbaa !20
%cmp.not.i.i133 = icmp ult ptr %50, %51
br i1 %cmp.not.i.i133, label %cond.false.i.i136, label %cond.true.i.i134, !prof !15
cond.true.i.i134: ; preds = %if.then.i130
%call.i.i135 = tail call i32 @__overflow(ptr noundef nonnull %49, i32 noundef 48) #5
br label %mypr.exit138
cond.false.i.i136: ; preds = %if.then.i130
%incdec.ptr.i.i137 = getelementptr inbounds i8, ptr %50, i64 1
store ptr %incdec.ptr.i.i137, ptr %_IO_write_ptr.i.i131, align 8, !tbaa !19
store i8 48, ptr %50, align 1, !tbaa !16
br label %mypr.exit138
while.body.i103: ; preds = %putchar_unlocked.exit101, %while.body.i103
%indvars.iv28.i104 = phi i32 [ %indvars.iv.next29.i114, %while.body.i103 ], [ 1, %putchar_unlocked.exit101 ]
%indvars.iv.i105 = phi i64 [ %indvars.iv.next.i109, %while.body.i103 ], [ 0, %putchar_unlocked.exit101 ]
%n.addr.024.i106 = phi i32 [ %div.i111, %while.body.i103 ], [ %48, %putchar_unlocked.exit101 ]
%rem.i107 = srem i32 %n.addr.024.i106, 10
%52 = trunc i32 %rem.i107 to i8
%conv.i108 = add nsw i8 %52, 48
%indvars.iv.next.i109 = add nuw i64 %indvars.iv.i105, 1
%arrayidx.i110 = getelementptr inbounds [20 x i8], ptr @buf, i64 0, i64 %indvars.iv.i105
store i8 %conv.i108, ptr %arrayidx.i110, align 1, !tbaa !16
%div.i111 = sdiv i32 %n.addr.024.i106, 10
%n.addr.024.off.i112 = add i32 %n.addr.024.i106, 9
%tobool1.not.i113 = icmp ult i32 %n.addr.024.off.i112, 19
%indvars.iv.next29.i114 = add nuw i32 %indvars.iv28.i104, 1
br i1 %tobool1.not.i113, label %while.body4.preheader.i115, label %while.body.i103, !llvm.loop !21
while.body4.preheader.i115: ; preds = %while.body.i103
%53 = sext i32 %indvars.iv28.i104 to i64
br label %while.body4.i116
while.body4.i116: ; preds = %putchar_unlocked.exit23.i126, %while.body4.preheader.i115
%indvars.iv30.i117 = phi i64 [ %53, %while.body4.preheader.i115 ], [ %indvars.iv.next31.i118, %putchar_unlocked.exit23.i126 ]
%indvars.iv.next31.i118 = add nsw i64 %indvars.iv30.i117, -1
%arrayidx6.i119 = getelementptr inbounds [20 x i8], ptr @buf, i64 0, i64 %indvars.iv.next31.i118
%54 = load i8, ptr %arrayidx6.i119, align 1, !tbaa !16
%55 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i15.i120 = getelementptr inbounds %struct._IO_FILE, ptr %55, i64 0, i32 5
%56 = load ptr, ptr %_IO_write_ptr.i15.i120, align 8, !tbaa !19
%_IO_write_end.i16.i121 = getelementptr inbounds %struct._IO_FILE, ptr %55, i64 0, i32 6
%57 = load ptr, ptr %_IO_write_end.i16.i121, align 8, !tbaa !20
%cmp.not.i17.i122 = icmp ult ptr %56, %57
br i1 %cmp.not.i17.i122, label %cond.false.i21.i128, label %cond.true.i18.i123, !prof !15
cond.true.i18.i123: ; preds = %while.body4.i116
%conv7.i124 = zext i8 %54 to i32
%call.i19.i125 = tail call i32 @__overflow(ptr noundef nonnull %55, i32 noundef %conv7.i124) #5
br label %putchar_unlocked.exit23.i126
cond.false.i21.i128: ; preds = %while.body4.i116
%incdec.ptr.i22.i129 = getelementptr inbounds i8, ptr %56, i64 1
store ptr %incdec.ptr.i22.i129, ptr %_IO_write_ptr.i15.i120, align 8, !tbaa !19
store i8 %54, ptr %56, align 1, !tbaa !16
br label %putchar_unlocked.exit23.i126
putchar_unlocked.exit23.i126: ; preds = %cond.false.i21.i128, %cond.true.i18.i123
%58 = and i64 %indvars.iv.next31.i118, 4294967295
%tobool3.not.i127 = icmp eq i64 %58, 0
br i1 %tobool3.not.i127, label %mypr.exit138, label %while.body4.i116, !llvm.loop !22
mypr.exit138: ; preds = %putchar_unlocked.exit23.i126, %cond.true.i.i134, %cond.false.i.i136
%59 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i139 = getelementptr inbounds %struct._IO_FILE, ptr %59, i64 0, i32 5
%60 = load ptr, ptr %_IO_write_ptr.i139, align 8, !tbaa !19
%_IO_write_end.i140 = getelementptr inbounds %struct._IO_FILE, ptr %59, i64 0, i32 6
%61 = load ptr, ptr %_IO_write_end.i140, align 8, !tbaa !20
%cmp.not.i141 = icmp ult ptr %60, %61
br i1 %cmp.not.i141, label %cond.false.i145, label %cond.true.i142, !prof !15
cond.true.i142: ; preds = %mypr.exit138
%call.i143 = tail call i32 @__overflow(ptr noundef nonnull %59, i32 noundef 10) #5
br label %putchar_unlocked.exit147
cond.false.i145: ; preds = %mypr.exit138
%incdec.ptr.i146 = getelementptr inbounds i8, ptr %60, i64 1
store ptr %incdec.ptr.i146, ptr %_IO_write_ptr.i139, align 8, !tbaa !19
store i8 10, ptr %60, align 1, !tbaa !16
br label %putchar_unlocked.exit147
putchar_unlocked.exit147: ; preds = %cond.true.i142, %cond.false.i145
ret i32 0
}
declare i32 @__uflow(ptr noundef) local_unnamed_addr #3
declare i32 @__overflow(ptr noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!10, !6, i64 8}
!10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!"branch_weights", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!10, !6, i64 40}
!20 = !{!10, !6, i64 48}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = !{!11, !11, i64 0}
!24 = distinct !{!24, !18}
!25 = distinct !{!25, !18}
!26 = distinct !{!26, !18}
|
#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000
int L[MAX/2+2];
int R[MAX/2+2];
int count;
void merge(int A[],int n,int left,int mid,int right){
int n1=0,n2=0,i,j,k;
n1=mid-left;
n2=right-mid;
for(i=0;i<n1;i++){
L[i]=A[left+i];
}
for(i=0;i<n2;i++){
R[i]=A[mid+i];
}
L[n1]=SENTINEL;
R[n2]=SENTINEL;
i=0;
j=0;
for(k=left;k<right;k++){
count++;
if(L[i]<+R[j]){
A[k]=L[i++];
}
else{
A[k]=R[j++];
}
}
}
void mergeSort(int A[],int n,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergeSort(A,n,left,mid);
mergeSort(A,n,mid,right);
merge(A,n,left,mid,right);
}
}
int main(){
int n,i,A[MAX];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
mergeSort(A,n,0,n);
for(i=0;i<n;i++){
if(i>0)printf(" ");
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148020/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148020/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A88 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp65 = icmp sgt i32 %sub, 0
br i1 %cmp65, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader106, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A88
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader106
for.body.preheader106: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%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.preheader106, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader106 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader106 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader106
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader106 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp567 = icmp sgt i32 %sub1, 0
br i1 %cmp567, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count79 = zext i32 %sub1 to i64
%invariant.gep86 = getelementptr i32, ptr %A, i64 %13
%min.iters.check94 = icmp ult i32 %sub1, 12
br i1 %min.iters.check94, label %for.body6.preheader105, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A88
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check91 = icmp ult i64 %16, 32
br i1 %diff.check91, label %for.body6.preheader105, label %vector.ph95
vector.ph95: ; preds = %vector.memcheck90
%n.vec97 = and i64 %wide.trip.count79, 4294967288
br label %vector.body100
vector.body100: ; preds = %vector.body100, %vector.ph95
%index101 = phi i64 [ 0, %vector.ph95 ], [ %index.next104, %vector.body100 ]
%17 = getelementptr i32, ptr %invariant.gep86, i64 %index101
%wide.load102 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load103 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index101
store <4 x i32> %wide.load102, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load103, ptr %20, align 16, !tbaa !5
%index.next104 = add nuw i64 %index101, 8
%21 = icmp eq i64 %index.next104, %n.vec97
br i1 %21, label %middle.block92, label %vector.body100, !llvm.loop !15
middle.block92: ; preds = %vector.body100
%cmp.n99 = icmp eq i64 %n.vec97, %wide.trip.count79
br i1 %cmp.n99, label %for.end14, label %for.body6.preheader105
for.body6.preheader105: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block92
%indvars.iv75.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec97, %middle.block92 ]
%22 = xor i64 %indvars.iv75.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79
%xtraiter107 = and i64 %wide.trip.count79, 3
%lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
br i1 %lcmp.mod108.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader105, %for.body6.prol
%indvars.iv75.prol = phi i64 [ %indvars.iv.next76.prol, %for.body6.prol ], [ %indvars.iv75.ph, %for.body6.preheader105 ]
%prol.iter109 = phi i64 [ %prol.iter109.next, %for.body6.prol ], [ 0, %for.body6.preheader105 ]
%gep87.prol = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75.prol
%24 = load i32, ptr %gep87.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next76.prol = add nuw nsw i64 %indvars.iv75.prol, 1
%prol.iter109.next = add i64 %prol.iter109, 1
%prol.iter109.cmp.not = icmp eq i64 %prol.iter109.next, %xtraiter107
br i1 %prol.iter109.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader105
%indvars.iv75.unr = phi i64 [ %indvars.iv75.ph, %for.body6.preheader105 ], [ %indvars.iv.next76.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !17
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv75 = phi i64 [ %indvars.iv.next76.3, %for.body6 ], [ %indvars.iv75.unr, %for.body6.prol.loopexit ]
%gep87 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75
%30 = load i32, ptr %gep87, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%gep87.1 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76
%31 = load i32, ptr %gep87.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%gep87.2 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.1
%32 = load i32, ptr %gep87.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next76.2 = add nuw nsw i64 %indvars.iv75, 3
%gep87.3 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.2
%33 = load i32, ptr %gep87.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next76.3 = add nuw nsw i64 %indvars.iv75, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next76.3, %wide.trip.count79
br i1 %exitcond80.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block92, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2069 = icmp slt i32 %left, %right
br i1 %cmp2069, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count84 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv81 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next82, %for.body21 ]
%j.071 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.270 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.270 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.071 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27 = icmp slt i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc28 = zext i1 %cmp27 to i32
%i.3 = add nuw nsw i32 %i.270, %inc28
%not.cmp27 = xor i1 %cmp27, true
%inc33 = zext i1 %not.cmp27 to i32
%j.1 = add nuw nsw i32 %j.071, %inc33
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81
store i32 %.sink, ptr %38, align 4
%indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end40, label %for.body21, !llvm.loop !19
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A14 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp65.i = icmp sgt i32 %sub.i, 0
br i1 %cmp65.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A14
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load15 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load15, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp567.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp567.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count79.i = zext i32 %sub1.i to i64
%invariant.gep86.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check20 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check20, label %for.body6.i.preheader, label %vector.memcheck16
vector.memcheck16: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A14
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check17 = icmp ult i64 %16, 32
br i1 %diff.check17, label %for.body6.i.preheader, label %vector.ph21
vector.ph21: ; preds = %vector.memcheck16
%n.vec23 = and i64 %wide.trip.count79.i, 4294967288
br label %vector.body26
vector.body26: ; preds = %vector.body26, %vector.ph21
%index27 = phi i64 [ 0, %vector.ph21 ], [ %index.next30, %vector.body26 ]
%17 = getelementptr i32, ptr %invariant.gep86.i, i64 %index27
%wide.load28 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load29 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index27
store <4 x i32> %wide.load28, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load29, ptr %20, align 16, !tbaa !5
%index.next30 = add nuw i64 %index27, 8
%21 = icmp eq i64 %index.next30, %n.vec23
br i1 %21, label %middle.block18, label %vector.body26, !llvm.loop !22
middle.block18: ; preds = %vector.body26
%cmp.n25 = icmp eq i64 %n.vec23, %wide.trip.count79.i
br i1 %cmp.n25, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck16, %for.body6.preheader.i, %middle.block18
%indvars.iv75.i.ph = phi i64 [ 0, %vector.memcheck16 ], [ 0, %for.body6.preheader.i ], [ %n.vec23, %middle.block18 ]
%22 = xor i64 %indvars.iv75.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79.i
%xtraiter31 = and i64 %wide.trip.count79.i, 3
%lcmp.mod32.not = icmp eq i64 %xtraiter31, 0
br i1 %lcmp.mod32.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv75.i.prol = phi i64 [ %indvars.iv.next76.i.prol, %for.body6.i.prol ], [ %indvars.iv75.i.ph, %for.body6.i.preheader ]
%prol.iter33 = phi i64 [ %prol.iter33.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep87.i.prol = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i.prol
%24 = load i32, ptr %gep87.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next76.i.prol = add nuw nsw i64 %indvars.iv75.i.prol, 1
%prol.iter33.next = add i64 %prol.iter33, 1
%prol.iter33.cmp.not = icmp eq i64 %prol.iter33.next, %xtraiter31
br i1 %prol.iter33.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !23
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv75.i.unr = phi i64 [ %indvars.iv75.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next76.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !24
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i.3, %for.body6.i ], [ %indvars.iv75.i.unr, %for.body6.i.prol.loopexit ]
%gep87.i = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i
%30 = load i32, ptr %gep87.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%gep87.i.1 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i
%31 = load i32, ptr %gep87.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next76.i.1 = add nuw nsw i64 %indvars.iv75.i, 2
%gep87.i.2 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.1
%32 = load i32, ptr %gep87.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next76.i.2 = add nuw nsw i64 %indvars.iv75.i, 3
%gep87.i.3 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.2
%33 = load i32, ptr %gep87.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next76.i.3 = add nuw nsw i64 %indvars.iv75.i, 4
%exitcond80.not.i.3 = icmp eq i64 %indvars.iv.next76.i.3, %wide.trip.count79.i
br i1 %exitcond80.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !25
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block18, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count84.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv81.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next82.i, %for.body21.i ]
%j.071.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%i.270.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.270.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.071.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.i = icmp slt i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc28.i = zext i1 %cmp27.i to i32
%i.3.i = add nuw nsw i32 %i.270.i, %inc28.i
%not.cmp27.i = xor i1 %cmp27.i, true
%inc33.i = zext i1 %not.cmp27.i to i32
%j.1.i = add nuw nsw i32 %j.071.i, %inc33.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next82.i = add nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %wide.trip.count84.i
br i1 %exitcond85.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 0
br i1 %cmp324, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %if.end ], [ 1, %if.end.peel ]
%putchar21 = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv28
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next29, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !27
for.end12: ; preds = %if.end, %if.end.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !28}
!28 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
int count = 0;
int L[500000];
int R[500000];
void merge(int *A,int left ,int mid ,int right){
int n1,n2,i,j,k;
n1 = mid - left;
n2 = right - mid;
for(i=0;i < n1; i++){
L[i] = A[left + i];
}
for(i=0;i < n2; i++){
R[i] = A[mid + i];
}
L[n1] = 1000000000;
R[n2] = 1000000000;
i=0;
j=0;
for(k = left ; k < right ; k++){
if(L[i]<= R[j]){
A[k]=L[i];
i = i+1;
count++;
}
else{
A[k]=R[j];
j=j+1;
count++;
}
}
}
void mergeSort(int *A,int left ,int right){
int mid;
if((left + 1) < right){
mid = (left + right) / 2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid ,right);
}
}
int main(){
int n,i,left,right;
int S[500000];
scanf("%d",&n);
for(i = 0;i < n;i++){
scanf("%d",&S[i]);
}
left = 0;
right = n;
mergeSort(S,left,right);
for(i = 0;i < n;i++){
printf("%d",S[i]);
if(i+1 != n)
printf(" ");
}
printf("\n%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148064/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148064/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@L = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A91 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp68 = icmp sgt i32 %sub, 0
br i1 %cmp68, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader109, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A91
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader109, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load92 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load92, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader109
for.body.preheader109: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%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.preheader109, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader109 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader109 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader109
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader109 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp570 = icmp sgt i32 %sub1, 0
br i1 %cmp570, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count82 = zext i32 %sub1 to i64
%invariant.gep89 = getelementptr i32, ptr %A, i64 %13
%min.iters.check97 = icmp ult i32 %sub1, 12
br i1 %min.iters.check97, label %for.body6.preheader108, label %vector.memcheck93
vector.memcheck93: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A91
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check94 = icmp ult i64 %16, 32
br i1 %diff.check94, label %for.body6.preheader108, label %vector.ph98
vector.ph98: ; preds = %vector.memcheck93
%n.vec100 = and i64 %wide.trip.count82, 4294967288
br label %vector.body103
vector.body103: ; preds = %vector.body103, %vector.ph98
%index104 = phi i64 [ 0, %vector.ph98 ], [ %index.next107, %vector.body103 ]
%17 = getelementptr i32, ptr %invariant.gep89, i64 %index104
%wide.load105 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load106 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %index104
store <4 x i32> %wide.load105, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load106, ptr %20, align 16, !tbaa !5
%index.next107 = add nuw i64 %index104, 8
%21 = icmp eq i64 %index.next107, %n.vec100
br i1 %21, label %middle.block95, label %vector.body103, !llvm.loop !15
middle.block95: ; preds = %vector.body103
%cmp.n102 = icmp eq i64 %n.vec100, %wide.trip.count82
br i1 %cmp.n102, label %for.end14, label %for.body6.preheader108
for.body6.preheader108: ; preds = %vector.memcheck93, %for.body6.preheader, %middle.block95
%indvars.iv78.ph = phi i64 [ 0, %vector.memcheck93 ], [ 0, %for.body6.preheader ], [ %n.vec100, %middle.block95 ]
%22 = xor i64 %indvars.iv78.ph, -1
%23 = add nsw i64 %22, %wide.trip.count82
%xtraiter110 = and i64 %wide.trip.count82, 3
%lcmp.mod111.not = icmp eq i64 %xtraiter110, 0
br i1 %lcmp.mod111.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader108, %for.body6.prol
%indvars.iv78.prol = phi i64 [ %indvars.iv.next79.prol, %for.body6.prol ], [ %indvars.iv78.ph, %for.body6.preheader108 ]
%prol.iter112 = phi i64 [ %prol.iter112.next, %for.body6.prol ], [ 0, %for.body6.preheader108 ]
%gep90.prol = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv78.prol
%24 = load i32, ptr %gep90.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv78.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next79.prol = add nuw nsw i64 %indvars.iv78.prol, 1
%prol.iter112.next = add i64 %prol.iter112, 1
%prol.iter112.cmp.not = icmp eq i64 %prol.iter112.next, %xtraiter110
br i1 %prol.iter112.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader108
%indvars.iv78.unr = phi i64 [ %indvars.iv78.ph, %for.body6.preheader108 ], [ %indvars.iv.next79.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !17
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv78 = phi i64 [ %indvars.iv.next79.3, %for.body6 ], [ %indvars.iv78.unr, %for.body6.prol.loopexit ]
%gep90 = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv78
%30 = load i32, ptr %gep90, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv78
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%gep90.1 = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv.next79
%31 = load i32, ptr %gep90.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next79
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next79.1 = add nuw nsw i64 %indvars.iv78, 2
%gep90.2 = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv.next79.1
%32 = load i32, ptr %gep90.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next79.2 = add nuw nsw i64 %indvars.iv78, 3
%gep90.3 = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv.next79.2
%33 = load i32, ptr %gep90.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next79.3 = add nuw nsw i64 %indvars.iv78, 4
%exitcond83.not.3 = icmp eq i64 %indvars.iv.next79.3, %wide.trip.count82
br i1 %exitcond83.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block95, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 1000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 1000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2072 = icmp slt i32 %left, %right
br i1 %cmp2072, label %for.body21.preheader, label %for.end41
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count87 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv84 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next85, %for.body21 ]
%j.074 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.273 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%idxprom22 = zext i32 %i.273 to i64
%arrayidx23 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom22
%35 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = zext i32 %j.074 to i64
%arrayidx25 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom24
%36 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.not = icmp sle i32 %35, %36
%.sink = tail call i32 @llvm.smin.i32(i32 %35, i32 %36)
%add31 = zext i1 %cmp26.not to i32
%i.3 = add nuw nsw i32 %i.273, %add31
%not.cmp26.not = xor i1 %cmp26.not, true
%add37 = zext i1 %not.cmp26.not to i32
%j.1 = add nuw nsw i32 %j.074, %add37
%37 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv84
store i32 %.sink, ptr %37, align 4
%storemerge.in = load i32, ptr @count, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @count, align 4, !tbaa !5
%indvars.iv.next85 = add nsw i64 %indvars.iv84, 1
%exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
br i1 %exitcond88.not, label %for.end41, label %for.body21, !llvm.loop !19
for.end41: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A12 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp68.i = icmp sgt i32 %sub.i, 0
br i1 %cmp68.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp570.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp570.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count82.i = zext i32 %sub1.i to i64
%invariant.gep89.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count82.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep89.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !22
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count82.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv78.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv78.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count82.i
%xtraiter29 = and i64 %wide.trip.count82.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv78.i.prol = phi i64 [ %indvars.iv.next79.i.prol, %for.body6.i.prol ], [ %indvars.iv78.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep90.i.prol = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv78.i.prol
%24 = load i32, ptr %gep90.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv78.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next79.i.prol = add nuw nsw i64 %indvars.iv78.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !23
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv78.i.unr = phi i64 [ %indvars.iv78.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next79.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !24
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv78.i = phi i64 [ %indvars.iv.next79.i.3, %for.body6.i ], [ %indvars.iv78.i.unr, %for.body6.i.prol.loopexit ]
%gep90.i = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv78.i
%30 = load i32, ptr %gep90.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv78.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next79.i = add nuw nsw i64 %indvars.iv78.i, 1
%gep90.i.1 = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i
%31 = load i32, ptr %gep90.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next79.i.1 = add nuw nsw i64 %indvars.iv78.i, 2
%gep90.i.2 = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i.1
%32 = load i32, ptr %gep90.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next79.i.2 = add nuw nsw i64 %indvars.iv78.i, 3
%gep90.i.3 = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i.2
%33 = load i32, ptr %gep90.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next79.i.3 = add nuw nsw i64 %indvars.iv78.i, 4
%exitcond83.not.i.3 = icmp eq i64 %indvars.iv.next79.i.3, %wide.trip.count82.i
br i1 %exitcond83.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !25
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 1000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 1000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count87.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv84.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next85.i, %for.body21.i ]
%j.074.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%i.273.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%idxprom22.i = zext i32 %i.273.i to i64
%arrayidx23.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom22.i
%35 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%idxprom24.i = zext i32 %j.074.i to i64
%arrayidx25.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom24.i
%36 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%cmp26.not.i = icmp sle i32 %35, %36
%.sink.i = tail call i32 @llvm.smin.i32(i32 %35, i32 %36)
%add31.i = zext i1 %cmp26.not.i to i32
%i.3.i = add nuw nsw i32 %i.273.i, %add31.i
%not.cmp26.not.i = xor i1 %cmp26.not.i, true
%add37.i = zext i1 %not.cmp26.not.i to i32
%j.1.i = add nuw nsw i32 %j.074.i, %add37.i
%37 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv84.i
store i32 %.sink.i, ptr %37, align 4
%storemerge.in.i = load i32, ptr @count, align 4, !tbaa !5
%storemerge.i = add nsw i32 %storemerge.in.i, 1
store i32 %storemerge.i, ptr @count, align 4, !tbaa !5
%indvars.iv.next85.i = add nsw i64 %indvars.iv84.i, 1
%exitcond88.not.i = icmp eq i64 %indvars.iv.next85.i, %wide.trip.count87.i
br i1 %exitcond88.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%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 ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = zext i32 %5 to i64
%cmp8.not = icmp eq i64 %indvars.iv.next27, %6
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !27
for.end12: ; preds = %for.inc10, %for.end
%9 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
|
#include<stdio.h>
#define MAX 500000
int count;
void merge(int left,int mid,int right,int A[]){
int i,j=0,k;
int n1 = mid-left;
int n2 = right-mid;
int L[n1],R[n2];
for(i = 0;i<n1;i++)L[i]=A[left+i];
for(i = 0;i<n2;i++)R[i]=A[mid+i];
L[n1]=R[n2]=999999999;
i=0;
for(k = left;k< right;k++){
count++;
if(L[i]<=R[j])A[k]=L[i++];
else A[k]=R[j++];
}
}
void mergeSort(int left,int right,int A[]){
if(left >= right-1 )return;
int mid = (left+right)/2;
mergeSort(left,mid,A);
mergeSort(mid,right,A);
merge(left,mid,right,A);
}
int main (void){
int size,A[MAX];
int i;
scanf("%d",&size);
for(i = 0;i<size;i++)scanf("%d",&A[i]);
mergeSort(0,size,A);
for(i = 0;i<size;i++){
if(i==0)printf("%d",A[i]);
else printf(" %d",A[i]);
}
printf("\n%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148114/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148114/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(i32 noundef %left, i32 noundef %mid, i32 noundef %right, ptr nocapture noundef %A) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%0 = zext i32 %sub to i64
%vla = alloca i32, i64 %0, align 16
%1 = zext i32 %sub1 to i64
%vla2 = alloca i32, i64 %1, align 16
%cmp68 = icmp sgt i32 %sub, 0
br i1 %cmp68, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %A, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body.preheader, %entry
%cmp670 = icmp sgt i32 %sub1, 0
br i1 %cmp670, label %for.body7.preheader, label %for.end15
for.body7.preheader: ; preds = %for.cond5.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep78 = getelementptr i8, ptr %A, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla2, ptr noundef nonnull align 4 dereferenceable(1) %scevgep78, i64 %15, i1 false), !tbaa !5
br label %for.end15
for.end15: ; preds = %for.body7.preheader, %for.cond5.preheader
%idxprom16 = sext i32 %sub1 to i64
%arrayidx17 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom16
store i32 999999999, ptr %arrayidx17, align 4, !tbaa !5
%idxprom18 = sext i32 %sub to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %idxprom18
store i32 999999999, ptr %arrayidx19, align 4, !tbaa !5
%cmp2172 = icmp slt i32 %left, %right
br i1 %cmp2172, label %for.body22.preheader, label %for.end41
for.body22.preheader: ; preds = %for.end15
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body22
for.body22: ; preds = %for.body22.preheader, %for.body22
%indvars.iv = phi i64 [ %16, %for.body22.preheader ], [ %indvars.iv.next, %for.body22 ]
%i.275 = phi i32 [ 0, %for.body22.preheader ], [ %i.3, %for.body22 ]
%j.074 = phi i32 [ 0, %for.body22.preheader ], [ %j.1, %for.body22 ]
%17 = load i32, ptr @count, align 4, !tbaa !5
%inc23 = add nsw i32 %17, 1
store i32 %inc23, ptr @count, align 4, !tbaa !5
%idxprom24 = zext i32 %i.275 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %vla, i64 %idxprom24
%18 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = zext i32 %j.074 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom26
%19 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28.not = icmp sgt i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc34 = zext i1 %cmp28.not to i32
%j.1 = add nuw nsw i32 %j.074, %inc34
%not.cmp28.not = xor i1 %cmp28.not, true
%inc29 = zext i1 %not.cmp28.not to i32
%i.3 = add nuw nsw i32 %i.275, %inc29
%20 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end41, label %for.body22, !llvm.loop !9
for.end41: ; preds = %for.body22, %for.end15
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(i32 noundef %left, i32 noundef %right, ptr noundef %A) local_unnamed_addr #0 {
entry:
%sub = add nsw i32 %right, -1
%cmp.not = icmp sgt i32 %sub, %left
br i1 %cmp.not, label %if.end, label %common.ret11
common.ret11: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%add = add nsw i32 %right, %left
%div = sdiv i32 %add, 2
tail call void @mergeSort(i32 noundef %left, i32 noundef %div, ptr noundef %A)
tail call void @mergeSort(i32 noundef %div, i32 noundef %right, ptr noundef %A)
tail call void @merge(i32 noundef %left, i32 noundef %div, i32 noundef %right, ptr noundef %A)
br label %common.ret11
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%size = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %size) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %size)
%0 = load i32, ptr %size, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %size, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(i32 noundef 0, i32 noundef %.lcssa, ptr noundef nonnull %A)
%3 = load i32, ptr %size, align 4, !tbaa !5
%cmp325 = icmp sgt i32 %3, 0
br i1 %cmp325, label %for.inc12.peel, label %for.end14
for.inc12.peel: ; preds = %for.end
%4 = load i32, ptr %A, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%.pre = load i32, ptr %size, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %.pre, 1
br i1 %cmp3.peel, label %for.inc12, label %for.end14
for.inc12: ; preds = %for.inc12.peel, %for.inc12
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.inc12 ], [ 1, %for.inc12.peel ]
%arrayidx10 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv29
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%.pre33 = load i32, ptr %size, align 4, !tbaa !5
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%6 = sext i32 %.pre33 to i64
%cmp3 = icmp slt i64 %indvars.iv.next30, %6
br i1 %cmp3, label %for.inc12, label %for.end14, !llvm.loop !12
for.end14: ; preds = %for.inc12, %for.inc12.peel, %for.end
%7 = load i32, ptr @count, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %size) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int main(void) {
int t, i, n, j, a[4], k, p;
scanf("%d", &t);
for (i = 0; i < t; i++) {
scanf("%d", &n);
for (k = 0, j = 0, p = 1; n; j++, p *= 10) {
if (n % 10)
a[k++] = n % 10 * p;
n /= 10;
}
printf("%d\n", k);
for (j = 0; j < k; j++)
printf("%d ", a[j]);
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14818/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14818/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.end21
for.body: ; preds = %entry, %for.end17
%i.035 = phi i32 [ %inc20, %for.end17 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%tobool.not29 = icmp eq i32 %.pr, 0
br i1 %tobool.not29, label %for.end.thread, label %for.body3
for.end.thread: ; preds = %for.body
%call838 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
br label %for.end17
for.body3: ; preds = %for.body, %if.end
%p.031 = phi i32 [ %mul7, %if.end ], [ 1, %for.body ]
%k.030 = phi i32 [ %k.1, %if.end ], [ 0, %for.body ]
%1 = phi i32 [ %div, %if.end ], [ %.pr, %for.body ]
%rem = srem i32 %1, 10
%div = sdiv i32 %1, 10
%tobool4.not = icmp eq i32 %rem, 0
br i1 %tobool4.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%mul = mul nsw i32 %p.031, %rem
%inc = add nsw i32 %k.030, 1
%idxprom = sext i32 %k.030 to i64
%arrayidx = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 %idxprom
store i32 %mul, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body3
%k.1 = phi i32 [ %inc, %if.then ], [ %k.030, %for.body3 ]
%mul7 = mul nsw i32 %p.031, 10
%.off = add i32 %1, 9
%tobool.not = icmp ult i32 %.off, 19
br i1 %tobool.not, label %for.end, label %for.body3, !llvm.loop !9
for.end: ; preds = %if.end
store i32 %div, ptr %n, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.1)
%cmp1032 = icmp sgt i32 %k.1, 0
br i1 %cmp1032, label %for.body11.preheader, label %for.end17
for.body11.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %k.1 to i64
br label %for.body11
for.body11: ; preds = %for.body11.preheader, %for.body11
%indvars.iv = phi i64 [ 0, %for.body11.preheader ], [ %indvars.iv.next, %for.body11 ]
%arrayidx13 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end17, label %for.body11, !llvm.loop !11
for.end17: ; preds = %for.body11, %for.end.thread, %for.end
%putchar = call i32 @putchar(i32 10)
%inc20 = add nuw nsw i32 %i.035, 1
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc20, %3
br i1 %cmp, label %for.body, label %for.end21, !llvm.loop !12
for.end21: ; preds = %for.end17, %entry
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; 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>
#define MAX 500000
int count=0;
void merge(int *A,int left,int mid,int right){//leftからrightまでのAを昇順に入れ直す
int n1 = mid - left;//左大きさ
int n2 = right - mid;//右大きさ
int i,j,k;
int L[n1+1];//左の配列
int R[n2+1];//右の配列
//初期化
for (i = 0;i< n1;i++)L[i] = A[left + i];
for (i = 0;i< n2;i++)R[i] = A[mid + i];
L[n1] = 1000000001;//番兵
R[n2] = 1000000001;
i = 0;
j = 0;
for (k = left;k<right;k++){//LとRの要素をうまいこと、昇順にAに入れ直す
count++;
if (L[i] <= R[j]){
A[k] = L[i];
i++;
}
else{
A[k] = R[j];
j++;
}
}
}
void mergeSort(int *A,int left,int right){//グループに半分ずつ分けて,mergeにわたす
int mid;
if (left+1 < right){
mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
int main()
{
int i;
int n;
int B;
int A[MAX];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
mergeSort(A,0,n);//初めは配列、左、右の番号
for(i=0;i<n;i++){
if(i)printf(" ");
printf("%d",A[i]);
}
printf("\n%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148237/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148237/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp72 = icmp sgt i32 %sub, 0
br i1 %cmp72, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %A, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp874 = icmp sgt i32 %sub1, 0
br i1 %cmp874, label %for.body9.preheader, label %for.end17
for.body9.preheader: ; preds = %for.cond7.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep82 = getelementptr i8, ptr %A, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep82, i64 %15, i1 false), !tbaa !5
br label %for.end17
for.end17: ; preds = %for.body9.preheader, %for.cond7.preheader
%idxprom18 = sext i32 %sub to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %idxprom18
store i32 1000000001, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %sub1 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom20
store i32 1000000001, ptr %arrayidx21, align 4, !tbaa !5
%cmp2376 = icmp slt i32 %left, %right
br i1 %cmp2376, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.end17
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %16, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%i.279 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%j.078 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%17 = load i32, ptr @count, align 4, !tbaa !5
%inc25 = add nsw i32 %17, 1
store i32 %inc25, ptr @count, align 4, !tbaa !5
%idxprom26 = zext i32 %i.279 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %idxprom26
%18 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%idxprom28 = zext i32 %j.078 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom28
%19 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.not = icmp sgt i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc40 = zext i1 %cmp30.not to i32
%j.1 = add nuw nsw i32 %j.078, %inc40
%not.cmp30.not = xor i1 %cmp30.not, true
%inc35 = zext i1 %not.cmp30.not to i32
%i.3 = add nuw nsw i32 %i.279, %inc35
%20 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end43, label %for.body24, !llvm.loop !9
for.end43: ; preds = %for.body24, %for.end17
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp321 = icmp sgt i32 %3, 0
br i1 %cmp321, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv25 = phi i64 [ %indvars.iv.next26, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv25
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next26, %7
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !12
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @count, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
#define MAX 500000
#define SEN 2000000000
void merge(int *,int,int,int,int);
void mergeSort(int *,int,int,int);
int L[MAX/2+2],R[MAX/2+2],count;
int main(){
int H[MAX],n,i;
count=0;
scanf("%d",&n);
for(i=0;i <= n-1;i++){
scanf("%d",&H[i]);
}
mergeSort(H,n,0,n);
for(i=0;i <= n-1;i++){
if(i>0)printf(" ");
printf("%d",H[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
void merge(int *H,int n,int l,int m,int r){
int n1,n2,i,j,k;
n1=m-l;
n2=r-m;
for(i=0;i<n1;i++){
L[i]=H[l+i];
}
for(i=0;i<n2;i++){
R[i]=H[m+i];
}
L[n1]=R[n2]=SEN;
i=0;
j=0;
for(k=l;k<r;k++){
count++;
if(L[i]<=R[j]){
H[k]=L[i++];
}
else{
H[k]=R[j++];
}}}
void mergeSort(int *H,int n,int l,int r){
if(l+1 < r){
int m;
m=(l+r)/2;
mergeSort(H,n,l,m);
mergeSort(H,n,m,r);
merge(H,n,l,m,r);
}}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148280/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148280/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %H) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
store i32 0, ptr @count, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not23 = icmp sgt i32 %0, 0
br i1 %cmp.not.not23, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %H, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv.next, %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 ]
call void @mergeSort(ptr noundef nonnull %H, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp4.not.not25 = icmp sgt i32 %3, 0
br i1 %cmp4.not.not25, label %if.end.peel, label %for.end13
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %H, align 16, !tbaa !5
%call10.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp4.not.not.peel = icmp sgt i32 %4, 1
br i1 %cmp4.not.not.peel, label %if.end, label %for.end13
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %if.end ], [ 1, %if.end.peel ]
%putchar22 = call i32 @putchar(i32 32)
%arrayidx9 = getelementptr inbounds [500000 x i32], ptr %H, i64 0, i64 %indvars.iv29
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4.not.not = icmp slt i64 %indvars.iv.next30, %7
br i1 %cmp4.not.not, label %if.end, label %for.end13, !llvm.loop !11
for.end13: ; preds = %if.end, %if.end.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %H) #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: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %H, i32 noundef %n, i32 noundef %l, i32 noundef %r) local_unnamed_addr #3 {
entry:
%H14 = ptrtoint ptr %H to i64
%add = add nsw i32 %l, 1
%cmp = icmp slt i32 %add, %r
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %r, %l
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %H, i32 noundef %n, i32 noundef %l, i32 noundef %div)
tail call void @mergeSort(ptr noundef %H, i32 noundef %n, i32 noundef %div, i32 noundef %r)
%sub.i = sub nsw i32 %div, %l
%sub1.i = sub i32 %r, %div
%cmp65.i = icmp sgt i32 %sub.i, 0
br i1 %cmp65.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %l to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %H, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %H14
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load15 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load15, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !16
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp567.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp567.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count79.i = zext i32 %sub1.i to i64
%invariant.gep86.i = getelementptr i32, ptr %H, i64 %13
%min.iters.check20 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check20, label %for.body6.i.preheader, label %vector.memcheck16
vector.memcheck16: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %H14
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check17 = icmp ult i64 %16, 32
br i1 %diff.check17, label %for.body6.i.preheader, label %vector.ph21
vector.ph21: ; preds = %vector.memcheck16
%n.vec23 = and i64 %wide.trip.count79.i, 4294967288
br label %vector.body26
vector.body26: ; preds = %vector.body26, %vector.ph21
%index27 = phi i64 [ 0, %vector.ph21 ], [ %index.next30, %vector.body26 ]
%17 = getelementptr i32, ptr %invariant.gep86.i, i64 %index27
%wide.load28 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load29 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index27
store <4 x i32> %wide.load28, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load29, ptr %20, align 16, !tbaa !5
%index.next30 = add nuw i64 %index27, 8
%21 = icmp eq i64 %index.next30, %n.vec23
br i1 %21, label %middle.block18, label %vector.body26, !llvm.loop !18
middle.block18: ; preds = %vector.body26
%cmp.n25 = icmp eq i64 %n.vec23, %wide.trip.count79.i
br i1 %cmp.n25, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck16, %for.body6.preheader.i, %middle.block18
%indvars.iv75.i.ph = phi i64 [ 0, %vector.memcheck16 ], [ 0, %for.body6.preheader.i ], [ %n.vec23, %middle.block18 ]
%22 = xor i64 %indvars.iv75.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79.i
%xtraiter31 = and i64 %wide.trip.count79.i, 3
%lcmp.mod32.not = icmp eq i64 %xtraiter31, 0
br i1 %lcmp.mod32.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv75.i.prol = phi i64 [ %indvars.iv.next76.i.prol, %for.body6.i.prol ], [ %indvars.iv75.i.ph, %for.body6.i.preheader ]
%prol.iter33 = phi i64 [ %prol.iter33.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep87.i.prol = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i.prol
%24 = load i32, ptr %gep87.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next76.i.prol = add nuw nsw i64 %indvars.iv75.i.prol, 1
%prol.iter33.next = add i64 %prol.iter33, 1
%prol.iter33.cmp.not = icmp eq i64 %prol.iter33.next, %xtraiter31
br i1 %prol.iter33.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !19
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv75.i.unr = phi i64 [ %indvars.iv75.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next76.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !20
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i.3, %for.body6.i ], [ %indvars.iv75.i.unr, %for.body6.i.prol.loopexit ]
%gep87.i = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i
%30 = load i32, ptr %gep87.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%gep87.i.1 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i
%31 = load i32, ptr %gep87.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next76.i.1 = add nuw nsw i64 %indvars.iv75.i, 2
%gep87.i.2 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.1
%32 = load i32, ptr %gep87.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next76.i.2 = add nuw nsw i64 %indvars.iv75.i, 3
%gep87.i.3 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.2
%33 = load i32, ptr %gep87.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next76.i.3 = add nuw nsw i64 %indvars.iv75.i, 4
%exitcond80.not.i.3 = icmp eq i64 %indvars.iv.next76.i.3, %wide.trip.count79.i
br i1 %exitcond80.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !21
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block18, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub1.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %l to i64
%wide.trip.count84.i = sext i32 %r to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv81.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next82.i, %for.body21.i ]
%j.071.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%i.270.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.270.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.071.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc28.i = zext i1 %cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.270.i, %inc28.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc33.i = zext i1 %not.cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.071.i, %inc33.i
%38 = getelementptr inbounds i32, ptr %H, i64 %indvars.iv81.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next82.i = add nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %wide.trip.count84.i
br i1 %exitcond85.not.i, label %if.end, label %for.body21.i, !llvm.loop !22
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %H, i32 noundef %n, i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #3 {
entry:
%H88 = ptrtoint ptr %H to i64
%sub = sub nsw i32 %m, %l
%sub1 = sub i32 %r, %m
%cmp65 = icmp sgt i32 %sub, 0
br i1 %cmp65, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %l to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %H, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader106, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %H88
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !23
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader106
for.body.preheader106: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%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.preheader106, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader106 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader106 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !24
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader106
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader106 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp567 = icmp sgt i32 %sub1, 0
br i1 %cmp567, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %m to i64
%wide.trip.count79 = zext i32 %sub1 to i64
%invariant.gep86 = getelementptr i32, ptr %H, i64 %13
%min.iters.check94 = icmp ult i32 %sub1, 12
br i1 %min.iters.check94, label %for.body6.preheader105, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %H88
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check91 = icmp ult i64 %16, 32
br i1 %diff.check91, label %for.body6.preheader105, label %vector.ph95
vector.ph95: ; preds = %vector.memcheck90
%n.vec97 = and i64 %wide.trip.count79, 4294967288
br label %vector.body100
vector.body100: ; preds = %vector.body100, %vector.ph95
%index101 = phi i64 [ 0, %vector.ph95 ], [ %index.next104, %vector.body100 ]
%17 = getelementptr i32, ptr %invariant.gep86, i64 %index101
%wide.load102 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load103 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index101
store <4 x i32> %wide.load102, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load103, ptr %20, align 16, !tbaa !5
%index.next104 = add nuw i64 %index101, 8
%21 = icmp eq i64 %index.next104, %n.vec97
br i1 %21, label %middle.block92, label %vector.body100, !llvm.loop !25
middle.block92: ; preds = %vector.body100
%cmp.n99 = icmp eq i64 %n.vec97, %wide.trip.count79
br i1 %cmp.n99, label %for.end14, label %for.body6.preheader105
for.body6.preheader105: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block92
%indvars.iv75.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec97, %middle.block92 ]
%22 = xor i64 %indvars.iv75.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79
%xtraiter107 = and i64 %wide.trip.count79, 3
%lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
br i1 %lcmp.mod108.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader105, %for.body6.prol
%indvars.iv75.prol = phi i64 [ %indvars.iv.next76.prol, %for.body6.prol ], [ %indvars.iv75.ph, %for.body6.preheader105 ]
%prol.iter109 = phi i64 [ %prol.iter109.next, %for.body6.prol ], [ 0, %for.body6.preheader105 ]
%gep87.prol = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75.prol
%24 = load i32, ptr %gep87.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next76.prol = add nuw nsw i64 %indvars.iv75.prol, 1
%prol.iter109.next = add i64 %prol.iter109, 1
%prol.iter109.cmp.not = icmp eq i64 %prol.iter109.next, %xtraiter107
br i1 %prol.iter109.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !26
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader105
%indvars.iv75.unr = phi i64 [ %indvars.iv75.ph, %for.body6.preheader105 ], [ %indvars.iv.next76.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !27
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv75 = phi i64 [ %indvars.iv.next76.3, %for.body6 ], [ %indvars.iv75.unr, %for.body6.prol.loopexit ]
%gep87 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75
%30 = load i32, ptr %gep87, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%gep87.1 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76
%31 = load i32, ptr %gep87.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%gep87.2 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.1
%32 = load i32, ptr %gep87.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next76.2 = add nuw nsw i64 %indvars.iv75, 3
%gep87.3 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.2
%33 = load i32, ptr %gep87.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next76.3 = add nuw nsw i64 %indvars.iv75, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next76.3, %wide.trip.count79
br i1 %exitcond80.not.3, label %for.end14, label %for.body6, !llvm.loop !28
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block92, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2069 = icmp slt i32 %l, %r
br i1 %cmp2069, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %l to i64
%wide.trip.count84 = sext i32 %r to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv81 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next82, %for.body21 ]
%j.071 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.270 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.270 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.071 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc28 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.270, %inc28
%not.cmp27.not = xor i1 %cmp27.not, true
%inc33 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.071, %inc33
%38 = getelementptr inbounds i32, ptr %H, i64 %indvars.iv81
store i32 %.sink, ptr %38, align 4
%indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end40, label %for.body21, !llvm.loop !22
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; 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 = { 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 #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10, !14, !15}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !10, !14}
!21 = distinct !{!21, !10, !14}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !14, !15}
!24 = distinct !{!24, !17}
!25 = distinct !{!25, !10, !14, !15}
!26 = distinct !{!26, !17}
!27 = distinct !{!27, !10, !14}
!28 = distinct !{!28, !10, !14}
|
#include<stdio.h>
#define N 500000
#define INFTY 1000000001
void merge(int *,int,int,int,int);
void mergeSort(int *,int,int,int);
int S[N],cnt=0;
int main(){
int n,S[N],i;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&S[i]);
mergeSort(S,n,0,n);
for(i=0;i<n;i++){
if(i<n-1) printf("%d ",S[i]);
else printf("%d\n",S[i]);
}
printf("%d\n",cnt);
return 0;
}
int L[N/2+1],R[N/2+1];
void merge(int *S,int n,int l,int m,int r){
int n1,n2,k,i,j=0;
n1=m-l;
n2=r-m;
for(i=0;i<=n1-1;i++)L[i]=S[l+i];
for(i=0;i<=n2-1;i++) R[i]=S[m+i];
L[n1]=R[n2]=INFTY;
i=0;
for(k=l;k<=r-1;k++){
cnt++;
if(L[i]<=R[j]){
S[k]=L[i];
i++;
}
else{
S[k]=R[j];
j++;
}
}
}
void mergeSort(int *S,int n,int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
mergeSort(S,n,l,m);
mergeSort(S,n,m,r);
merge(S,n,l,m,r);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148323/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148323/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@L = dso_local local_unnamed_addr global [250001 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250001 x i32] zeroinitializer, align 16
@S = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp326 = icmp sgt i32 %3, 0
br i1 %cmp326, label %for.body4, label %for.end14
for.body4: ; preds = %for.end, %for.body4
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body4 ], [ 0, %for.end ]
%4 = phi i32 [ %7, %for.body4 ], [ %3, %for.end ]
%sub = add nsw i32 %4, -1
%5 = sext i32 %sub to i64
%cmp5 = icmp slt i64 %indvars.iv30, %5
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv30
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%.str.1..str.2 = select i1 %cmp5, ptr @.str.1, ptr @.str.2
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %6)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %8
br i1 %cmp3, label %for.body4, label %for.end14, !llvm.loop !11
for.end14: ; preds = %for.body4, %for.end
%9 = load i32, ptr @cnt, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 2000000, 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: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %S, i32 noundef %n, i32 noundef %l, i32 noundef %r) local_unnamed_addr #3 {
entry:
%S14 = ptrtoint ptr %S to i64
%add = add nsw i32 %l, 1
%cmp = icmp slt i32 %add, %r
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %r, %l
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %S, i32 noundef %n, i32 noundef %l, i32 noundef %div)
tail call void @mergeSort(ptr noundef %S, i32 noundef %n, i32 noundef %div, i32 noundef %r)
%sub.i = sub nsw i32 %div, %l
%sub1.i = sub i32 %r, %div
%cmp.not.not70.i = icmp sgt i32 %sub.i, 0
br i1 %cmp.not.not70.i, label %for.body.preheader.i, label %for.cond5.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %l to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %S, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %S14
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load15 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load15, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond5.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx4.i.prol = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx4.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !15
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond5.preheader.i, label %for.body.i
for.cond5.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp7.not.not72.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp7.not.not72.i, label %for.body8.preheader.i, label %for.end16.i
for.body8.preheader.i: ; preds = %for.cond5.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count84.i = zext i32 %sub1.i to i64
%invariant.gep91.i = getelementptr i32, ptr %S, i64 %13
%min.iters.check20 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check20, label %for.body8.i.preheader, label %vector.memcheck16
vector.memcheck16: ; preds = %for.body8.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %S14
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check17 = icmp ult i64 %16, 32
br i1 %diff.check17, label %for.body8.i.preheader, label %vector.ph21
vector.ph21: ; preds = %vector.memcheck16
%n.vec23 = and i64 %wide.trip.count84.i, 4294967288
br label %vector.body26
vector.body26: ; preds = %vector.body26, %vector.ph21
%index27 = phi i64 [ 0, %vector.ph21 ], [ %index.next30, %vector.body26 ]
%17 = getelementptr i32, ptr %invariant.gep91.i, i64 %index27
%wide.load28 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load29 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %index27
store <4 x i32> %wide.load28, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load29, ptr %20, align 16, !tbaa !5
%index.next30 = add nuw i64 %index27, 8
%21 = icmp eq i64 %index.next30, %n.vec23
br i1 %21, label %middle.block18, label %vector.body26, !llvm.loop !17
middle.block18: ; preds = %vector.body26
%cmp.n25 = icmp eq i64 %n.vec23, %wide.trip.count84.i
br i1 %cmp.n25, label %for.end16.i, label %for.body8.i.preheader
for.body8.i.preheader: ; preds = %vector.memcheck16, %for.body8.preheader.i, %middle.block18
%indvars.iv80.i.ph = phi i64 [ 0, %vector.memcheck16 ], [ 0, %for.body8.preheader.i ], [ %n.vec23, %middle.block18 ]
%22 = xor i64 %indvars.iv80.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count84.i
%xtraiter31 = and i64 %wide.trip.count84.i, 3
%lcmp.mod32.not = icmp eq i64 %xtraiter31, 0
br i1 %lcmp.mod32.not, label %for.body8.i.prol.loopexit, label %for.body8.i.prol
for.body8.i.prol: ; preds = %for.body8.i.preheader, %for.body8.i.prol
%indvars.iv80.i.prol = phi i64 [ %indvars.iv.next81.i.prol, %for.body8.i.prol ], [ %indvars.iv80.i.ph, %for.body8.i.preheader ]
%prol.iter33 = phi i64 [ %prol.iter33.next, %for.body8.i.prol ], [ 0, %for.body8.i.preheader ]
%gep92.i.prol = getelementptr i32, ptr %invariant.gep91.i, i64 %indvars.iv80.i.prol
%24 = load i32, ptr %gep92.i.prol, align 4, !tbaa !5
%arrayidx13.i.prol = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv80.i.prol
store i32 %24, ptr %arrayidx13.i.prol, align 4, !tbaa !5
%indvars.iv.next81.i.prol = add nuw nsw i64 %indvars.iv80.i.prol, 1
%prol.iter33.next = add i64 %prol.iter33, 1
%prol.iter33.cmp.not = icmp eq i64 %prol.iter33.next, %xtraiter31
br i1 %prol.iter33.cmp.not, label %for.body8.i.prol.loopexit, label %for.body8.i.prol, !llvm.loop !18
for.body8.i.prol.loopexit: ; preds = %for.body8.i.prol, %for.body8.i.preheader
%indvars.iv80.i.unr = phi i64 [ %indvars.iv80.i.ph, %for.body8.i.preheader ], [ %indvars.iv.next81.i.prol, %for.body8.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end16.i, label %for.body8.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx4.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx4.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx4.i.1 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx4.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx4.i.2 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx4.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx4.i.3 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx4.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond5.preheader.i, label %for.body.i, !llvm.loop !19
for.body8.i: ; preds = %for.body8.i.prol.loopexit, %for.body8.i
%indvars.iv80.i = phi i64 [ %indvars.iv.next81.i.3, %for.body8.i ], [ %indvars.iv80.i.unr, %for.body8.i.prol.loopexit ]
%gep92.i = getelementptr i32, ptr %invariant.gep91.i, i64 %indvars.iv80.i
%30 = load i32, ptr %gep92.i, align 4, !tbaa !5
%arrayidx13.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv80.i
store i32 %30, ptr %arrayidx13.i, align 4, !tbaa !5
%indvars.iv.next81.i = add nuw nsw i64 %indvars.iv80.i, 1
%gep92.i.1 = getelementptr i32, ptr %invariant.gep91.i, i64 %indvars.iv.next81.i
%31 = load i32, ptr %gep92.i.1, align 4, !tbaa !5
%arrayidx13.i.1 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv.next81.i
store i32 %31, ptr %arrayidx13.i.1, align 4, !tbaa !5
%indvars.iv.next81.i.1 = add nuw nsw i64 %indvars.iv80.i, 2
%gep92.i.2 = getelementptr i32, ptr %invariant.gep91.i, i64 %indvars.iv.next81.i.1
%32 = load i32, ptr %gep92.i.2, align 4, !tbaa !5
%arrayidx13.i.2 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv.next81.i.1
store i32 %32, ptr %arrayidx13.i.2, align 4, !tbaa !5
%indvars.iv.next81.i.2 = add nuw nsw i64 %indvars.iv80.i, 3
%gep92.i.3 = getelementptr i32, ptr %invariant.gep91.i, i64 %indvars.iv.next81.i.2
%33 = load i32, ptr %gep92.i.3, align 4, !tbaa !5
%arrayidx13.i.3 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv.next81.i.2
store i32 %33, ptr %arrayidx13.i.3, align 4, !tbaa !5
%indvars.iv.next81.i.3 = add nuw nsw i64 %indvars.iv80.i, 4
%exitcond85.not.i.3 = icmp eq i64 %indvars.iv.next81.i.3, %wide.trip.count84.i
br i1 %exitcond85.not.i.3, label %for.end16.i, label %for.body8.i, !llvm.loop !20
for.end16.i: ; preds = %for.body8.i.prol.loopexit, %for.body8.i, %middle.block18, %for.cond5.preheader.i
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 1000000001, ptr %arrayidx18.i, align 4, !tbaa !5
%idxprom19.i = sext i32 %sub.i to i64
%arrayidx20.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom19.i
store i32 1000000001, ptr %arrayidx20.i, align 4, !tbaa !5
%34 = sext i32 %l to i64
%wide.trip.count89.i = sext i32 %r to i64
br label %for.body24.i
for.body24.i: ; preds = %for.body24.i, %for.end16.i
%indvars.iv86.i = phi i64 [ %34, %for.end16.i ], [ %indvars.iv.next87.i, %for.body24.i ]
%j.077.i = phi i32 [ 0, %for.end16.i ], [ %j.1.i, %for.body24.i ]
%i.276.i = phi i32 [ 0, %for.end16.i ], [ %i.3.i, %for.body24.i ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc25.i = add nsw i32 %35, 1
store i32 %inc25.i, ptr @cnt, align 4, !tbaa !5
%idxprom26.i = zext i32 %i.276.i to i64
%arrayidx27.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom26.i
%36 = load i32, ptr %arrayidx27.i, align 4, !tbaa !5
%idxprom28.i = zext i32 %j.077.i to i64
%arrayidx29.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom28.i
%37 = load i32, ptr %arrayidx29.i, align 4, !tbaa !5
%cmp30.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc35.i = zext i1 %cmp30.not.i to i32
%i.3.i = add nuw nsw i32 %i.276.i, %inc35.i
%not.cmp30.not.i = xor i1 %cmp30.not.i, true
%inc40.i = zext i1 %not.cmp30.not.i to i32
%j.1.i = add nuw nsw i32 %j.077.i, %inc40.i
%38 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv86.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next87.i = add nsw i64 %indvars.iv86.i, 1
%exitcond90.not.i = icmp eq i64 %indvars.iv.next87.i, %wide.trip.count89.i
br i1 %exitcond90.not.i, label %if.end, label %for.body24.i, !llvm.loop !21
if.end: ; preds = %for.body24.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %S, i32 noundef %n, i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #3 {
entry:
%S93 = ptrtoint ptr %S to i64
%sub = sub nsw i32 %m, %l
%sub1 = sub i32 %r, %m
%cmp.not.not70 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not70, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %l to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %S, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader111, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %S93
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader111, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load94 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load94, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond5.preheader, label %for.body.preheader111
for.body.preheader111: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%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.preheader111, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader111 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader111 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx4.prol = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx4.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !23
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader111
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader111 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond5.preheader, label %for.body
for.cond5.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp7.not.not72 = icmp sgt i32 %sub1, 0
br i1 %cmp7.not.not72, label %for.body8.preheader, label %for.end16
for.body8.preheader: ; preds = %for.cond5.preheader
%13 = sext i32 %m to i64
%wide.trip.count84 = zext i32 %sub1 to i64
%invariant.gep91 = getelementptr i32, ptr %S, i64 %13
%min.iters.check99 = icmp ult i32 %sub1, 12
br i1 %min.iters.check99, label %for.body8.preheader110, label %vector.memcheck95
vector.memcheck95: ; preds = %for.body8.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %S93
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check96 = icmp ult i64 %16, 32
br i1 %diff.check96, label %for.body8.preheader110, label %vector.ph100
vector.ph100: ; preds = %vector.memcheck95
%n.vec102 = and i64 %wide.trip.count84, 4294967288
br label %vector.body105
vector.body105: ; preds = %vector.body105, %vector.ph100
%index106 = phi i64 [ 0, %vector.ph100 ], [ %index.next109, %vector.body105 ]
%17 = getelementptr i32, ptr %invariant.gep91, i64 %index106
%wide.load107 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load108 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %index106
store <4 x i32> %wide.load107, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load108, ptr %20, align 16, !tbaa !5
%index.next109 = add nuw i64 %index106, 8
%21 = icmp eq i64 %index.next109, %n.vec102
br i1 %21, label %middle.block97, label %vector.body105, !llvm.loop !24
middle.block97: ; preds = %vector.body105
%cmp.n104 = icmp eq i64 %n.vec102, %wide.trip.count84
br i1 %cmp.n104, label %for.end16, label %for.body8.preheader110
for.body8.preheader110: ; preds = %vector.memcheck95, %for.body8.preheader, %middle.block97
%indvars.iv80.ph = phi i64 [ 0, %vector.memcheck95 ], [ 0, %for.body8.preheader ], [ %n.vec102, %middle.block97 ]
%22 = xor i64 %indvars.iv80.ph, -1
%23 = add nsw i64 %22, %wide.trip.count84
%xtraiter112 = and i64 %wide.trip.count84, 3
%lcmp.mod113.not = icmp eq i64 %xtraiter112, 0
br i1 %lcmp.mod113.not, label %for.body8.prol.loopexit, label %for.body8.prol
for.body8.prol: ; preds = %for.body8.preheader110, %for.body8.prol
%indvars.iv80.prol = phi i64 [ %indvars.iv.next81.prol, %for.body8.prol ], [ %indvars.iv80.ph, %for.body8.preheader110 ]
%prol.iter114 = phi i64 [ %prol.iter114.next, %for.body8.prol ], [ 0, %for.body8.preheader110 ]
%gep92.prol = getelementptr i32, ptr %invariant.gep91, i64 %indvars.iv80.prol
%24 = load i32, ptr %gep92.prol, align 4, !tbaa !5
%arrayidx13.prol = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv80.prol
store i32 %24, ptr %arrayidx13.prol, align 4, !tbaa !5
%indvars.iv.next81.prol = add nuw nsw i64 %indvars.iv80.prol, 1
%prol.iter114.next = add i64 %prol.iter114, 1
%prol.iter114.cmp.not = icmp eq i64 %prol.iter114.next, %xtraiter112
br i1 %prol.iter114.cmp.not, label %for.body8.prol.loopexit, label %for.body8.prol, !llvm.loop !25
for.body8.prol.loopexit: ; preds = %for.body8.prol, %for.body8.preheader110
%indvars.iv80.unr = phi i64 [ %indvars.iv80.ph, %for.body8.preheader110 ], [ %indvars.iv.next81.prol, %for.body8.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end16, label %for.body8
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx4, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx4.1 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx4.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx4.2 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx4.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx4.3 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx4.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond5.preheader, label %for.body, !llvm.loop !26
for.body8: ; preds = %for.body8.prol.loopexit, %for.body8
%indvars.iv80 = phi i64 [ %indvars.iv.next81.3, %for.body8 ], [ %indvars.iv80.unr, %for.body8.prol.loopexit ]
%gep92 = getelementptr i32, ptr %invariant.gep91, i64 %indvars.iv80
%30 = load i32, ptr %gep92, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv80
store i32 %30, ptr %arrayidx13, align 4, !tbaa !5
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%gep92.1 = getelementptr i32, ptr %invariant.gep91, i64 %indvars.iv.next81
%31 = load i32, ptr %gep92.1, align 4, !tbaa !5
%arrayidx13.1 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv.next81
store i32 %31, ptr %arrayidx13.1, align 4, !tbaa !5
%indvars.iv.next81.1 = add nuw nsw i64 %indvars.iv80, 2
%gep92.2 = getelementptr i32, ptr %invariant.gep91, i64 %indvars.iv.next81.1
%32 = load i32, ptr %gep92.2, align 4, !tbaa !5
%arrayidx13.2 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv.next81.1
store i32 %32, ptr %arrayidx13.2, align 4, !tbaa !5
%indvars.iv.next81.2 = add nuw nsw i64 %indvars.iv80, 3
%gep92.3 = getelementptr i32, ptr %invariant.gep91, i64 %indvars.iv.next81.2
%33 = load i32, ptr %gep92.3, align 4, !tbaa !5
%arrayidx13.3 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %indvars.iv.next81.2
store i32 %33, ptr %arrayidx13.3, align 4, !tbaa !5
%indvars.iv.next81.3 = add nuw nsw i64 %indvars.iv80, 4
%exitcond85.not.3 = icmp eq i64 %indvars.iv.next81.3, %wide.trip.count84
br i1 %exitcond85.not.3, label %for.end16, label %for.body8, !llvm.loop !27
for.end16: ; preds = %for.body8.prol.loopexit, %for.body8, %middle.block97, %for.cond5.preheader
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
%idxprom19 = sext i32 %sub to i64
%arrayidx20 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom19
store i32 1000000001, ptr %arrayidx20, align 4, !tbaa !5
%cmp23.not.not74 = icmp slt i32 %l, %r
br i1 %cmp23.not.not74, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.end16
%34 = sext i32 %l to i64
%wide.trip.count89 = sext i32 %r to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv86 = phi i64 [ %34, %for.body24.preheader ], [ %indvars.iv.next87, %for.body24 ]
%j.077 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%i.276 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc25 = add nsw i32 %35, 1
store i32 %inc25, ptr @cnt, align 4, !tbaa !5
%idxprom26 = zext i32 %i.276 to i64
%arrayidx27 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom26
%36 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%idxprom28 = zext i32 %j.077 to i64
%arrayidx29 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom28
%37 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.not = icmp sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc35 = zext i1 %cmp30.not to i32
%i.3 = add nuw nsw i32 %i.276, %inc35
%not.cmp30.not = xor i1 %cmp30.not, true
%inc40 = zext i1 %not.cmp30.not to i32
%j.1 = add nuw nsw i32 %j.077, %inc40
%38 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv86
store i32 %.sink, ptr %38, align 4
%indvars.iv.next87 = add nsw i64 %indvars.iv86, 1
%exitcond90.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count89
br i1 %exitcond90.not, label %for.end43, label %for.body24, !llvm.loop !21
for.end43: ; preds = %for.body24, %for.end16
ret void
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10, !13, !14}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !10, !13}
!20 = distinct !{!20, !10, !13}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !13, !14}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !10, !13, !14}
!25 = distinct !{!25, !16}
!26 = distinct !{!26, !10, !13}
!27 = distinct !{!27, !10, !13}
|
#include <stdio.h>
#define N 500000
#define MAX 1000000000
int cnt = 0;
void merge(int *a,int left,int mid,int right){
int n1,n2,i,j,k;
n1 = mid - left;
n2 = right - mid;
int L[n1+1], R[n2+1];
for(i=0;i<n1;++i)L[i]=a[left+i];
L[n1]=MAX;
for(i=0;i<n2;++i)R[i]=a[mid+i];
R[n2]=MAX;
i = j = 0;
for(k=left;k<right;k++){
if(L[i]<=R[j]){
a[k]=L[i];
i++;
}
else {
a[k]=R[j];
j++;
}
cnt++;
}
}
void mergeSort(int *a,int left,int right){
int mid;
if(left+1<right){
mid = (left + right)/2;
mergeSort(a,left,mid);
mergeSort(a,mid,right);
merge(a,left,mid,right);
}
}
int main(){
int a[N],n,i;
scanf("%d",&n);
for(i=0;i<n;++i)scanf("%d",&a[i]);
mergeSort(a,0,n);
for(i=0;i<n-1;++i)printf("%d ",a[i]);
printf("%d\n%d\n",a[n-1],cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148367/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148367/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %a, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp72 = icmp sgt i32 %sub, 0
br i1 %cmp72, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %a, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %idxprom7
store i32 1000000000, ptr %arrayidx8, align 4, !tbaa !5
%cmp1074 = icmp sgt i32 %sub1, 0
br i1 %cmp1074, label %for.body11.preheader, label %for.end19
for.body11.preheader: ; preds = %for.end
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep82 = getelementptr i8, ptr %a, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep82, i64 %15, i1 false), !tbaa !5
br label %for.end19
for.end19: ; preds = %for.body11.preheader, %for.end
%idxprom20 = sext i32 %sub1 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom20
store i32 1000000000, ptr %arrayidx21, align 4, !tbaa !5
%cmp2376 = icmp slt i32 %left, %right
br i1 %cmp2376, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.end19
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %16, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%i.279 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%j.078 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%idxprom25 = zext i32 %i.279 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%idxprom27 = zext i32 %j.078 to i64
%arrayidx28 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom27
%18 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29.not = icmp sgt i32 %17, %18
%.sink = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%inc39 = zext i1 %cmp29.not to i32
%j.1 = add nuw nsw i32 %j.078, %inc39
%not.cmp29.not = xor i1 %cmp29.not, true
%inc34 = zext i1 %not.cmp29.not to i32
%i.3 = add nuw nsw i32 %i.279, %inc34
%19 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
store i32 %.sink, ptr %19, align 4
%20 = load i32, ptr @cnt, align 4, !tbaa !5
%inc40 = add nsw i32 %20, 1
store i32 %inc40, ptr @cnt, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end43, label %for.body24, !llvm.loop !9
for.end43: ; preds = %for.body24, %for.end19
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %a, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %a, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %a, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %a, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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 ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %a, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp323 = icmp sgt i32 %3, 1
br i1 %cmp323, label %for.body4, label %for.end.for.end10_crit_edge
for.end.for.end10_crit_edge: ; preds = %for.end
%sub22 = add nsw i32 %3, -1
%.pre = sext i32 %sub22 to i64
br label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %a, i64 0, i64 %indvars.iv29
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next30, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !12
for.end10: ; preds = %for.body4, %for.end.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.end.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [500000 x i32], ptr %a, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
int t;
long long int n,k,ans,check,n1,k1;
scanf("%d",&t);
while(t--)
{
scanf("%lld%lld",&n,&k);
if(k%(n-1)==0)
{
check=k/(n-1)-1;
}
else
check=k/(n-1);
n1=n*check;
k1=(n-1)*check;
while(k1!=k)
{
n1=n1+1;
k1=k1+1;
}
printf("%lld\n",n1);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14841/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec20 = add nsw i32 %0, -1
store i32 %dec20, ptr %t, align 4, !tbaa !5
%tobool.not21 = icmp eq i32 %0, 0
br i1 %tobool.not21, label %while.end13, label %while.body
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k)
%1 = load i64, ptr %k, align 8, !tbaa !9
%2 = load i64, ptr %n, align 8, !tbaa !9
%sub = add nsw i64 %2, -1
%rem = srem i64 %1, %sub
%cmp = icmp eq i64 %rem, 0
%div = sdiv i64 %1, %sub
%sub3 = sext i1 %cmp to i64
%check.0 = add nsw i64 %div, %sub3
%mul = mul nsw i64 %check.0, %2
%mul7 = mul nsw i64 %check.0, %sub
%cmp9.not17 = icmp eq i64 %mul7, %1
%3 = add i64 %check.0, %1
%n1.0.lcssa = select i1 %cmp9.not17, i64 %mul, i64 %3
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %n1.0.lcssa)
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end13, label %while.body, !llvm.loop !11
while.end13: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
/* 学籍番号 17D8101029G 石塚 博之 ID: mcatpolo 言語:C */
#include <stdio.h>
#include <math.h>
#define N 500000
long c = 0;
long A[N];
void merge(int left, int mid, int right){
long L[N/2+1], R[N/2+1];
int n1, n2, i, j, k;
n1 = mid - left;
n2 = right - mid;
for(i=0; i<n1; i++){
L[i] = A[left+i];
}
for(i=0; i<n2; i++){
R[i] = A[mid + i];
}
L[n1] = (long)INFINITY;
R[n2] = (long)INFINITY;
i=0;
j=0;
for(k=left; k<right; k++){
c++;
if(L[i] <= R[j]) {
A[k] = L[i];
i++;
}
else {
A[k] = R[j];
j++;
}
}
}
void mergeSort(int left, int right){
int mid;
if(left+1<right){
mid = (left+right)/2;
mergeSort(left, mid);
mergeSort(mid, right);
merge(left, mid, right);
}
}
int main(void){
int i, n;
scanf("%d", &n);
for(i=0; i<n; i++) {
scanf("%d", &A[i]);
}
mergeSort(0, n);
for(int i=0; i<n; i++){
if(i!=n-1){
printf("%d ", A[i]);
}
else
{
printf("%d\n", A[i]);
}
}
printf("%d\n", c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148453/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148453/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i64 0, align 8
@A = dso_local global [500000 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \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: none, inaccessiblemem: none) uwtable
define dso_local void @merge(i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%L = alloca [250001 x i64], align 16
%R = alloca [250001 x i64], align 16
call void @llvm.lifetime.start.p0(i64 2000008, ptr nonnull %L) #7
call void @llvm.lifetime.start.p0(i64 2000008, ptr nonnull %R) #7
%cmp64 = icmp sgt i32 %mid, %left
br i1 %cmp64, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 3
%scevgep = getelementptr i8, ptr @A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 3
%6 = add nuw nsw i64 %5, 8
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 8 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp566 = icmp sgt i32 %right, %mid
br i1 %cmp566, label %for.body6.preheader, label %for.cond19.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 3
%scevgep76 = getelementptr i8, ptr @A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 3
%13 = add nuw nsw i64 %12, 8
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %R, ptr noundef nonnull align 8 dereferenceable(1) %scevgep76, i64 %13, i1 false), !tbaa !5
br label %for.cond19.preheader
for.cond19.preheader: ; preds = %for.body6.preheader, %for.cond4.preheader
%cmp2069 = icmp slt i32 %left, %right
br i1 %cmp2069, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.cond19.preheader
%c.promoted = load i64, ptr @c, align 8, !tbaa !5
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%j.072 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.271 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%inc226870 = phi i64 [ %c.promoted, %for.body21.preheader ], [ %inc22, %for.body21 ]
%inc22 = add nsw i64 %inc226870, 1
%idxprom23 = zext i32 %i.271 to i64
%arrayidx24 = getelementptr inbounds [250001 x i64], ptr %L, i64 0, i64 %idxprom23
%15 = load i64, ptr %arrayidx24, align 8, !tbaa !5
%idxprom25 = zext i32 %j.072 to i64
%arrayidx26 = getelementptr inbounds [250001 x i64], ptr %R, i64 0, i64 %idxprom25
%16 = load i64, ptr %arrayidx26, align 8, !tbaa !5
%cmp27.not = icmp sle i64 %15, %16
%.sink = tail call i64 @llvm.smin.i64(i64 %15, i64 %16)
%inc32 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.271, %inc32
%not.cmp27.not = xor i1 %cmp27.not, true
%inc37 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.072, %inc37
%17 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %indvars.iv
store i64 %.sink, ptr %17, align 8
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond19.for.end40_crit_edge, label %for.body21, !llvm.loop !9
for.cond19.for.end40_crit_edge: ; preds = %for.body21
store i64 %inc22, ptr @c, align 8, !tbaa !5
br label %for.end40
for.end40: ; preds = %for.cond19.for.end40_crit_edge, %for.cond19.preheader
call void @llvm.lifetime.end.p0(i64 2000008, ptr nonnull %R) #7
call void @llvm.lifetime.end.p0(i64 2000008, ptr nonnull %L) #7
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(i32 noundef %left, i32 noundef %right) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret10
common.ret10: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(i32 noundef %div, i32 noundef %right)
tail call void @merge(i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret10
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !11
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !11
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !11
%cmp426 = icmp sgt i32 %3, 0
br i1 %cmp426, label %for.body5, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body5, %for.end
%4 = load i64, ptr @c, align 8, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.body5: ; preds = %for.end, %for.body5
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body5 ], [ 0, %for.end ]
%5 = phi i32 [ %8, %for.body5 ], [ %3, %for.end ]
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp6.not = icmp eq i64 %indvars.iv30, %6
%arrayidx11 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %indvars.iv30
%7 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%.str.2..str.1 = select i1 %cmp6.not, ptr @.str.2, ptr @.str.1
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1, i64 noundef %7)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%8 = load i32, ptr %n, align 4, !tbaa !11
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next31, %9
br i1 %cmp4, label %for.body5, label %for.cond.cleanup, !llvm.loop !14
}
; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #6
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <limits.h>
#define MAX_LENGTH 500000
int counter=0;
void Merge(int arr[], int left, int middle, int right)
{
int n1 = middle - left;
int n2= right - middle;
int L[n1+1], R[n2+1];
for(int i=0;i<n1;i++){L[i]=arr[left+i];}
for(int i=0;i<n2;i++){R[i]=arr[middle+i];}
L[n1] = INT_MAX;
R[n2] = INT_MAX;
int i=0;
int j=0;
for(int k=left;k<right;k++)
{
if(L[i]<=R[j])
{
arr[k] = L[i];
i += 1;
}
else{
arr[k] = R[j];
j += 1;
}
counter++;
}
}
void MergeSort(int arr[], int left, int right)
{
if(left+1 < right)
{
int middle = (left + right)/2;
MergeSort(arr, left, middle);
MergeSort(arr, middle, right);
Merge(arr, left, middle, right);
}
}
int main() {
int num=0;
int A[MAX_LENGTH]={0};
scanf("%d", &num);
for(int i=0;i<num;i++){scanf("%d", &A[i]);}
MergeSort(A, 0, num);
for(int i=0;i<num;i++)
{
if(i!=num-1){printf("%d ", A[i]);}
else{printf("%d\n", A[i]);}
}
printf("%d\n", counter);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148497/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148497/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@counter = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%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, inaccessiblemem: none) uwtable
define dso_local void @Merge(ptr nocapture noundef %arr, i32 noundef %left, i32 noundef %middle, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %middle, %left
%sub1 = sub nsw i32 %right, %middle
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp74 = icmp sgt i32 %sub, 0
br i1 %cmp74, label %for.body.preheader, label %for.cond8.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %arr, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %middle
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body.preheader, %entry
%cmp976 = icmp sgt i32 %sub1, 0
br i1 %cmp976, label %for.body11.preheader, label %for.cond.cleanup10
for.body11.preheader: ; preds = %for.cond8.preheader
%9 = sext i32 %middle to i64
%10 = shl nsw i64 %9, 2
%scevgep84 = getelementptr i8, ptr %arr, i64 %10
%11 = xor i32 %middle, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep84, i64 %15, i1 false), !tbaa !5
br label %for.cond.cleanup10
for.cond.cleanup10: ; preds = %for.body11.preheader, %for.cond8.preheader
%idxprom20 = sext i32 %sub to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla, i64 %idxprom20
store i32 2147483647, ptr %arrayidx21, align 4, !tbaa !5
%idxprom22 = sext i32 %sub1 to i64
%arrayidx23 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom22
store i32 2147483647, ptr %arrayidx23, align 4, !tbaa !5
%cmp2678 = icmp slt i32 %left, %right
br i1 %cmp2678, label %for.body28.preheader, label %for.cond.cleanup27
for.body28.preheader: ; preds = %for.cond.cleanup10
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body28
for.cond.cleanup27: ; preds = %for.body28, %for.cond.cleanup10
ret void
for.body28: ; preds = %for.body28.preheader, %for.body28
%indvars.iv = phi i64 [ %16, %for.body28.preheader ], [ %indvars.iv.next, %for.body28 ]
%j.080 = phi i32 [ 0, %for.body28.preheader ], [ %j.1, %for.body28 ]
%i24.079 = phi i32 [ 0, %for.body28.preheader ], [ %i24.1, %for.body28 ]
%idxprom29 = zext i32 %i24.079 to i64
%arrayidx30 = getelementptr inbounds i32, ptr %vla, i64 %idxprom29
%17 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%idxprom31 = zext i32 %j.080 to i64
%arrayidx32 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom31
%18 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33.not = icmp sle i32 %17, %18
%.sink = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%add38 = zext i1 %cmp33.not to i32
%i24.1 = add nuw nsw i32 %i24.079, %add38
%not.cmp33.not = xor i1 %cmp33.not, true
%add43 = zext i1 %not.cmp33.not to i32
%j.1 = add nuw nsw i32 %j.080, %add43
%19 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
store i32 %.sink, ptr %19, align 4
%20 = load i32, ptr @counter, align 4, !tbaa !5
%inc44 = add nsw i32 %20, 1
store i32 %inc44, ptr @counter, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup27, label %for.body28, !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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @MergeSort(ptr noundef %arr, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @MergeSort(ptr noundef %arr, i32 noundef %left, i32 noundef %div)
tail call void @MergeSort(ptr noundef %arr, i32 noundef %div, i32 noundef %right)
tail call void @Merge(ptr noundef %arr, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%num = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #7
store i32 0, ptr %num, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000000) %A, i8 0, i64 2000000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
call void @MergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%1 = load i32, ptr %num, align 4, !tbaa !5
%cmp427 = icmp sgt i32 %1, 0
br i1 %cmp427, label %for.body6, label %for.cond.cleanup5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %num, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.body6, %for.cond.cleanup
%4 = load i32, ptr @counter, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %4)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #7
ret i32 0
for.body6: ; preds = %for.cond.cleanup, %for.body6
%indvars.iv31 = phi i64 [ %indvars.iv.next32, %for.body6 ], [ 0, %for.cond.cleanup ]
%5 = phi i32 [ %8, %for.body6 ], [ %1, %for.cond.cleanup ]
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp7.not = icmp eq i64 %indvars.iv31, %6
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv31
%7 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%.str.2..str.1 = select i1 %cmp7.not, ptr @.str.2, ptr @.str.1
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1, i32 noundef %7)
%indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
%8 = load i32, ptr %num, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next32, %9
br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !llvm.loop !12
}
; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { 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 #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 = { 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 nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
long long int t,k,n,j,i;
scanf("%lld",&t);
for(i=1;i<=t;i=i+1)
{
long long int q=1,sum=0,p=0,r;
scanf("%lld %lld",&n,&k);
sum=k;
p=k;
for(j=1;j!=0;j=j+1)
{
q=p%n;;
p=p/n;
sum=sum+p;
if(p==0)
{
printf("%lld\n",sum);
break;
}
p=p+q;
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14854/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14854/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i64, align 8
%k = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
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 %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%cmp.not25 = icmp slt i64 %0, 1
br i1 %cmp.not25, label %for.end11, label %for.body
for.body: ; preds = %entry, %if.then
%i.026 = phi i64 [ %add10, %if.then ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k)
%1 = load i64, ptr %k, align 8, !tbaa !5
%2 = load i64, ptr %n, align 8, !tbaa !5
%div19 = sdiv i64 %1, %2
%add20 = add nsw i64 %div19, %1
%cmp521 = icmp eq i64 %div19, 0
br i1 %cmp521, label %if.then, label %if.end
if.then: ; preds = %if.end, %for.body
%add.lcssa = phi i64 [ %add20, %for.body ], [ %add, %if.end ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add.lcssa)
%add10 = add nuw nsw i64 %i.026, 1
%3 = load i64, ptr %t, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.026, %3
br i1 %cmp.not.not, label %for.body, label %for.end11, !llvm.loop !9
if.end: ; preds = %for.body, %if.end
%add24 = phi i64 [ %add, %if.end ], [ %add20, %for.body ]
%div23 = phi i64 [ %div, %if.end ], [ %div19, %for.body ]
%p.022 = phi i64 [ %add7, %if.end ], [ %1, %for.body ]
%rem = srem i64 %p.022, %2
%add7 = add nsw i64 %rem, %div23
%div = sdiv i64 %add7, %2
%add = add nsw i64 %div, %add24
%cmp5 = icmp eq i64 %div, 0
br i1 %cmp5, label %if.then, label %if.end, !llvm.loop !11
for.end11: ; preds = %if.then, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 a[500000], n, i;
int count = 0;
void merge(int ar[], int left, int mid, int right)
{
int n1, n2, L[500000], R[500000], i, j, k;
n1 = mid - left;
n2 = right - mid;
for (i = 0; i < n1; i++)
L[i] = ar[left + i];
for (i = 0; i < n2; i++)
R[i] = ar[mid + i];
L[n1] = 1000000001;
R[n2] = 1000000001;
i = j = 0;
for (k = left; k < right; k++)
{
if (L[i] <= R[j])
{
ar[k] = L[i];
i++;
count++;
}
else
{
ar[k] = R[j];
j++;
count++;
}
}
}
void mergesort(int ar[], int left, int right)
{
int mid;
if (left + 1 < right)
{
mid = (left + right) / 2;
mergesort(ar, left, mid);
mergesort(ar, mid, right);
merge(ar, left, mid, right);
}
}
int main()
{
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
mergesort(a, 0, n);
for (i = 0; i < n; i++)
{
if (i != 0)
putchar(' ');
printf("%d", a[i]);
}
printf("\n%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148583/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148583/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@a = dso_local global [500000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %ar, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%L = alloca [500000 x i32], align 16
%R = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %L) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %R) #6
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp68 = icmp sgt i32 %sub, 0
br i1 %cmp68, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %ar, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp570 = icmp sgt i32 %sub1, 0
br i1 %cmp570, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep78 = getelementptr i8, ptr %ar, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep78, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr %L, i64 0, i64 %idxprom15
store i32 1000000001, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
%cmp2072 = icmp slt i32 %left, %right
br i1 %cmp2072, label %for.body21.preheader, label %for.end41
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%j.074 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.273 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%idxprom22 = zext i32 %i.273 to i64
%arrayidx23 = getelementptr inbounds [500000 x i32], ptr %L, i64 0, i64 %idxprom22
%15 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = zext i32 %j.074 to i64
%arrayidx25 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom24
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.not = icmp sle i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%inc31 = zext i1 %cmp26.not to i32
%i.3 = add nuw nsw i32 %i.273, %inc31
%not.cmp26.not = xor i1 %cmp26.not, true
%inc37 = zext i1 %not.cmp26.not to i32
%j.1 = add nuw nsw i32 %j.074, %inc37
%17 = getelementptr inbounds i32, ptr %ar, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%storemerge.in = load i32, ptr @count, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end41, label %for.body21, !llvm.loop !9
for.end41: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %R) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %L) #6
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %ar, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergesort(ptr noundef %ar, i32 noundef %left, i32 noundef %div)
tail call void @mergesort(ptr noundef %ar, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %ar, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 0, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%storemerge18 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%idxprom = sext i32 %storemerge18 to i64
%arrayidx = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %idxprom
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
tail call void @mergesort(ptr noundef nonnull @a, i32 noundef 0, i32 noundef %.lcssa)
store i32 0, ptr @i, align 4, !tbaa !5
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp319 = icmp sgt i32 %3, 0
br i1 %cmp319, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %if.end
%storemerge1620 = phi i32 [ %inc11, %if.end ], [ 0, %for.end ]
%cmp5.not = icmp eq i32 %storemerge1620, 0
br i1 %cmp5.not, label %if.end, label %if.then
if.then: ; preds = %for.body4
%4 = load ptr, ptr @stdout, align 8, !tbaa !12
%call.i = tail call i32 @putc(i32 noundef 32, ptr noundef %4)
%.pre = load i32, ptr @i, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body4
%5 = phi i32 [ %.pre, %if.then ], [ 0, %for.body4 ]
%idxprom7 = sext i32 %5 to i64
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%7 = load i32, ptr @i, align 4, !tbaa !5
%inc11 = add nsw i32 %7, 1
store i32 %inc11, ptr @i, align 4, !tbaa !5
%8 = load i32, ptr @n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc11, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !14
for.end12: ; preds = %if.end, %for.end
%9 = load i32, ptr @count, align 4, !tbaa !5
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define N 500
int main(void)
{
int n, m, q;
scanf("%d%d%d", &n, &m, &q);
int points[N][N] = {0};
rep (i, m) {
int li, ri;
scanf("%d%d", &li, &ri);
li--;
ri--;
points[li][ri] += 1;
}
int cumsum[N + 1][N + 1] = {0};
rep (i, N) {
rep (j, N) {
cumsum[i + 1][j + 1] = cumsum[i][j + 1]
+ cumsum[i + 1][j]
- cumsum[i][j]
+ points[i][j];
}
}
rep (i, q) {
int pi, qi;
scanf("%d%d", &pi, &qi);
pi--;
int ans = cumsum[qi][qi]
- cumsum[qi][pi]
- cumsum[pi][qi]
+ cumsum[pi][pi];
printf("%d\n", ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148633/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148633/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%q = alloca i32, align 4
%points = alloca [500 x [500 x i32]], align 16
%li = alloca i32, align 4
%ri = alloca i32, align 4
%cumsum = alloca [501 x [501 x i32]], align 16
%pi = alloca i32, align 4
%qi = 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 %q) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %q)
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %points) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000000) %points, i8 0, i64 1000000, i1 false)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp93 = icmp sgt i32 %0, 0
br i1 %cmp93, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
call void @llvm.lifetime.start.p0(i64 1004004, ptr nonnull %cumsum) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1004004) %cumsum, i8 0, i64 1004004, i1 false)
br label %for.cond10.preheader
for.body: ; preds = %entry, %for.body
%i.094 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %li) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ri) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %li, ptr noundef nonnull %ri)
%1 = load i32, ptr %li, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
%2 = load i32, ptr %ri, align 4, !tbaa !5
%dec2 = add nsw i32 %2, -1
%idxprom = sext i32 %dec to i64
%idxprom3 = sext i32 %dec2 to i64
%arrayidx4 = getelementptr inbounds [500 x [500 x i32]], ptr %points, i64 0, i64 %idxprom, i64 %idxprom3
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%add = add nsw i32 %3, 1
store i32 %add, ptr %arrayidx4, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ri) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %li) #4
%inc = add nuw nsw i32 %i.094, 1
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond10.preheader: ; preds = %for.cond.cleanup, %for.cond.cleanup12
%indvars.iv100 = phi i64 [ 0, %for.cond.cleanup ], [ %indvars.iv.next101, %for.cond.cleanup12 ]
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%arrayidx23.phi.trans.insert = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %indvars.iv.next101, i64 0
%.pre = load i32, ptr %arrayidx23.phi.trans.insert, align 4, !tbaa !5
%arrayidx28.phi.trans.insert = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %indvars.iv100, i64 0
%.pre104 = load i32, ptr %arrayidx28.phi.trans.insert, align 4, !tbaa !5
br label %for.body13
for.cond47.preheader: ; preds = %for.cond.cleanup12
%5 = load i32, ptr %q, align 4, !tbaa !5
%cmp4897 = icmp sgt i32 %5, 0
br i1 %cmp4897, label %for.body50, label %for.cond.cleanup49
for.cond.cleanup12: ; preds = %for.body13
%exitcond103.not = icmp eq i64 %indvars.iv.next101, 500
br i1 %exitcond103.not, label %for.cond47.preheader, label %for.cond10.preheader, !llvm.loop !11
for.body13: ; preds = %for.body13, %for.cond10.preheader
%6 = phi i32 [ %.pre104, %for.cond10.preheader ], [ %10, %for.body13 ]
%7 = phi i32 [ %.pre, %for.cond10.preheader ], [ %add33.1, %for.body13 ]
%indvars.iv = phi i64 [ 0, %for.cond10.preheader ], [ %indvars.iv.next.1, %for.body13 ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx18 = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %indvars.iv100, i64 %indvars.iv.next
%8 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%add24 = add nsw i32 %7, %8
%sub = sub i32 %add24, %6
%arrayidx32 = getelementptr inbounds [500 x [500 x i32]], ptr %points, i64 0, i64 %indvars.iv100, i64 %indvars.iv
%9 = load i32, ptr %arrayidx32, align 8, !tbaa !5
%add33 = add nsw i32 %sub, %9
%arrayidx39 = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %indvars.iv.next101, i64 %indvars.iv.next
store i32 %add33, ptr %arrayidx39, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx18.1 = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %indvars.iv100, i64 %indvars.iv.next.1
%10 = load i32, ptr %arrayidx18.1, align 4, !tbaa !5
%add24.1 = add nsw i32 %add33, %10
%sub.1 = sub i32 %add24.1, %8
%arrayidx32.1 = getelementptr inbounds [500 x [500 x i32]], ptr %points, i64 0, i64 %indvars.iv100, i64 %indvars.iv.next
%11 = load i32, ptr %arrayidx32.1, align 4, !tbaa !5
%add33.1 = add nsw i32 %sub.1, %11
%arrayidx39.1 = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %indvars.iv.next101, i64 %indvars.iv.next.1
store i32 %add33.1, ptr %arrayidx39.1, align 4, !tbaa !5
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 500
br i1 %exitcond.not.1, label %for.cond.cleanup12, label %for.body13, !llvm.loop !12
for.cond.cleanup49: ; preds = %for.body50, %for.cond47.preheader
call void @llvm.lifetime.end.p0(i64 1004004, ptr nonnull %cumsum) #4
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %points) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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
for.body50: ; preds = %for.cond47.preheader, %for.body50
%i46.098 = phi i32 [ %inc74, %for.body50 ], [ 0, %for.cond47.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %pi) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %qi) #4
%call51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %pi, ptr noundef nonnull %qi)
%12 = load i32, ptr %pi, align 4, !tbaa !5
%dec52 = add nsw i32 %12, -1
store i32 %dec52, ptr %pi, align 4, !tbaa !5
%13 = load i32, ptr %qi, align 4, !tbaa !5
%idxprom53 = sext i32 %13 to i64
%arrayidx56 = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %idxprom53, i64 %idxprom53
%14 = load i32, ptr %arrayidx56, align 4, !tbaa !5
%idxprom59 = sext i32 %dec52 to i64
%arrayidx60 = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %idxprom53, i64 %idxprom59
%15 = load i32, ptr %arrayidx60, align 4, !tbaa !5
%arrayidx65 = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %idxprom59, i64 %idxprom53
%16 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%arrayidx70 = getelementptr inbounds [501 x [501 x i32]], ptr %cumsum, i64 0, i64 %idxprom59, i64 %idxprom59
%17 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%18 = add i32 %15, %16
%sub66 = sub i32 %14, %18
%add71 = add nsw i32 %sub66, %17
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add71)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %qi) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %pi) #4
%inc74 = add nuw nsw i32 %i46.098, 1
%19 = load i32, ptr %q, align 4, !tbaa !5
%cmp48 = icmp slt i32 %inc74, %19
br i1 %cmp48, label %for.body50, label %for.cond.cleanup49, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define N 507
int main (void) {
int n, m, k, l, r, p, q, a[N][N], b[N][N];
scanf("%d %d %d", &n, &m, &k);
for (int i = 0; i < m; i++) {
scanf("%d %d", &l, &r);
a[l][r]++;
}
for (int i = 0; i <= n; i++)
b[i][0] = b[0][i] = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
b[i][j] = b[i-1][j] + b[i][j-1] - b[i-1][j-1] + a[i][j];
for (int i = 0; i < k; i++) {
scanf("%d %d", &p, &q);
printf("%d\n", b[q][q] - b[p-1][q] - b[q][p-1] + b[p-1][p-1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148677/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148677/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%k = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
%p = alloca i32, align 4
%q = alloca i32, align 4
%a = alloca [507 x [507 x i32]], align 16
%b = alloca [507 x [507 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 %k) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 1028196, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 1028196, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %k)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp112 = icmp sgt i32 %0, 0
br i1 %cmp112, label %for.body, label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp7.not114 = icmp slt i32 %1, 0
br i1 %cmp7.not114, label %for.cond60.preheader, label %for.body9.preheader
for.body9.preheader: ; preds = %for.cond6.preheader
%2 = add nuw i32 %1, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %wide.trip.count, 3
%4 = icmp ult i32 %1, 3
br i1 %4, label %for.cond20.preheader.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body9
for.body: ; preds = %entry, %for.body
%i.0113 = phi i32 [ %inc4, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l, ptr noundef nonnull %r)
%5 = load i32, ptr %l, align 4, !tbaa !5
%idxprom = sext i32 %5 to i64
%6 = load i32, ptr %r, align 4, !tbaa !5
%idxprom2 = sext i32 %6 to i64
%arrayidx3 = getelementptr inbounds [507 x [507 x i32]], ptr %a, i64 0, i64 %idxprom, i64 %idxprom2
%7 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%inc = add nsw i32 %7, 1
store i32 %inc, ptr %arrayidx3, align 4, !tbaa !5
%inc4 = add nuw nsw i32 %i.0113, 1
%8 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc4, %8
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.cond20.preheader.unr-lcssa: ; preds = %for.body9, %for.body9.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next.3, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond20.preheader, label %for.body9.epil
for.body9.epil: ; preds = %for.cond20.preheader.unr-lcssa, %for.body9.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body9.epil ], [ %indvars.iv.unr, %for.cond20.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body9.epil ], [ 0, %for.cond20.preheader.unr-lcssa ]
%arrayidx12.epil = getelementptr inbounds [507 x i32], ptr %b, i64 0, i64 %indvars.iv.epil
store i32 0, ptr %arrayidx12.epil, align 4, !tbaa !5
%arrayidx14.epil = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv.epil
store i32 0, ptr %arrayidx14.epil, align 4, !tbaa !5
%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.cond20.preheader, label %for.body9.epil, !llvm.loop !11
for.cond20.preheader: ; preds = %for.body9.epil, %for.cond20.preheader.unr-lcssa
%cmp21.not118 = icmp slt i32 %1, 1
br i1 %cmp21.not118, label %for.cond60.preheader, label %for.cond24.preheader.preheader
for.cond24.preheader.preheader: ; preds = %for.cond20.preheader
%9 = add nuw i32 %1, 1
%wide.trip.count133 = zext i32 %9 to i64
%.pre135.pre = load i32, ptr %b, align 16, !tbaa !5
%xtraiter138 = and i64 %3, 1
%10 = icmp eq i32 %2, 2
%unroll_iter142 = and i64 %3, -2
%lcmp.mod141.not = icmp eq i64 %xtraiter138, 0
br label %for.cond24.preheader
for.body9: ; preds = %for.body9, %for.body9.preheader.new
%indvars.iv = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next.3, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.3, %for.body9 ]
%arrayidx12 = getelementptr inbounds [507 x i32], ptr %b, i64 0, i64 %indvars.iv
store i32 0, ptr %arrayidx12, align 16, !tbaa !5
%arrayidx14 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv
store i32 0, ptr %arrayidx14, align 16, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx12.1 = getelementptr inbounds [507 x i32], ptr %b, i64 0, i64 %indvars.iv.next
store i32 0, ptr %arrayidx12.1, align 4, !tbaa !5
%arrayidx14.1 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv.next
store i32 0, ptr %arrayidx14.1, align 4, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx12.2 = getelementptr inbounds [507 x i32], ptr %b, i64 0, i64 %indvars.iv.next.1
store i32 0, ptr %arrayidx12.2, align 8, !tbaa !5
%arrayidx14.2 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv.next.1
store i32 0, ptr %arrayidx14.2, align 8, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx12.3 = getelementptr inbounds [507 x i32], ptr %b, i64 0, i64 %indvars.iv.next.2
store i32 0, ptr %arrayidx12.3, align 4, !tbaa !5
%arrayidx14.3 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv.next.2
store i32 0, ptr %arrayidx14.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add nuw i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond20.preheader.unr-lcssa, label %for.body9, !llvm.loop !13
for.cond24.preheader: ; preds = %for.cond24.preheader.preheader, %for.cond24.for.cond.cleanup26_crit_edge
%.pre135 = phi i32 [ %.pre135.pre, %for.cond24.preheader.preheader ], [ %.pre, %for.cond24.for.cond.cleanup26_crit_edge ]
%indvars.iv129 = phi i64 [ 1, %for.cond24.preheader.preheader ], [ %indvars.iv.next130, %for.cond24.for.cond.cleanup26_crit_edge ]
%11 = add nsw i64 %indvars.iv129, -1
%arrayidx36.phi.trans.insert = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv129, i64 0
%.pre = load i32, ptr %arrayidx36.phi.trans.insert, align 4, !tbaa !5
br i1 %10, label %for.cond24.for.cond.cleanup26_crit_edge.unr-lcssa, label %for.body27
for.cond60.preheader: ; preds = %for.cond24.for.cond.cleanup26_crit_edge, %for.cond6.preheader, %for.cond20.preheader
%12 = load i32, ptr %k, align 4, !tbaa !5
%cmp61120 = icmp sgt i32 %12, 0
br i1 %cmp61120, label %for.body63, label %for.cond.cleanup62
for.cond24.for.cond.cleanup26_crit_edge.unr-lcssa: ; preds = %for.body27, %for.cond24.preheader
%.unr = phi i32 [ %.pre135, %for.cond24.preheader ], [ %19, %for.body27 ]
%.unr140 = phi i32 [ %.pre, %for.cond24.preheader ], [ %add48.1, %for.body27 ]
%indvars.iv123.unr = phi i64 [ 1, %for.cond24.preheader ], [ %indvars.iv.next124.1, %for.body27 ]
br i1 %lcmp.mod141.not, label %for.cond24.for.cond.cleanup26_crit_edge, label %for.body27.epil
for.body27.epil: ; preds = %for.cond24.for.cond.cleanup26_crit_edge.unr-lcssa
%arrayidx31.epil = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %11, i64 %indvars.iv123.unr
%13 = load i32, ptr %arrayidx31.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %.unr140, %13
%sub43.epil = sub i32 %add.epil, %.unr
%arrayidx47.epil = getelementptr inbounds [507 x [507 x i32]], ptr %a, i64 0, i64 %indvars.iv129, i64 %indvars.iv123.unr
%14 = load i32, ptr %arrayidx47.epil, align 4, !tbaa !5
%add48.epil = add nsw i32 %sub43.epil, %14
%arrayidx52.epil = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv129, i64 %indvars.iv123.unr
store i32 %add48.epil, ptr %arrayidx52.epil, align 4, !tbaa !5
br label %for.cond24.for.cond.cleanup26_crit_edge
for.cond24.for.cond.cleanup26_crit_edge: ; preds = %for.cond24.for.cond.cleanup26_crit_edge.unr-lcssa, %for.body27.epil
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%exitcond134.not = icmp eq i64 %indvars.iv.next130, %wide.trip.count133
br i1 %exitcond134.not, label %for.cond60.preheader, label %for.cond24.preheader, !llvm.loop !14
for.body27: ; preds = %for.cond24.preheader, %for.body27
%15 = phi i32 [ %19, %for.body27 ], [ %.pre135, %for.cond24.preheader ]
%16 = phi i32 [ %add48.1, %for.body27 ], [ %.pre, %for.cond24.preheader ]
%indvars.iv123 = phi i64 [ %indvars.iv.next124.1, %for.body27 ], [ 1, %for.cond24.preheader ]
%niter143 = phi i64 [ %niter143.next.1, %for.body27 ], [ 0, %for.cond24.preheader ]
%arrayidx31 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %11, i64 %indvars.iv123
%17 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%add = add nsw i32 %16, %17
%sub43 = sub i32 %add, %15
%arrayidx47 = getelementptr inbounds [507 x [507 x i32]], ptr %a, i64 0, i64 %indvars.iv129, i64 %indvars.iv123
%18 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%add48 = add nsw i32 %sub43, %18
%arrayidx52 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv129, i64 %indvars.iv123
store i32 %add48, ptr %arrayidx52, align 4, !tbaa !5
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%arrayidx31.1 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %11, i64 %indvars.iv.next124
%19 = load i32, ptr %arrayidx31.1, align 4, !tbaa !5
%add.1 = add nsw i32 %add48, %19
%sub43.1 = sub i32 %add.1, %17
%arrayidx47.1 = getelementptr inbounds [507 x [507 x i32]], ptr %a, i64 0, i64 %indvars.iv129, i64 %indvars.iv.next124
%20 = load i32, ptr %arrayidx47.1, align 4, !tbaa !5
%add48.1 = add nsw i32 %sub43.1, %20
%arrayidx52.1 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %indvars.iv129, i64 %indvars.iv.next124
store i32 %add48.1, ptr %arrayidx52.1, align 4, !tbaa !5
%indvars.iv.next124.1 = add nuw nsw i64 %indvars.iv123, 2
%niter143.next.1 = add i64 %niter143, 2
%niter143.ncmp.1 = icmp eq i64 %niter143.next.1, %unroll_iter142
br i1 %niter143.ncmp.1, label %for.cond24.for.cond.cleanup26_crit_edge.unr-lcssa, label %for.body27, !llvm.loop !15
for.cond.cleanup62: ; preds = %for.body63, %for.cond60.preheader
call void @llvm.lifetime.end.p0(i64 1028196, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 1028196, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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
for.body63: ; preds = %for.cond60.preheader, %for.body63
%i59.0121 = phi i32 [ %inc90, %for.body63 ], [ 0, %for.cond60.preheader ]
%call64 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %p, ptr noundef nonnull %q)
%21 = load i32, ptr %q, align 4, !tbaa !5
%idxprom65 = sext i32 %21 to i64
%arrayidx68 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %idxprom65, i64 %idxprom65
%22 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%23 = load i32, ptr %p, align 4, !tbaa !5
%sub69 = add nsw i32 %23, -1
%idxprom70 = sext i32 %sub69 to i64
%arrayidx73 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %idxprom70, i64 %idxprom65
%24 = load i32, ptr %arrayidx73, align 4, !tbaa !5
%arrayidx79 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %idxprom65, i64 %idxprom70
%25 = load i32, ptr %arrayidx79, align 4, !tbaa !5
%arrayidx86 = getelementptr inbounds [507 x [507 x i32]], ptr %b, i64 0, i64 %idxprom70, i64 %idxprom70
%26 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%27 = add i32 %24, %25
%sub80 = sub i32 %22, %27
%add87 = add nsw i32 %sub80, %26
%call88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add87)
%inc90 = add nuw nsw i32 %i59.0121, 1
%28 = load i32, ptr %k, align 4, !tbaa !5
%cmp61 = icmp slt i32 %inc90, %28
br i1 %cmp61, label %for.body63, label %for.cond.cleanup62, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
#include<string.h>
int main(){
int i = 1;
int a,b;
scanf("%d %d", &a, &b);
while(1){
if(a == i*8/100 && b == i/10){
printf("%d\n", i);
break;
}
i++;
if(i == 2000000){
printf("-1\n");
break;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148763/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148763/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4
br label %while.cond
while.cond: ; preds = %if.end, %entry
%i.0 = phi i32 [ 1, %entry ], [ %inc, %if.end ]
%mul = shl nsw i32 %i.0, 3
%div = udiv i32 %mul, 100
%cmp = icmp eq i32 %0, %div
%div1 = udiv i32 %i.0, 10
%cmp2 = icmp eq i32 %1, %div1
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %while.cond
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0)
br label %while.end
if.end: ; preds = %while.cond
%inc = add nuw nsw i32 %i.0, 1
%cmp4 = icmp eq i32 %inc, 2000000
br i1 %cmp4, label %if.then5, label %while.cond
if.then5: ; preds = %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %while.end
while.end: ; preds = %if.then5, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int A,B,i;
scanf("%d %d",&A,&B);
for(i=1; i<=1001; i++){
if(( (int)(i*0.08) == A )&& ( (int)(i*0.1) == B)){
printf("%d\n",i);
return 0;
}
}
printf("-1\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148820/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148820/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4
br label %for.body
for.body: ; preds = %for.inc.1, %entry
%i.018 = phi i32 [ 1, %entry ], [ %inc.1, %for.inc.1 ]
%conv = sitofp i32 %i.018 to double
%mul = fmul double %conv, 8.000000e-02
%conv1 = fptosi double %mul to i32
%cmp2 = icmp eq i32 %0, %conv1
br i1 %cmp2, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%mul5 = fmul double %conv, 1.000000e-01
%conv6 = fptosi double %mul5 to i32
%cmp7 = icmp eq i32 %1, %conv6
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true.1, %land.lhs.true
%i.018.lcssa = phi i32 [ %i.018, %land.lhs.true ], [ %inc, %land.lhs.true.1 ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.018.lcssa)
br label %cleanup
for.inc: ; preds = %for.body, %land.lhs.true
%inc = add nuw nsw i32 %i.018, 1
%exitcond.not = icmp eq i32 %inc, 1002
br i1 %exitcond.not, label %for.end, label %for.body.1, !llvm.loop !9
for.body.1: ; preds = %for.inc
%conv.1 = sitofp i32 %inc to double
%mul.1 = fmul double %conv.1, 8.000000e-02
%conv1.1 = fptosi double %mul.1 to i32
%cmp2.1 = icmp eq i32 %0, %conv1.1
br i1 %cmp2.1, label %land.lhs.true.1, label %for.inc.1
land.lhs.true.1: ; preds = %for.body.1
%mul5.1 = fmul double %conv.1, 1.000000e-01
%conv6.1 = fptosi double %mul5.1 to i32
%cmp7.1 = icmp eq i32 %1, %conv6.1
br i1 %cmp7.1, label %if.then, label %for.inc.1
for.inc.1: ; preds = %land.lhs.true.1, %for.body.1
%inc.1 = add nuw nsw i32 %i.018, 2
br label %for.body
for.end: ; preds = %for.inc
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
cleanup: ; preds = %for.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include "stdio.h"
int main(void){
int A,B;
int check = -1;
scanf("%d%d",&A,&B);
for(int i = 1000; i > 0; i--){
if(i*8/100 == A && i*10/100 == B){
check = i;
}
}
printf("%d\n", check);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148864/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148864/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4
br label %for.body
for.cond.cleanup: ; preds = %for.inc
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %check.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
for.body: ; preds = %entry, %for.inc
%i.012 = phi i32 [ 1000, %entry ], [ %dec, %for.inc ]
%check.011 = phi i32 [ -1, %entry ], [ %check.1, %for.inc ]
%mul = shl nsw i32 %i.012, 3
%div.udiv = udiv i32 %mul, 100
%cmp1 = icmp eq i32 %div.udiv, %0
br i1 %cmp1, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%div310 = udiv i32 %i.012, 10
%cmp4 = icmp eq i32 %div310, %1
%spec.select = select i1 %cmp4, i32 %i.012, i32 %check.011
br label %for.inc
for.inc: ; preds = %land.lhs.true, %for.body
%check.1 = phi i32 [ %check.011, %for.body ], [ %spec.select, %land.lhs.true ]
%dec = add nsw i32 %i.012, -1
%cmp = icmp ugt i32 %i.012, 1
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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i, n) for(i=0;i<(int)(n);i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define bit(n) (1LL<<(n))
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(void){
int a,b,i,tmp,tmp2,result=-1;
scanf("%d %d", &a, &b);
for(i=a;i<=1000;i++){
tmp = (int) (i * 0.08);
tmp2 = (int) (i / 10);
if(tmp == a && tmp2 == b){
result=i;
break;
}
}
printf("%d", result);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148907/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148907/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dx = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16
@dy = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 1, i32 0, i32 -1], align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%tobool.not4 = icmp eq i32 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i32 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%tobool.not4.i = icmp eq i32 %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 i32 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i32 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i32 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i32 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
%mul = mul nsw i32 %b, %a
%div = sdiv i32 %mul, %a.tr.lcssa.i
ret i32 %div
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, 1001
br i1 %cmp11, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %b, align 4
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.012 = phi i32 [ %0, %for.body.lr.ph ], [ %inc, %for.inc ]
%conv = sitofp i32 %i.012 to double
%mul = fmul double %conv, 8.000000e-02
%conv1 = fptosi double %mul to i32
%cmp2 = icmp eq i32 %0, %conv1
%div = sdiv i32 %i.012, 10
%cmp4 = icmp eq i32 %div, %1
%or.cond = select i1 %cmp2, i1 %cmp4, i1 false
br i1 %or.cond, label %for.end, label %for.inc
for.inc: ; preds = %for.body
%inc = add i32 %i.012, 1
%exitcond.not = icmp eq i32 %inc, 1001
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %for.body, %entry
%result.0 = phi i32 [ -1, %entry ], [ %i.012, %for.body ], [ -1, %for.inc ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %result.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #2
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
return *(ll*)b-*(ll*)a;
}
int z(int a){
if(a<1)a*=-1;
return a;
}
int min(int a,int b){
if(a>b)return b;
return a;
}
int max(int a,int b){
if(a>b)return a;
return b;
}
int gcd(int a,int b){
if(!b)return a;
return gcd(b,a%b);
}
int main(void){
int a,b;
scanf("%d %d",&a,&b);
PRN((b-1)/a+1);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148950/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148950/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @u(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @d(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @z(i32 noundef %a) local_unnamed_addr #1 {
entry:
%spec.select = tail call i32 @llvm.abs.i32(i32 %a, i1 true)
ret i32 %spec.select
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %b.a
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; 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:
%tobool.not4 = icmp eq i32 %b, 0
br i1 %tobool.not4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i32 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !9
%sub = add nsw i32 %0, -1
%1 = load i32, ptr %a, align 4, !tbaa !9
%div = sdiv i32 %sub, %1
%add = add nsw i32 %div, 1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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: nofree nounwind
declare noundef i32 @printf(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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define rep(i,n)Rep(i,0,n)
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
typedef long long ll;
typedef long double ld;
int main() {
int n, j, a[100001];
scanf("%d", &n);
rep(i,n) {
scanf("%d", &j);
a[j] = i+1;
}
Rep(i,1,n+1) {
printf("%d ", a[i]);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148994/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148994/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%j = alloca i32, align 4
%a = alloca [100001 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 %j) #3
call void @llvm.lifetime.start.p0(i64 400004, 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
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.cond.cleanup6
for.cond3.preheader: ; preds = %for.body
%1 = icmp slt i32 %3, 1
br i1 %1, label %for.cond.cleanup6, label %for.body7
for.body: ; preds = %entry, %for.body
%i.019 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j)
%add = add nuw nsw i32 %i.019, 1
%2 = load i32, ptr %j, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %add, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond.cleanup6: ; preds = %for.body7, %entry, %for.cond3.preheader
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body7: ; preds = %for.cond3.preheader, %for.body7
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ 1, %for.cond3.preheader ]
%arrayidx9 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %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
%cmp5.not.not = icmp slt i64 %indvars.iv, %6
br i1 %cmp5.not.not, label %for.body7, label %for.cond.cleanup6, !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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int n;
scanf("%d", &n);
int x, order[n];
for(int i = 0; i < n; i++){
scanf("%d", &x);
order[x - 1] = i + 1;
}
for(int i = 0; i < n; i++){
printf("%d ", order[i]);
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149036/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149036/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %3, 0
br i1 %cmp18, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%4 = icmp sgt i32 %6, 0
br i1 %4, label %for.body6, label %for.cond.cleanup5
for.body: ; preds = %entry, %for.body
%i.019 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%add = add nuw nsw i32 %i.019, 1
%5 = load i32, ptr %x, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %idxprom
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %add, %6
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond.cleanup5: ; preds = %for.body6, %entry, %for.cond3.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body6: ; preds = %for.cond3.preheader, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 0, %for.cond3.preheader ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !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
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int t;
long long int n,k,x,y;
int main()
{
scanf("%d",&t);
while(t--)
{
y=0;
scanf("%lld %lld",&n,&k);
if(n>k)
printf("%lld\n",k);
else
{
x=k/(n-1);
if(k%(n-1)!=0)
y=1;
printf("%lld\n",x+k-1+y);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14908/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14908/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@y = dso_local local_unnamed_addr global i64 0, align 8
@.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@n = dso_local global i64 0, align 8
@k = dso_local global i64 0, align 8
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@x = dso_local local_unnamed_addr global i64 0, align 8
; 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)
%0 = load i32, ptr @t, align 4, !tbaa !5
%dec11 = add nsw i32 %0, -1
store i32 %dec11, ptr @t, align 4, !tbaa !5
%tobool.not12 = icmp eq i32 %0, 0
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end9
store i64 0, ptr @y, align 8, !tbaa !9
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @k)
%1 = load i64, ptr @n, align 8, !tbaa !9
%2 = load i64, ptr @k, align 8, !tbaa !9
%cmp = icmp sgt i64 %1, %2
br i1 %cmp, label %if.end9, label %if.else
if.else: ; preds = %while.body
%sub = add nsw i64 %1, -1
%div = sdiv i64 %2, %sub
store i64 %div, ptr @x, align 8, !tbaa !9
%rem = srem i64 %2, %sub
%cmp4.not = icmp eq i64 %rem, 0
br i1 %cmp4.not, label %if.else.if.end_crit_edge, label %if.then5
if.else.if.end_crit_edge: ; preds = %if.else
%.pre = load i64, ptr @y, align 8, !tbaa !9
br label %if.end
if.then5: ; preds = %if.else
store i64 1, ptr @y, align 8, !tbaa !9
br label %if.end
if.end: ; preds = %if.else.if.end_crit_edge, %if.then5
%3 = phi i64 [ %.pre, %if.else.if.end_crit_edge ], [ 1, %if.then5 ]
%add = add i64 %2, -1
%sub6 = add i64 %add, %div
%add7 = add nsw i64 %sub6, %3
br label %if.end9
if.end9: ; preds = %while.body, %if.end
%add7.sink = phi i64 [ %add7, %if.end ], [ %2, %while.body ]
%call8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add7.sink)
%4 = load i32, ptr @t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr @t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end9, %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdlib.h>
#include <stdio.h>
typedef struct{
int number;
int attend;
}student;
int compare(const void *a,const void*b){
student x=*(student *)a,y=*(student*)b;
int tmp1=x.attend,tmp2=y.attend;
if(tmp1>tmp2)return 1;
return -1;
}
int main()
{
int n,ans=0;
scanf("%d",&n);
student a[n];
for(int i=0;i<n;i++){
scanf("%d",&a[i].attend);
a[i].number=i+1;
}
qsort(a,n,sizeof(student),compare);
for(int i=0;i<n;i++)
printf("%d ",a[i].number);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149122/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149122/source.c"
target datalayout = "e-m:e-p270: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.student = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%x.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %a, i64 4
%x.sroa.3.0.copyload = load i32, ptr %x.sroa.3.0..sroa_idx, align 4, !tbaa.struct !5
%y.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %b, i64 4
%y.sroa.3.0.copyload = load i32, ptr %y.sroa.3.0..sroa_idx, align 4, !tbaa.struct !5
%cmp = icmp sgt i32 %x.sroa.3.0.copyload, %y.sroa.3.0.copyload
%. = select i1 %cmp, i32 1, i32 -1
ret i32 %.
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !6
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.student, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !6
%cmp23 = icmp sgt i32 %3, 0
br i1 %cmp23, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %7, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @compare) #6
%4 = load i32, ptr %n, align 4, !tbaa !6
%cmp625 = icmp sgt i32 %4, 0
br i1 %cmp625, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.student, ptr %vla, i64 %indvars.iv
%attend = getelementptr inbounds %struct.student, ptr %vla, i64 %indvars.iv, i32 1
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %attend)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = trunc i64 %indvars.iv.next to i32
store i32 %5, ptr %arrayidx, align 8, !tbaa !10
%6 = load i32, ptr %n, align 4, !tbaa !6
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.cond.cleanup8: ; preds = %for.body9, %for.cond.cleanup
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body9: ; preds = %for.cond.cleanup, %for.body9
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body9 ], [ 0, %for.cond.cleanup ]
%arrayidx11 = getelementptr inbounds %struct.student, ptr %vla, i64 %indvars.iv29
%8 = load i32, ptr %arrayidx11, align 8, !tbaa !10
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%9 = load i32, ptr %n, align 4, !tbaa !6
%10 = sext i32 %9 to i64
%cmp6 = icmp slt i64 %indvars.iv.next30, %10
br i1 %cmp6, label %for.body9, label %for.cond.cleanup8, !llvm.loop !14
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{i64 0, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 0}
!11 = !{!"", !7, i64 0, !7, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
int main() {
int sum, i, j;
int a[100000];
int tmp[100000];
scanf("%d", &sum);
for (i = 0; i < sum; i++) {
scanf("%d", &a[i]);
}
for (i = 0; i < sum; i++) {
tmp[a[i] - 1] = i + 1;
}
for (i = 0; i < sum; i++) {
printf("%d\n", tmp[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149166/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149166/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%sum = alloca i32, align 4
%a = alloca [100000 x i32], align 16
%tmp = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sum) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %tmp) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sum)
%0 = load i32, ptr %sum, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.end20
for.cond2.preheader: ; preds = %for.body
%cmp332 = icmp sgt i32 %2, 0
br i1 %cmp332, label %for.body4.preheader, label %for.end20
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.cond12.preheader.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %sum, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond12.preheader.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%indvars.iv38.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next39.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond12.preheader, label %for.body4.epil
for.body4.epil: ; preds = %for.cond12.preheader.unr-lcssa, %for.body4.epil
%indvars.iv38.epil = phi i64 [ %indvars.iv.next39.epil, %for.body4.epil ], [ %indvars.iv38.unr, %for.cond12.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.cond12.preheader.unr-lcssa ]
%indvars.iv.next39.epil = add nuw nsw i64 %indvars.iv38.epil, 1
%arrayidx6.epil = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv38.epil
%4 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%sub.epil = add nsw i32 %4, -1
%idxprom7.epil = sext i32 %sub.epil to i64
%arrayidx8.epil = getelementptr inbounds [100000 x i32], ptr %tmp, i64 0, i64 %idxprom7.epil
%5 = trunc i64 %indvars.iv.next39.epil to i32
store i32 %5, ptr %arrayidx8.epil, align 4, !tbaa !5
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond12.preheader, label %for.body4.epil, !llvm.loop !11
for.cond12.preheader: ; preds = %for.body4.epil, %for.cond12.preheader.unr-lcssa
br i1 %cmp332, label %for.body14, label %for.end20
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv38 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next39.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%indvars.iv.next39 = or i64 %indvars.iv38, 1
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv38
%6 = load i32, ptr %arrayidx6, align 16, !tbaa !5
%sub = add nsw i32 %6, -1
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %tmp, i64 0, i64 %idxprom7
%7 = trunc i64 %indvars.iv.next39 to i32
store i32 %7, ptr %arrayidx8, align 4, !tbaa !5
%indvars.iv.next39.1 = or i64 %indvars.iv38, 2
%arrayidx6.1 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv.next39
%8 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%sub.1 = add nsw i32 %8, -1
%idxprom7.1 = sext i32 %sub.1 to i64
%arrayidx8.1 = getelementptr inbounds [100000 x i32], ptr %tmp, i64 0, i64 %idxprom7.1
%9 = trunc i64 %indvars.iv.next39.1 to i32
store i32 %9, ptr %arrayidx8.1, align 4, !tbaa !5
%indvars.iv.next39.2 = or i64 %indvars.iv38, 3
%arrayidx6.2 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv.next39.1
%10 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5
%sub.2 = add nsw i32 %10, -1
%idxprom7.2 = sext i32 %sub.2 to i64
%arrayidx8.2 = getelementptr inbounds [100000 x i32], ptr %tmp, i64 0, i64 %idxprom7.2
%11 = trunc i64 %indvars.iv.next39.2 to i32
store i32 %11, ptr %arrayidx8.2, align 4, !tbaa !5
%indvars.iv.next39.3 = add nuw nsw i64 %indvars.iv38, 4
%arrayidx6.3 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv.next39.2
%12 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%sub.3 = add nsw i32 %12, -1
%idxprom7.3 = sext i32 %sub.3 to i64
%arrayidx8.3 = getelementptr inbounds [100000 x i32], ptr %tmp, i64 0, i64 %idxprom7.3
%13 = trunc i64 %indvars.iv.next39.3 to i32
store i32 %13, ptr %arrayidx8.3, align 4, !tbaa !5
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond12.preheader.unr-lcssa, label %for.body4, !llvm.loop !13
for.body14: ; preds = %for.cond12.preheader, %for.body14
%indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body14 ], [ 0, %for.cond12.preheader ]
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr %tmp, i64 0, i64 %indvars.iv41
%14 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%15 = load i32, ptr %sum, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp13 = icmp slt i64 %indvars.iv.next42, %16
br i1 %cmp13, label %for.body14, label %for.end20, !llvm.loop !14
for.end20: ; preds = %for.body14, %entry, %for.cond2.preheader, %for.cond12.preheader
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %tmp) #3
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sum) #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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#define SIZE10 100000
typedef long long int ll;
typedef unsigned char u8;
int i = 0, j = 0;
struct student{
int mem;
int time;
};
int partition(struct student *num, int start, int end, int p);
void quicksort(struct student *num, int start, int end);
int partition(struct student *num, int start,int end, int p){
i = start, j = end;
struct student temp;
while(i <= j){
while(i <= end && num[i].mem <= p){
i++;
}
while(j >= start && num[j].mem > p){
j--;
}
if(i > j){
break;
}
temp = num[i];
num[i] = num[j];
num[j] = temp;
}
return i;
}
void quicksort(struct student *num, int start, int end){
if(start == end){
return ;
}
int p = num[start].mem;
int flg = 0;
int base = start;
int k = 0;
while(base <= end){
if(num[base].mem < p){
flg = 1;
p = num[base].mem;
break;
}else if(num[base].mem > p){
flg = 1;
break;
}
base++;
}
if(flg == 1){
k = partition(num, start, end, p);
quicksort(num, start, k-1);
quicksort(num, k, end);
}
}
int main(void){
int N = 0;
int A[SIZE10];
struct student std[SIZE10];
scanf("%d", &N);
for(i = 0; i < N; i++){
scanf("%d", &A[i]);
std[i].mem = A[i];
std[i].time = i ;
}
quicksort(std, 0, N-1);
for(i = 0; i < N-1; i++){
printf("%d ", std[i].time+1);
}
printf("%d", std[N-1].time+1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149209/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149209/source.c"
target datalayout = "e-m:e-p270: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.student = type { i32, i32 }
@i = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @partition(ptr nocapture noundef %num, i32 noundef %start, i32 noundef %end, i32 noundef %p) local_unnamed_addr #0 {
entry:
store i32 %start, ptr @i, align 4, !tbaa !5
store i32 %end, ptr @j, align 4, !tbaa !5
%cmp.not55 = icmp sgt i32 %start, %end
br i1 %cmp.not55, label %while.end24, label %while.cond1.preheader.preheader
while.cond1.preheader.preheader: ; preds = %entry
%0 = sext i32 %end to i64
%1 = add i32 %end, 1
%2 = sext i32 %start to i64
%3 = add i32 %start, -1
br label %while.cond1.preheader
while.cond1.preheader: ; preds = %while.cond1.preheader.preheader, %if.end
%4 = phi i32 [ %10, %if.end ], [ %start, %while.cond1.preheader.preheader ]
%i.promoted4857 = phi i32 [ %i.promoted47, %if.end ], [ %start, %while.cond1.preheader.preheader ]
%j.promoted5256 = phi i32 [ %j.promoted51, %if.end ], [ %end, %while.cond1.preheader.preheader ]
%cmp2.not37 = icmp sgt i32 %i.promoted4857, %end
br i1 %cmp2.not37, label %while.end, label %land.rhs.preheader
land.rhs.preheader: ; preds = %while.cond1.preheader
%5 = sext i32 %i.promoted4857 to i64
%arrayidx72 = getelementptr inbounds %struct.student, ptr %num, i64 %5
%6 = load i32, ptr %arrayidx72, align 4, !tbaa !9
%cmp3.not73 = icmp sgt i32 %6, %p
br i1 %cmp3.not73, label %while.end.loopexit.split.loop.exit62, label %while.body4
land.rhs: ; preds = %while.body4
%arrayidx = getelementptr inbounds %struct.student, ptr %num, i64 %indvars.iv.next
%7 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp3.not = icmp sgt i32 %7, %p
br i1 %cmp3.not, label %while.end.loopexit.split.loop.exit62, label %while.body4, !llvm.loop !11
while.body4: ; preds = %land.rhs.preheader, %land.rhs
%indvars.iv74 = phi i64 [ %indvars.iv.next, %land.rhs ], [ %5, %land.rhs.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv74, 1
%8 = trunc i64 %indvars.iv.next to i32
store i32 %8, ptr @i, align 4, !tbaa !5
%cmp2.not.not = icmp slt i64 %indvars.iv74, %0
br i1 %cmp2.not.not, label %land.rhs, label %while.end, !llvm.loop !11
while.end.loopexit.split.loop.exit62: ; preds = %land.rhs, %land.rhs.preheader
%.lcssa = phi i32 [ %4, %land.rhs.preheader ], [ %8, %land.rhs ]
%indvars.iv.lcssa = phi i64 [ %5, %land.rhs.preheader ], [ %indvars.iv.next, %land.rhs ]
%9 = trunc i64 %indvars.iv.lcssa to i32
br label %while.end
while.end: ; preds = %while.body4, %while.end.loopexit.split.loop.exit62, %while.cond1.preheader
%10 = phi i32 [ %4, %while.cond1.preheader ], [ %.lcssa, %while.end.loopexit.split.loop.exit62 ], [ %8, %while.body4 ]
%i.promoted47 = phi i32 [ %i.promoted4857, %while.cond1.preheader ], [ %9, %while.end.loopexit.split.loop.exit62 ], [ %1, %while.body4 ]
%cmp6.not41 = icmp slt i32 %j.promoted5256, %start
br i1 %cmp6.not41, label %while.end14, label %land.rhs7.preheader
land.rhs7.preheader: ; preds = %while.end
%11 = sext i32 %j.promoted5256 to i64
br label %land.rhs7
land.rhs7: ; preds = %land.rhs7.preheader, %while.body13
%indvars.iv59 = phi i64 [ %11, %land.rhs7.preheader ], [ %indvars.iv.next60, %while.body13 ]
%arrayidx9 = getelementptr inbounds %struct.student, ptr %num, i64 %indvars.iv59
%12 = load i32, ptr %arrayidx9, align 4, !tbaa !9
%cmp11 = icmp sgt i32 %12, %p
br i1 %cmp11, label %while.body13, label %while.end14.loopexit.split.loop.exit65
while.body13: ; preds = %land.rhs7
%indvars.iv.next60 = add nsw i64 %indvars.iv59, -1
%13 = trunc i64 %indvars.iv.next60 to i32
store i32 %13, ptr @j, align 4, !tbaa !5
%cmp6.not.not = icmp sgt i64 %indvars.iv59, %2
br i1 %cmp6.not.not, label %land.rhs7, label %while.end14, !llvm.loop !13
while.end14.loopexit.split.loop.exit65: ; preds = %land.rhs7
%14 = trunc i64 %indvars.iv59 to i32
br label %while.end14
while.end14: ; preds = %while.body13, %while.end14.loopexit.split.loop.exit65, %while.end
%j.promoted51 = phi i32 [ %j.promoted5256, %while.end ], [ %14, %while.end14.loopexit.split.loop.exit65 ], [ %3, %while.body13 ]
%cmp15 = icmp sgt i32 %i.promoted47, %j.promoted51
br i1 %cmp15, label %while.end24, label %if.end
if.end: ; preds = %while.end14
%idxprom16 = sext i32 %i.promoted47 to i64
%arrayidx17 = getelementptr inbounds %struct.student, ptr %num, i64 %idxprom16
%15 = load i64, ptr %arrayidx17, align 4
%idxprom20 = sext i32 %j.promoted51 to i64
%arrayidx21 = getelementptr inbounds %struct.student, ptr %num, i64 %idxprom20
%16 = load i64, ptr %arrayidx21, align 4
store i64 %16, ptr %arrayidx17, align 4
store i64 %15, ptr %arrayidx21, align 4
br label %while.cond1.preheader, !llvm.loop !14
while.end24: ; preds = %while.end14, %entry
%17 = phi i32 [ %start, %entry ], [ %10, %while.end14 ]
ret i32 %17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @quicksort(ptr nocapture noundef %num, i32 noundef %start, i32 noundef %end) local_unnamed_addr #2 {
entry:
%cmp55 = icmp eq i32 %start, %end
br i1 %cmp55, label %return, label %if.end.lr.ph
if.end.lr.ph: ; preds = %entry
%0 = sext i32 %end to i64
%1 = add i32 %end, 1
br label %if.end
if.end: ; preds = %if.end.lr.ph, %partition.exit
%start.tr56 = phi i32 [ %start, %if.end.lr.ph ], [ %10, %partition.exit ]
%idxprom = sext i32 %start.tr56 to i64
%arrayidx = getelementptr inbounds %struct.student, ptr %num, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp1.not.not49 = icmp sgt i32 %start.tr56, %end
br i1 %cmp1.not.not49, label %return, label %while.body
while.cond: ; preds = %if.else
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %return, label %while.body, !llvm.loop !15
while.body: ; preds = %if.end, %while.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ %idxprom, %if.end ]
%arrayidx3 = getelementptr inbounds %struct.student, ptr %num, i64 %indvars.iv
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !9
%cmp5 = icmp slt i32 %3, %2
br i1 %cmp5, label %while.cond1.preheader.preheader.i, label %if.else
if.else: ; preds = %while.body
%cmp13 = icmp sgt i32 %3, %2
br i1 %cmp13, label %while.cond1.preheader.preheader.i, label %while.cond
while.cond1.preheader.preheader.i: ; preds = %while.body, %if.else
%p.0.ph = phi i32 [ %2, %if.else ], [ %3, %while.body ]
store i32 %start.tr56, ptr @i, align 4, !tbaa !5
store i32 %end, ptr @j, align 4, !tbaa !5
%4 = add i32 %start.tr56, -1
br label %while.cond1.preheader.i
while.cond1.preheader.i: ; preds = %if.end.i, %while.cond1.preheader.preheader.i
%5 = phi i32 [ %10, %if.end.i ], [ %start.tr56, %while.cond1.preheader.preheader.i ]
%i.promoted4857.i = phi i32 [ %i.promoted47.i, %if.end.i ], [ %start.tr56, %while.cond1.preheader.preheader.i ]
%j.promoted5256.i = phi i32 [ %j.promoted51.i, %if.end.i ], [ %end, %while.cond1.preheader.preheader.i ]
%cmp2.not37.i = icmp sgt i32 %i.promoted4857.i, %end
br i1 %cmp2.not37.i, label %while.end.i, label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %while.cond1.preheader.i
%6 = sext i32 %i.promoted4857.i to i64
%arrayidx.i51 = getelementptr inbounds %struct.student, ptr %num, i64 %6
%7 = load i32, ptr %arrayidx.i51, align 4, !tbaa !9
%cmp3.not.i52 = icmp sgt i32 %7, %p.0.ph
br i1 %cmp3.not.i52, label %while.end.i, label %while.body4.i
land.rhs.i: ; preds = %while.body4.i
%arrayidx.i = getelementptr inbounds %struct.student, ptr %num, i64 %indvars.iv.next.i
%8 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%cmp3.not.i = icmp sgt i32 %8, %p.0.ph
br i1 %cmp3.not.i, label %while.end.i, label %while.body4.i, !llvm.loop !11
while.body4.i: ; preds = %land.rhs.preheader.i, %land.rhs.i
%indvars.iv.i53 = phi i64 [ %indvars.iv.next.i, %land.rhs.i ], [ %6, %land.rhs.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i53, 1
%9 = trunc i64 %indvars.iv.next.i to i32
store i32 %9, ptr @i, align 4, !tbaa !5
%cmp2.not.not.i = icmp slt i64 %indvars.iv.i53, %0
br i1 %cmp2.not.not.i, label %land.rhs.i, label %while.end.i, !llvm.loop !11
while.end.i: ; preds = %while.body4.i, %land.rhs.i, %land.rhs.preheader.i, %while.cond1.preheader.i
%10 = phi i32 [ %5, %while.cond1.preheader.i ], [ %5, %land.rhs.preheader.i ], [ %9, %land.rhs.i ], [ %9, %while.body4.i ]
%i.promoted47.i = phi i32 [ %i.promoted4857.i, %while.cond1.preheader.i ], [ %i.promoted4857.i, %land.rhs.preheader.i ], [ %1, %while.body4.i ], [ %9, %land.rhs.i ]
%cmp6.not41.i = icmp slt i32 %j.promoted5256.i, %start.tr56
br i1 %cmp6.not41.i, label %while.end14.i, label %land.rhs7.preheader.i
land.rhs7.preheader.i: ; preds = %while.end.i
%11 = sext i32 %j.promoted5256.i to i64
br label %land.rhs7.i
land.rhs7.i: ; preds = %while.body13.i, %land.rhs7.preheader.i
%indvars.iv59.i = phi i64 [ %11, %land.rhs7.preheader.i ], [ %indvars.iv.next60.i, %while.body13.i ]
%arrayidx9.i = getelementptr inbounds %struct.student, ptr %num, i64 %indvars.iv59.i
%12 = load i32, ptr %arrayidx9.i, align 4, !tbaa !9
%cmp11.i = icmp sgt i32 %12, %p.0.ph
br i1 %cmp11.i, label %while.body13.i, label %while.end14.loopexit.split.loop.exit65.i
while.body13.i: ; preds = %land.rhs7.i
%indvars.iv.next60.i = add nsw i64 %indvars.iv59.i, -1
%13 = trunc i64 %indvars.iv.next60.i to i32
store i32 %13, ptr @j, align 4, !tbaa !5
%cmp6.not.not.i = icmp sgt i64 %indvars.iv59.i, %idxprom
br i1 %cmp6.not.not.i, label %land.rhs7.i, label %while.end14.i, !llvm.loop !13
while.end14.loopexit.split.loop.exit65.i: ; preds = %land.rhs7.i
%14 = trunc i64 %indvars.iv59.i to i32
br label %while.end14.i
while.end14.i: ; preds = %while.body13.i, %while.end14.loopexit.split.loop.exit65.i, %while.end.i
%j.promoted51.i = phi i32 [ %j.promoted5256.i, %while.end.i ], [ %14, %while.end14.loopexit.split.loop.exit65.i ], [ %4, %while.body13.i ]
%cmp15.i = icmp sgt i32 %i.promoted47.i, %j.promoted51.i
br i1 %cmp15.i, label %partition.exit, label %if.end.i
if.end.i: ; preds = %while.end14.i
%idxprom16.i = sext i32 %i.promoted47.i to i64
%arrayidx17.i = getelementptr inbounds %struct.student, ptr %num, i64 %idxprom16.i
%15 = load i64, ptr %arrayidx17.i, align 4
%idxprom20.i = sext i32 %j.promoted51.i to i64
%arrayidx21.i = getelementptr inbounds %struct.student, ptr %num, i64 %idxprom20.i
%16 = load i64, ptr %arrayidx21.i, align 4
store i64 %16, ptr %arrayidx17.i, align 4
store i64 %15, ptr %arrayidx21.i, align 4
br label %while.cond1.preheader.i, !llvm.loop !14
partition.exit: ; preds = %while.end14.i
%sub = add nsw i32 %10, -1
tail call void @quicksort(ptr noundef %num, i32 noundef %start.tr56, i32 noundef %sub)
%cmp = icmp eq i32 %10, %end
br i1 %cmp, label %return, label %if.end
return: ; preds = %partition.exit, %if.end, %while.cond, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
%A = alloca [100000 x i32], align 16
%std = alloca [100000 x %struct.student], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
store i32 0, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %std) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
store i32 0, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%storemerge29 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%idxprom = sext i32 %storemerge29 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %idxprom
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @i, align 4, !tbaa !5
%idxprom2 = sext i32 %1 to i64
%arrayidx3 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %idxprom2
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds [100000 x %struct.student], ptr %std, i64 0, i64 %idxprom2
store i32 %2, ptr %arrayidx5, align 8, !tbaa !9
%time = getelementptr inbounds [100000 x %struct.student], ptr %std, i64 0, i64 %idxprom2, i32 1
store i32 %1, ptr %time, align 4, !tbaa !16
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%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 !17
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
%sub = add nsw i32 %.lcssa, -1
call void @quicksort(ptr noundef nonnull %std, i32 noundef 0, i32 noundef %sub)
store i32 0, ptr @i, align 4, !tbaa !5
%4 = load i32, ptr %N, align 4, !tbaa !5
%sub930 = add nsw i32 %4, -1
%cmp1031 = icmp sgt i32 %4, 1
br i1 %cmp1031, label %for.body11, label %for.end18
for.body11: ; preds = %for.end, %for.body11
%storemerge2732 = phi i32 [ %inc17, %for.body11 ], [ 0, %for.end ]
%idxprom12 = sext i32 %storemerge2732 to i64
%time14 = getelementptr inbounds [100000 x %struct.student], ptr %std, i64 0, i64 %idxprom12, i32 1
%5 = load i32, ptr %time14, align 4, !tbaa !16
%add = add nsw i32 %5, 1
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%6 = load i32, ptr @i, align 4, !tbaa !5
%inc17 = add nsw i32 %6, 1
store i32 %inc17, ptr @i, align 4, !tbaa !5
%7 = load i32, ptr %N, align 4, !tbaa !5
%sub9 = add nsw i32 %7, -1
%cmp10 = icmp slt i32 %inc17, %sub9
br i1 %cmp10, label %for.body11, label %for.end18, !llvm.loop !18
for.end18: ; preds = %for.body11, %for.end
%sub9.lcssa = phi i32 [ %sub930, %for.end ], [ %sub9, %for.body11 ]
%idxprom20 = sext i32 %sub9.lcssa to i64
%time22 = getelementptr inbounds [100000 x %struct.student], ptr %std, i64 0, i64 %idxprom20, i32 1
%8 = load i32, ptr %time22, align 4, !tbaa !16
%add23 = add nsw i32 %8, 1
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add23)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %std) #5
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"student", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!10, !6, i64 4}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
struct sort_data {
int value;//値
int index;//インデックス
};
int compare(const void *a, const void *b){
return *(int*)a - *(int*)b;
}
int main(){
int N;
scanf("%d", &N);
int i, j;
struct sort_data A[N];
for (i=0; i<N; i++){
scanf("%d", &A[i].value);
A[i].index = i;
}
qsort(A, N, sizeof(struct sort_data), compare);
for(i=0; i<N; i++){
printf("%d ", A[i].index + 1 );
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149252/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149252/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.sort_data = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
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 %struct.sort_data, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %3, 0
br i1 %cmp22, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.sort_data, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%index = getelementptr inbounds %struct.sort_data, ptr %vla, i64 %indvars.iv, i32 1
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %index, align 4, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %6, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @compare) #6
%7 = load i32, ptr %N, align 4, !tbaa !5
%cmp524 = icmp sgt i32 %7, 0
br i1 %cmp524, label %for.body7, label %for.end14
for.body7: ; preds = %for.end, %for.body7
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body7 ], [ 0, %for.end ]
%index10 = getelementptr inbounds %struct.sort_data, ptr %vla, i64 %indvars.iv28, i32 1
%8 = load i32, ptr %index10, align 4, !tbaa !9
%add = add nsw i32 %8, 1
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%9 = load i32, ptr %N, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp5 = icmp slt i64 %indvars.iv.next29, %10
br i1 %cmp5, label %for.body7, label %for.end14, !llvm.loop !13
for.end14: ; preds = %for.body7, %for.end
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"sort_data", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
int main(void)
{
char grid1[4], grid2[4];
scanf("%s", grid1);
scanf("%s", grid2);
if(grid1[0] == grid2[2] && grid1[1] == grid2[1] && grid1[2] == grid2[0])
printf("YES");
else
printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149302/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%grid1 = alloca [4 x i8], align 1
%grid2 = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %grid1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %grid2) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %grid1)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %grid2)
%0 = load i8, ptr %grid1, align 1, !tbaa !5
%arrayidx3 = getelementptr inbounds [4 x i8], ptr %grid2, i64 0, i64 2
%1 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%arrayidx6 = getelementptr inbounds [4 x i8], ptr %grid1, i64 0, i64 1
%2 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%arrayidx8 = getelementptr inbounds [4 x i8], ptr %grid2, i64 0, i64 1
%3 = load i8, ptr %arrayidx8, align 1, !tbaa !5
%cmp10 = icmp eq i8 %2, %3
br i1 %cmp10, label %land.lhs.true12, label %if.else
land.lhs.true12: ; preds = %land.lhs.true
%arrayidx13 = getelementptr inbounds [4 x i8], ptr %grid1, i64 0, i64 2
%4 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%5 = load i8, ptr %grid2, align 1, !tbaa !5
%cmp17 = icmp eq i8 %4, %5
br i1 %cmp17, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true12, %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true12, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %land.lhs.true12 ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %grid2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %grid1) #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() {
char c[4], d[4];
scanf("%s %s", c, d);
puts(c[0] == d[2] && c[1] == d[1] && c[2] == d[0] ? "YES" : "NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149346/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149346/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s %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:
%c = alloca [4 x i8], align 1
%d = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i8, ptr %c, align 1, !tbaa !5
%arrayidx2 = getelementptr inbounds [4 x i8], ptr %d, i64 0, i64 2
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %land.lhs.true, label %land.end
land.lhs.true: ; preds = %entry
%arrayidx5 = getelementptr inbounds [4 x i8], ptr %c, i64 0, i64 1
%2 = load i8, ptr %arrayidx5, align 1, !tbaa !5
%arrayidx7 = getelementptr inbounds [4 x i8], ptr %d, i64 0, i64 1
%3 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %2, %3
br i1 %cmp9, label %land.rhs, label %land.end
land.rhs: ; preds = %land.lhs.true
%arrayidx11 = getelementptr inbounds [4 x i8], ptr %c, i64 0, i64 2
%4 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%5 = load i8, ptr %d, align 1, !tbaa !5
%cmp15 = icmp eq i8 %4, %5
%6 = select i1 %cmp15, ptr @.str.1, ptr @.str.2
br label %land.end
land.end: ; preds = %land.rhs, %land.lhs.true, %entry
%cond = phi ptr [ @.str.2, %land.lhs.true ], [ @.str.2, %entry ], [ %6, %land.rhs ]
%call17 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
char s1[3], s2[3];
scanf("%s %s", s1, s2);
if(s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0]){
printf("YES\n");
} else {
printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149410/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149410/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s %s\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:
%s1 = alloca [3 x i8], align 1
%s2 = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s1) #4
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1, ptr noundef nonnull %s2)
%0 = load i8, ptr %s1, align 1, !tbaa !5
%arrayidx2 = getelementptr inbounds [3 x i8], ptr %s2, i64 0, i64 2
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%arrayidx5 = getelementptr inbounds [3 x i8], ptr %s1, i64 0, i64 1
%2 = load i8, ptr %arrayidx5, align 1, !tbaa !5
%arrayidx7 = getelementptr inbounds [3 x i8], ptr %s2, i64 0, i64 1
%3 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %2, %3
br i1 %cmp9, label %land.lhs.true11, label %if.else
land.lhs.true11: ; preds = %land.lhs.true
%arrayidx12 = getelementptr inbounds [3 x i8], ptr %s1, i64 0, i64 2
%4 = load i8, ptr %arrayidx12, align 1, !tbaa !5
%5 = load i8, ptr %s2, align 1, !tbaa !5
%cmp16 = icmp eq i8 %4, %5
br i1 %cmp16, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true11, %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true11, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %land.lhs.true11 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s2) #4
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<math.h>
#define INFINI 100000001
int main(){
char s1[4],s2[4];
scanf("%s",s1);
scanf("\n%s",s2);
int i;
bool isvalide=true;
for(i=0;i<3;i++)
if(s1[i]!=s2[2-i]){
isvalide=false;
break;}
if(isvalide)printf("YES");
else printf("NO");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149461/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149461/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"\0A%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s1 = alloca [4 x i8], align 1
%s2 = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s2) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s2)
%0 = load i8, ptr %s1, align 1, !tbaa !5
%arrayidx4 = getelementptr inbounds [4 x i8], ptr %s2, i64 0, i64 2
%1 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%cmp6.not = icmp eq i8 %0, %1
br i1 %cmp6.not, label %for.cond, label %if.else
for.cond: ; preds = %entry
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %s1, i64 0, i64 1
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%arrayidx4.1 = getelementptr inbounds [4 x i8], ptr %s2, i64 0, i64 1
%3 = load i8, ptr %arrayidx4.1, align 1, !tbaa !5
%cmp6.not.1 = icmp eq i8 %2, %3
br i1 %cmp6.not.1, label %for.cond.1, label %if.else
for.cond.1: ; preds = %for.cond
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %s1, i64 0, i64 2
%4 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%5 = load i8, ptr %s2, align 1, !tbaa !5
%cmp6.not.2 = icmp eq i8 %4, %5
br i1 %cmp6.not.2, label %if.end11, label %if.else
if.else: ; preds = %for.cond.1, %for.cond, %entry
br label %if.end11
if.end11: ; preds = %for.cond.1, %if.else
%.str.3.sink = phi ptr [ @.str.3, %if.else ], [ @.str.2, %for.cond.1 ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s1) #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(){
char a[4],b[4];
scanf("%s\n%s",a,b);
for(int i=0;i<3;i++){
if(a[i]!=b[2-i]){
printf("NO");
return 0;
}
}
printf("YES");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149511/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149511/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\0A%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [4 x i8], align 1
%b = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i8, ptr %a, align 1, !tbaa !5
%arrayidx3 = getelementptr inbounds [4 x i8], ptr %b, i64 0, i64 2
%1 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %if.then
for.cond: ; preds = %entry
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 1
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [4 x i8], ptr %b, i64 0, i64 1
%3 = load i8, ptr %arrayidx3.1, align 1, !tbaa !5
%cmp5.not.1 = icmp eq i8 %2, %3
br i1 %cmp5.not.1, label %for.cond.1, label %if.then
for.cond.1: ; preds = %for.cond
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 2
%4 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%5 = load i8, ptr %b, align 1, !tbaa !5
%cmp5.not.2 = icmp eq i8 %4, %5
br i1 %cmp5.not.2, label %cleanup9, label %if.then
if.then: ; preds = %for.cond.1, %for.cond, %entry
br label %cleanup9
cleanup9: ; preds = %for.cond.1, %if.then
%.str.1.sink = phi ptr [ @.str.1, %if.then ], [ @.str.2, %for.cond.1 ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int N;
char S[10];
scanf("%d", &N);
printf("0\n");
fflush(stdout);
scanf("%s", S);
if(S[0] == 'V'){
return 0;
}
char l = S[0], r = S[0], h;
int lnum = 0, rnum = N, hnum;
for(;;){
hnum = (lnum + rnum) / 2;
printf("%d\n", hnum);
fflush(stdout);
scanf("%s", S);
if(S[0] == 'V'){
return 0;
}
h = S[0];
if((((hnum - lnum) % 2) == 0 && h != l) || ((hnum - lnum) % 2 == 1) && h == l){
r = h;
rnum = hnum;
}
else{
l = h;
lnum = hnum;
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149562/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149562/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stdout = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%S = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%0 = load ptr, ptr @stdout, align 8, !tbaa !5
%call2 = call i32 @fflush(ptr noundef %0)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %S)
%1 = load i8, ptr %S, align 1, !tbaa !9
%cmp = icmp eq i8 %1, 86
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%2 = load i32, ptr %N, align 4, !tbaa !10
%div48 = sdiv i32 %2, 2
%call749 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %div48)
%3 = load ptr, ptr @stdout, align 8, !tbaa !5
%call850 = call i32 @fflush(ptr noundef %3)
%call1051 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %S)
%4 = load i8, ptr %S, align 1, !tbaa !9
%cmp1352 = icmp eq i8 %4, 86
br i1 %cmp1352, label %cleanup, label %if.end16
if.end16: ; preds = %if.end, %if.end16
%5 = phi i8 [ %7, %if.end16 ], [ %4, %if.end ]
%div56 = phi i32 [ %div, %if.end16 ], [ %div48, %if.end ]
%rnum.055 = phi i32 [ %rnum.1, %if.end16 ], [ %2, %if.end ]
%lnum.054 = phi i32 [ %lnum.1, %if.end16 ], [ 0, %if.end ]
%l.053 = phi i8 [ %l.1, %if.end16 ], [ %1, %if.end ]
%sub = sub nsw i32 %div56, %lnum.054
%rem = srem i32 %sub, 2
%cmp18 = icmp ne i32 %rem, 0
%cmp22.not = icmp eq i8 %5, %l.053
%or.cond = select i1 %cmp18, i1 true, i1 %cmp22.not
%or.cond.not = xor i1 %or.cond, true
%cmp26 = icmp eq i32 %rem, 1
%or.cond46 = select i1 %cmp26, i1 %cmp22.not, i1 false
%or.cond47 = select i1 %or.cond.not, i1 true, i1 %or.cond46
%l.1 = select i1 %or.cond47, i8 %l.053, i8 %5
%lnum.1 = select i1 %or.cond47, i32 %lnum.054, i32 %div56
%rnum.1 = select i1 %or.cond47, i32 %div56, i32 %rnum.055
%add = add nsw i32 %rnum.1, %lnum.1
%div = sdiv i32 %add, 2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %div)
%6 = load ptr, ptr @stdout, align 8, !tbaa !5
%call8 = call i32 @fflush(ptr noundef %6)
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %S)
%7 = load i8, ptr %S, align 1, !tbaa !9
%cmp13 = icmp eq i8 %7, 86
br i1 %cmp13, label %cleanup, label %if.end16
cleanup: ; preds = %if.end16, %if.end, %entry
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %S) #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: 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
|
#include <stdio.h>
int main(){
int A,B;
scanf("%d %d",&A,&B);
if(A<9&&B<9) printf("Yay!\n");
else printf(":(\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149605/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149605/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c":(\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %B, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int A, B;
scanf("%d %d", &A, &B);
if (A<=8 && B<=8){
printf("Yay!\n");
}
else{
printf(":(\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149649/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149649/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c":(\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %B, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int A,B;
scanf("%d %d",&A,&B);
if(A<=8&&B<=8){
printf("Yay!");
}else{
printf(":(");}
return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149692/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149692/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yay!\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c":(\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %B, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int A = 0;
int B = 0;
scanf("%d%d", &A, &B);
if((A - B) > (16 - (A + B))) {
printf(":(");
}
else if((B -A) > (16 - (A + B))){
printf(":(");
}
else{
printf("Yay!");}
return 0;}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149735/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149735/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
store i32 0, ptr %A, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
store i32 0, ptr %B, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = add i32 %0, %1
%sub1 = sub i32 16, %2
%cmp = icmp sgt i32 %sub, %sub1
%sub3 = sub nsw i32 %1, %0
%cmp6 = icmp sgt i32 %sub3, %sub1
%3 = select i1 %cmp, i1 true, i1 %cmp6
%.str.1.sink = select i1 %3, ptr @.str.1, ptr @.str.2
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if (a>8 || b>8){
printf(":(");
}else{
printf("Yay!");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149779/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149779/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 8
%1 = load i32, ptr %b, align 4
%cmp1 = icmp sgt i32 %1, 8
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
//変数の宣言
int a,b;
//よく使う変数
int i,j,k,l;
int flag=0;
int ans=0;
int count=0;
int temp,temp1,temp2;
int min;
//データの読み込み
scanf("%d %d",&a,&b);
// printf("nは%dです\n", n);
// printf("データの読み込み終了\n");
//実際の処理
if(a<=8&&b<=8){
printf("Yay!");
}else{
printf(":(");
}
// printf("計算部分終了\n");
//出力
//printf("%lld %lld",min,max);
// printf("結果の出力終了\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149821/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149821/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yay!\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c":(\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a,b;
scanf("%d%d",&a,&b);
if((a>8)||(b>8))
printf(":(");
else printf("Yay!");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149872/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149872/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 8
%1 = load i32, ptr %b, align 4
%cmp1 = icmp sgt i32 %1, 8
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int A, B;
scanf("%d %d", &A, &B);
if(A <= 8 && B <= 8){
printf("Yay!");
}
else{
printf(":(");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149922/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149922/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yay!\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c":(\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %B, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b;
scanf("%d %d" ,&a,&b);
if (a >= 9 || b >= 9){
printf(":("); } else {
printf("Yay!"); }
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149966/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 8
%1 = load i32, ptr %b, align 4
%cmp1 = icmp sgt i32 %1, 8
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if(a<9 && b<9)printf("Yay!\n");
else printf(":(\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150014/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150014/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c":(\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int A, B;
scanf("%d", &A);
scanf("%d", &B);
if(A <= 8 && B <= 8){
printf("Yay!");
} else {
printf(":(");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150058/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150058/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yay!\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c":(\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %B, align 4
%cmp2 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<assert.h>
const int N=10000;
void judge_score(int* a_score,int* b_score,const int a_card,const int b_card);
void CardGame(const int n);
int main(int argc,char* argv[])
{
int n;
for(;1;)
{
scanf("%d",&n);
assert(n<=N && "exceed n threshold");
if(n)
{
CardGame(n);
}
else
{
break;
}
}
return 0;
}
void judge_score(int* a_score,int* b_score,const int a_card,const int b_card)
{
if(a_card>b_card)
{
*a_score+=a_card+b_card;
}
else if(a_card<b_card)
{
*b_score+=a_card+b_card;
}
else
{
*a_score+=a_card;
*b_score+=b_card;
}
return;
}
void CardGame(const int n)
{
int i;
int a_score=0,b_score=0;
int a_card,b_card;
for(i=0;i<n;i++)
{
scanf("%*c%d %d",&a_card,&b_card);
judge_score(&a_score,&b_score,a_card,b_card);
}
printf("%d %d\n",a_score,b_score);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150100/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150100/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@N = dso_local local_unnamed_addr constant i32 10000, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [29 x i8] c"n<=N && \22exceed n threshold\22\00", align 1
@.str.3 = private unnamed_addr constant [63 x i8] c"/data/TheStack_IR/OJ_Samples/Collated/C/Source_150100/source.c\00", align 1
@__PRETTY_FUNCTION__.main = private unnamed_addr constant [23 x i8] c"int main(int, char **)\00", align 1
@.str.4 = private unnamed_addr constant [9 x i8] c"%*c%d %d\00", align 1
@.str.5 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%a_score.i = alloca i32, align 4
%b_score.i = alloca i32, align 4
%a_card.i = alloca i32, align 4
%b_card.i = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp slt i32 %0, 10001
br i1 %cmp5, label %if.end, label %if.else
if.else: ; preds = %CardGame.exit, %entry
call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 14, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
unreachable
if.end: ; preds = %entry, %CardGame.exit
%1 = phi i32 [ %4, %CardGame.exit ], [ %0, %entry ]
%tobool.not = icmp eq i32 %1, 0
br i1 %tobool.not, label %for.end, label %if.then1
if.then1: ; preds = %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a_score.i)
store i32 0, ptr %a_score.i, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b_score.i)
store i32 0, ptr %b_score.i, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a_card.i) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b_card.i) #6
%cmp7.i = icmp sgt i32 %1, 0
br i1 %cmp7.i, label %for.body.i, label %CardGame.exit
for.body.i: ; preds = %if.then1, %judge_score.exit.i
%i.08.i = phi i32 [ %inc.i, %judge_score.exit.i ], [ 0, %if.then1 ]
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %a_card.i, ptr noundef nonnull %b_card.i)
%2 = load i32, ptr %a_card.i, align 4, !tbaa !5
%3 = load i32, ptr %b_card.i, align 4, !tbaa !5
%cmp.i.i = icmp sgt i32 %2, %3
br i1 %cmp.i.i, label %if.then.i.i, label %if.else.i.i
if.then.i.i: ; preds = %for.body.i
%add.i.i = add nsw i32 %3, %2
%a_score.i.0.a_score.i.0.a_score.i.0.a_score.0.a_score.0.6.i = load i32, ptr %a_score.i, align 4, !tbaa !5
br label %judge_score.exit.i
if.else.i.i: ; preds = %for.body.i
%cmp2.i.i = icmp slt i32 %2, %3
br i1 %cmp2.i.i, label %if.then3.i.i, label %if.else6.i.i
if.then3.i.i: ; preds = %if.else.i.i
%add4.i.i = add nsw i32 %3, %2
%b_score.i.0.b_score.i.0.b_score.i.0.b_score.0.b_score.0.4.i = load i32, ptr %b_score.i, align 4, !tbaa !5
br label %judge_score.exit.i
if.else6.i.i: ; preds = %if.else.i.i
%a_score.i.0.a_score.i.0.a_score.i.0.a_score.0.a_score.0.5.i = load i32, ptr %a_score.i, align 4, !tbaa !5
%add7.i.i = add nsw i32 %a_score.i.0.a_score.i.0.a_score.i.0.a_score.0.a_score.0.5.i, %2
store i32 %add7.i.i, ptr %a_score.i, align 4, !tbaa !5
%b_score.i.0.b_score.i.0.b_score.i.0.b_score.0.b_score.0.3.i = load i32, ptr %b_score.i, align 4, !tbaa !5
br label %judge_score.exit.i
judge_score.exit.i: ; preds = %if.else6.i.i, %if.then3.i.i, %if.then.i.i
%.sink.i.i = phi i32 [ %b_score.i.0.b_score.i.0.b_score.i.0.b_score.0.b_score.0.4.i, %if.then3.i.i ], [ %3, %if.else6.i.i ], [ %a_score.i.0.a_score.i.0.a_score.i.0.a_score.0.a_score.0.6.i, %if.then.i.i ]
%add4.sink.i.i = phi i32 [ %add4.i.i, %if.then3.i.i ], [ %b_score.i.0.b_score.i.0.b_score.i.0.b_score.0.b_score.0.3.i, %if.else6.i.i ], [ %add.i.i, %if.then.i.i ]
%b_score.sink.i.i = phi ptr [ %b_score.i, %if.then3.i.i ], [ %b_score.i, %if.else6.i.i ], [ %a_score.i, %if.then.i.i ]
%add5.i.i = add nsw i32 %add4.sink.i.i, %.sink.i.i
store i32 %add5.i.i, ptr %b_score.sink.i.i, align 4, !tbaa !5
%inc.i = add nuw nsw i32 %i.08.i, 1
%exitcond.not.i = icmp eq i32 %inc.i, %1
br i1 %exitcond.not.i, label %for.end.loopexit.i, label %for.body.i, !llvm.loop !9
for.end.loopexit.i: ; preds = %judge_score.exit.i
%a_score.i.0.a_score.i.0.a_score.i.0.a_score.0.a_score.0..pre.i = load i32, ptr %a_score.i, align 4, !tbaa !5
%b_score.i.0.b_score.i.0.b_score.i.0.b_score.0.b_score.0..pre.i = load i32, ptr %b_score.i, align 4, !tbaa !5
br label %CardGame.exit
CardGame.exit: ; preds = %if.then1, %for.end.loopexit.i
%b_score.0.b_score.0..i = phi i32 [ %b_score.i.0.b_score.i.0.b_score.i.0.b_score.0.b_score.0..pre.i, %for.end.loopexit.i ], [ 0, %if.then1 ]
%a_score.0.a_score.0..i = phi i32 [ %a_score.i.0.a_score.i.0.a_score.i.0.a_score.0.a_score.0..pre.i, %for.end.loopexit.i ], [ 0, %if.then1 ]
%call1.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %a_score.0.a_score.0..i, i32 noundef %b_score.0.b_score.0..i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b_card.i) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a_card.i) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b_score.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a_score.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %4, 10001
br i1 %cmp, label %if.end, label %if.else
for.end: ; preds = %if.end
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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @CardGame(i32 noundef %n) local_unnamed_addr #4 {
entry:
%a_score = alloca i32, align 4
%b_score = alloca i32, align 4
%a_card = alloca i32, align 4
%b_card = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a_score)
store i32 0, ptr %a_score, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b_score)
store i32 0, ptr %b_score, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a_card) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b_card) #6
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %judge_score.exit
%i.08 = phi i32 [ %inc, %judge_score.exit ], [ 0, %entry ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %a_card, ptr noundef nonnull %b_card)
%0 = load i32, ptr %a_card, align 4, !tbaa !5
%1 = load i32, ptr %b_card, align 4, !tbaa !5
%cmp.i = icmp sgt i32 %0, %1
br i1 %cmp.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %for.body
%add.i = add nsw i32 %1, %0
%a_score.0.a_score.0.a_score.0.6 = load i32, ptr %a_score, align 4, !tbaa !5
br label %judge_score.exit
if.else.i: ; preds = %for.body
%cmp2.i = icmp slt i32 %0, %1
br i1 %cmp2.i, label %if.then3.i, label %if.else6.i
if.then3.i: ; preds = %if.else.i
%add4.i = add nsw i32 %1, %0
%b_score.0.b_score.0.b_score.0.4 = load i32, ptr %b_score, align 4, !tbaa !5
br label %judge_score.exit
if.else6.i: ; preds = %if.else.i
%a_score.0.a_score.0.a_score.0.5 = load i32, ptr %a_score, align 4, !tbaa !5
%add7.i = add nsw i32 %a_score.0.a_score.0.a_score.0.5, %0
store i32 %add7.i, ptr %a_score, align 4, !tbaa !5
%b_score.0.b_score.0.b_score.0.3 = load i32, ptr %b_score, align 4, !tbaa !5
br label %judge_score.exit
judge_score.exit: ; preds = %if.then.i, %if.then3.i, %if.else6.i
%.sink.i = phi i32 [ %b_score.0.b_score.0.b_score.0.4, %if.then3.i ], [ %1, %if.else6.i ], [ %a_score.0.a_score.0.a_score.0.6, %if.then.i ]
%add4.sink.i = phi i32 [ %add4.i, %if.then3.i ], [ %b_score.0.b_score.0.b_score.0.3, %if.else6.i ], [ %add.i, %if.then.i ]
%b_score.sink.i = phi ptr [ %b_score, %if.then3.i ], [ %b_score, %if.else6.i ], [ %a_score, %if.then.i ]
%add5.i = add nsw i32 %add4.sink.i, %.sink.i
store i32 %add5.i, ptr %b_score.sink.i, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.08, 1
%exitcond.not = icmp eq i32 %inc, %n
br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %judge_score.exit
%a_score.0.a_score.0.a_score.0..pre = load i32, ptr %a_score, align 4, !tbaa !5
%b_score.0.b_score.0.b_score.0..pre = load i32, ptr %b_score, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%b_score.0.b_score.0. = phi i32 [ %b_score.0.b_score.0.b_score.0..pre, %for.end.loopexit ], [ 0, %entry ]
%a_score.0.a_score.0. = phi i32 [ %a_score.0.a_score.0.a_score.0..pre, %for.end.loopexit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %a_score.0.a_score.0., i32 noundef %b_score.0.b_score.0.)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b_card) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a_card) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b_score)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a_score)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @judge_score(ptr nocapture noundef %a_score, ptr nocapture noundef %b_score, i32 noundef %a_card, i32 noundef %b_card) local_unnamed_addr #5 {
entry:
%cmp = icmp sgt i32 %a_card, %b_card
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%add = add nsw i32 %b_card, %a_card
%0 = load i32, ptr %a_score, align 4, !tbaa !5
br label %if.end9
if.else: ; preds = %entry
%cmp2 = icmp slt i32 %a_card, %b_card
br i1 %cmp2, label %if.then3, label %if.else6
if.then3: ; preds = %if.else
%add4 = add nsw i32 %b_card, %a_card
%1 = load i32, ptr %b_score, align 4, !tbaa !5
br label %if.end9
if.else6: ; preds = %if.else
%2 = load i32, ptr %a_score, align 4, !tbaa !5
%add7 = add nsw i32 %2, %a_card
store i32 %add7, ptr %a_score, align 4, !tbaa !5
%3 = load i32, ptr %b_score, align 4, !tbaa !5
br label %if.end9
if.end9: ; preds = %if.then3, %if.else6, %if.then
%.sink = phi i32 [ %1, %if.then3 ], [ %b_card, %if.else6 ], [ %0, %if.then ]
%add4.sink = phi i32 [ %add4, %if.then3 ], [ %3, %if.else6 ], [ %add, %if.then ]
%b_score.sink = phi ptr [ %b_score, %if.then3 ], [ %b_score, %if.else6 ], [ %a_score, %if.then ]
%add5 = add nsw i32 %add4.sink, %.sink
store i32 %add5, ptr %b_score.sink, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int i;
int n,a,b;
int as=0,bs=0;
while(1){
as=0;
bs=0;
scanf("%d",&n);
if(n==0)break;
for(i=0;i<n;i++){
scanf("%d%d",&a,&b);
if(a>b)as+=a+b;
else if(a==b){
as+=a;
bs+=b;
}else bs+=a+b;
}
printf("%d %d\n",as,bs);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150144/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150144/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp eq i32 %0, 0
br i1 %cmp29, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %5, %for.end ], [ %0, %entry ]
%cmp123 = icmp sgt i32 %1, 0
br i1 %cmp123, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.inc
%bs.026 = phi i32 [ %bs.1, %for.inc ], [ 0, %for.cond.preheader ]
%as.025 = phi i32 [ %as.1, %for.inc ], [ 0, %for.cond.preheader ]
%i.024 = phi i32 [ %inc, %for.inc ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %2, %3
br i1 %cmp3, label %if.then4, label %if.else
if.then4: ; preds = %for.body
%add = add i32 %2, %as.025
%add5 = add i32 %add, %3
br label %for.inc
if.else: ; preds = %for.body
%cmp6 = icmp eq i32 %2, %3
br i1 %cmp6, label %if.then7, label %if.else10
if.then7: ; preds = %if.else
%add8 = add nsw i32 %2, %as.025
%add9 = add nsw i32 %2, %bs.026
br label %for.inc
if.else10: ; preds = %if.else
%add11 = add i32 %3, %bs.026
%add12 = add i32 %add11, %2
br label %for.inc
for.inc: ; preds = %if.then4, %if.else10, %if.then7
%as.1 = phi i32 [ %add5, %if.then4 ], [ %add8, %if.then7 ], [ %as.025, %if.else10 ]
%bs.1 = phi i32 [ %bs.026, %if.then4 ], [ %add9, %if.then7 ], [ %add12, %if.else10 ]
%inc = add nuw nsw i32 %i.024, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc, %4
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%as.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %as.1, %for.inc ]
%bs.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %bs.1, %for.inc ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %as.0.lcssa, i32 noundef %bs.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %5, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n;
int i;
int A,B;
int a,b;
while(1){
scanf("%d",&n);
if(n==0) break;
A = 0;
B = 0;
for(i=0; i<n; i++){
scanf("%d %d",&a,&b);
if(a<b) B += a+b;
else if(a>b) A += a+b;
else{
A += a;
B += b;
}
}
printf("%d %d\n",A,B);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150188/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150188/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [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:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp eq i32 %0, 0
br i1 %cmp29, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %5, %for.end ], [ %0, %entry ]
%cmp123 = icmp sgt i32 %1, 0
br i1 %cmp123, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.inc
%B.026 = phi i32 [ %B.1, %for.inc ], [ 0, %for.cond.preheader ]
%A.025 = phi i32 [ %A.1, %for.inc ], [ 0, %for.cond.preheader ]
%i.024 = phi i32 [ %inc, %for.inc ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp3 = icmp slt i32 %2, %3
br i1 %cmp3, label %if.then4, label %if.else
if.then4: ; preds = %for.body
%add = add i32 %3, %B.026
%add5 = add i32 %add, %2
br label %for.inc
if.else: ; preds = %for.body
%cmp6 = icmp sgt i32 %2, %3
%add8 = add i32 %2, %A.025
br i1 %cmp6, label %if.then7, label %if.else10
if.then7: ; preds = %if.else
%add9 = add i32 %add8, %3
br label %for.inc
if.else10: ; preds = %if.else
%add12 = add nsw i32 %3, %B.026
br label %for.inc
for.inc: ; preds = %if.then4, %if.else10, %if.then7
%A.1 = phi i32 [ %A.025, %if.then4 ], [ %add9, %if.then7 ], [ %add8, %if.else10 ]
%B.1 = phi i32 [ %add5, %if.then4 ], [ %B.026, %if.then7 ], [ %add12, %if.else10 ]
%inc = add nuw nsw i32 %i.024, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc, %4
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%A.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %A.1, %for.inc ]
%B.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %B.1, %for.inc ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %A.0.lcssa, i32 noundef %B.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %5, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n,a,b,i;
while(scanf("%d",&n),n){
int Pa=0,Pb=0;
for(i=0;i<n;i++){
scanf("%d %d",&a,&b);
if(a>b)Pa+=a+b;
else if(a<b)Pb+=a+b;
else {Pa+=a; Pb+=b;}
}
printf("%d %d\n",Pa,Pb);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150245/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150245/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [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:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not26 = icmp eq i32 %0, 0
br i1 %tobool.not26, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %5, %for.end ], [ %0, %entry ]
%cmp20 = icmp sgt i32 %1, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.inc
%Pb.023 = phi i32 [ %Pb.1, %for.inc ], [ 0, %for.cond.preheader ]
%Pa.022 = phi i32 [ %Pa.1, %for.inc ], [ 0, %for.cond.preheader ]
%i.021 = phi i32 [ %inc, %for.inc ], [ 0, %for.cond.preheader ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %2, %3
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%add = add i32 %2, %Pa.022
%add3 = add i32 %add, %3
br label %for.inc
if.else: ; preds = %for.body
%cmp4 = icmp slt i32 %2, %3
br i1 %cmp4, label %if.then5, label %if.else8
if.then5: ; preds = %if.else
%add6 = add i32 %3, %Pb.023
%add7 = add i32 %add6, %2
br label %for.inc
if.else8: ; preds = %if.else
%add9 = add nsw i32 %2, %Pa.022
%add10 = add nsw i32 %3, %Pb.023
br label %for.inc
for.inc: ; preds = %if.then, %if.else8, %if.then5
%Pa.1 = phi i32 [ %add3, %if.then ], [ %Pa.022, %if.then5 ], [ %add9, %if.else8 ]
%Pb.1 = phi i32 [ %Pb.023, %if.then ], [ %add7, %if.then5 ], [ %add10, %if.else8 ]
%inc = add nuw nsw i32 %i.021, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%Pa.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %Pa.1, %for.inc ]
%Pb.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %Pb.1, %for.inc ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %Pa.0.lcssa, i32 noundef %Pb.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%5 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %5, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
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>
int main()
{
int a,b;
int i,n;
int sa,sb;
while(1){
scanf("%d", &n);
if(n==0){
break;
}
sa=0;
sb=0;
for(i=0; i<n; i++){
scanf("%d %d", &a, &b);
if(a>b){
sa+=a+b;
}
else if(b>a){
sb+=a+b;
}
else{
sa+=a;
sb+=b;
}
}
printf("%d %d\n", sa, sb);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150289/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150289/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp eq i32 %0, 0
br i1 %cmp29, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %5, %for.end ], [ %0, %entry ]
%cmp123 = icmp sgt i32 %1, 0
br i1 %cmp123, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.inc
%sb.026 = phi i32 [ %sb.1, %for.inc ], [ 0, %for.cond.preheader ]
%sa.025 = phi i32 [ %sa.1, %for.inc ], [ 0, %for.cond.preheader ]
%i.024 = phi i32 [ %inc, %for.inc ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %2, %3
br i1 %cmp3, label %if.then4, label %if.else
if.then4: ; preds = %for.body
%add = add i32 %2, %sa.025
%add5 = add i32 %add, %3
br label %for.inc
if.else: ; preds = %for.body
%cmp6 = icmp sgt i32 %3, %2
br i1 %cmp6, label %if.then7, label %if.else10
if.then7: ; preds = %if.else
%add8 = add i32 %3, %sb.026
%add9 = add i32 %add8, %2
br label %for.inc
if.else10: ; preds = %if.else
%add11 = add nsw i32 %2, %sa.025
%add12 = add nsw i32 %3, %sb.026
br label %for.inc
for.inc: ; preds = %if.then4, %if.else10, %if.then7
%sa.1 = phi i32 [ %add5, %if.then4 ], [ %sa.025, %if.then7 ], [ %add11, %if.else10 ]
%sb.1 = phi i32 [ %sb.026, %if.then4 ], [ %add9, %if.then7 ], [ %add12, %if.else10 ]
%inc = add nuw nsw i32 %i.024, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc, %4
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%sa.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %sa.1, %for.inc ]
%sb.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %sb.1, %for.inc ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sa.0.lcssa, i32 noundef %sb.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %5, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
short i, n, a, b;
long ap, bp;
scanf("%d", &n);
while (n) {
ap = 0;
bp = 0;
for (i = 0; i < n; i++) {
scanf("%hd%hd", &a, &b);
if (a > b)
ap += a + b;
else if (b > a)
bp += a + b;
else {
ap += a;
bp += b;
}
}
printf("%d %d\n", ap, bp);
scanf("%d", &n);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150331/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150331/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%hd%hd\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i16, align 2
%a = alloca i16, align 2
%b = alloca i16, align 2
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i16, ptr %n, align 2, !tbaa !5
%tobool.not40 = icmp eq i16 %0, 0
br i1 %tobool.not40, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i16 [ %5, %for.end ], [ %0, %entry ]
%cmp35 = icmp sgt i16 %1, 0
br i1 %cmp35, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.inc
%bp.038 = phi i64 [ %bp.1, %for.inc ], [ 0, %for.cond.preheader ]
%ap.037 = phi i64 [ %ap.1, %for.inc ], [ 0, %for.cond.preheader ]
%i.036 = phi i16 [ %inc, %for.inc ], [ 0, %for.cond.preheader ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i16, ptr %a, align 2, !tbaa !5
%conv4 = sext i16 %2 to i32
%3 = load i16, ptr %b, align 2, !tbaa !5
%conv5 = sext i16 %3 to i32
%cmp6 = icmp sgt i16 %2, %3
br i1 %cmp6, label %if.then, label %if.else
if.then: ; preds = %for.body
%add = add nsw i32 %conv5, %conv4
%conv10 = sext i32 %add to i64
%add11 = add nsw i64 %ap.037, %conv10
br label %for.inc
if.else: ; preds = %for.body
%cmp14 = icmp sgt i16 %3, %2
br i1 %cmp14, label %if.then16, label %if.else22
if.then16: ; preds = %if.else
%add19 = add nsw i32 %conv5, %conv4
%conv20 = sext i32 %add19 to i64
%add21 = add nsw i64 %bp.038, %conv20
br label %for.inc
if.else22: ; preds = %if.else
%conv23 = sext i16 %2 to i64
%add24 = add nsw i64 %ap.037, %conv23
%conv25 = sext i16 %3 to i64
%add26 = add nsw i64 %bp.038, %conv25
br label %for.inc
for.inc: ; preds = %if.then, %if.else22, %if.then16
%ap.1 = phi i64 [ %add11, %if.then ], [ %ap.037, %if.then16 ], [ %add24, %if.else22 ]
%bp.1 = phi i64 [ %bp.038, %if.then ], [ %add21, %if.then16 ], [ %add26, %if.else22 ]
%inc = add nuw nsw i16 %i.036, 1
%4 = load i16, ptr %n, align 2, !tbaa !5
%cmp = icmp slt i16 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%ap.0.lcssa = phi i64 [ 0, %for.cond.preheader ], [ %ap.1, %for.inc ]
%bp.0.lcssa = phi i64 [ 0, %for.cond.preheader ], [ %bp.1, %for.inc ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ap.0.lcssa, i64 noundef %bp.0.lcssa)
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%5 = load i16, ptr %n, align 2, !tbaa !5
%tobool.not = icmp eq i16 %5, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 2, 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 = !{!"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}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
int get_int(void) {
int num;
scanf("%d", &num);
return num;
}
int get_int2(int *a1, int *a2) {
scanf("%d %d", a1, a2);
return 0;
}
int get_int3(int *a1, int *a2, int *a3) {
scanf("%d %d %d", a1, a2, a3);
return 0;
}
#define HASH_SIZE 65536
struct list {
int num;
int idx;
struct list *next;
};
struct list *create_htable(void) {
static struct list htable[HASH_SIZE];
int i;
for(i = 0; i < HASH_SIZE; i++) {
htable[i].next = &htable[i];
}
return htable;
}
int get_key(int num) {
return num & (HASH_SIZE-1);
}
int find_idx(struct list *htable, int num) {
struct list *head = &htable[get_key(num)];
struct list *elem;
for(elem = head->next; elem != head; elem = elem->next) {
if(elem->num == num) {
return elem->idx;
}
}
return -1;
}
void add_elem(struct list *htable, int num, int idx) {
struct list *elem = malloc(sizeof(struct list));
struct list *head = &htable[get_key(num)];
elem->next = head->next;
elem->num = num;
elem->idx = idx;
head->next = elem;
}
struct range {
int start;
int end;
};
struct work {
struct range r;
int pos;
};
int desc_by_pos(const void *a1, const void *a2) {
struct work *w1 = (struct work*)a1;
struct work *w2 = (struct work*)a2;
return w2->pos - w1->pos;
}
#define NUM_MAX 200000
#define ROOT_NODE 1
#define QUERY_MAX 200000
// 524288
#define SIZE2_MAX (1<<19)
int upper_bound(int *arr, int size, int key) {
int low = -1;
int high = size;
while(low + 1 < high) {
int mid = (low + high) / 2;
if(arr[mid] <= key) {
low = mid;
} else {
high = mid;
}
}
return low;
}
int asc(const void *a1, const void *a2) {
return *(int*)a1 - *(int*)a2;
}
int compress(struct work *works, int size, int *unzip) {
static int sorted[NUM_MAX*2+50];
int i;
for(i = 0; i < size; i++) {
sorted[i] = works[i].r.start;
}
for(i = 0; i < size; i++) {
sorted[i+size] = works[i].r.end;
}
qsort(sorted, size*2, sizeof(int), asc);
struct list *htable = create_htable();
int prev = sorted[0]-1;
// 0-indexed
int idx = 0;
for(i = 0; i < size*2; i++) {
int cur = sorted[i];
if(prev == cur) continue;
add_elem(htable, cur, idx);
unzip[idx] = cur;
idx++;
prev = cur;
}
// transform in place
for(i = 0; i < size; i++) {
struct range r = works[i].r;
works[i].r.start = find_idx(htable, r.start);
works[i].r.end = find_idx(htable, r.end);
}
return idx;
}
// segtree
int is_overlap(struct range r1, struct range r2) {
return r1.end > r2.start && r2.end > r1.start;
}
int is_contain(struct range this, struct range box) {
return box.start <= this.start && this.end <= box.end;
}
void update(int *seg, struct range r, int val, int node, struct range nr) {
if(!is_overlap(r, nr)) return;
if(is_contain(nr, r)) {
// update
seg[node] = val;
return;
}
struct range left = (struct range){nr.start, (nr.start+nr.end)/2};
struct range right = (struct range){(nr.start+nr.end)/2, nr.end};
update(seg, r, val, node*2, left);
update(seg, r, val, node*2+1, right);
return;
}
#define INF 0x7f7f7f7f
int get_val(int *seg, int size2, int idx) {
int node = size2 + idx;
int ans = INF;
while(node) {
ans = min(seg[node], ans);
node /= 2;
}
return ans;
}
int main(void) {
int num, qs;
get_int2(&num, &qs);
static struct work works[NUM_MAX];
int i;
for(i = 0; i < num; i++) {
int start, end, pos;
get_int3(&start, &end, &pos);
works[i] = (struct work){
{max(start-pos, 0), max(0, end-pos)}, pos
};
}
static int unzip[NUM_MAX*2+50];
// 0-indexed
// size <= NUM_MAX*2 < 400000
int size = compress(works, num, unzip);
#ifdef DEBUG
for(i = 0; i < size; i++) {
printf("%d[size: %d]: %d\n", i, size, unzip[i]);
}
#endif
int size2 = 1;
// power of 2
while(size > size2) size2 *= 2;
qsort(works, num, sizeof(struct work), desc_by_pos);
static int seg[SIZE2_MAX*2];
memset(seg, 0x7f, sizeof(int)*(SIZE2_MAX*2));
struct range whole = {0, size2};
for(i = 0; i < num; i++) {
struct work w = works[i];
#ifdef DEBUG
printf("%d, %d to val: %d\n", w.r.start, w.r.end, w.pos);
#endif
if(w.r.end == 0) continue; // no longer need
update(seg, w.r, w.pos, ROOT_NODE, whole);
}
static int ans[QUERY_MAX];
int aidx = 0;
for(i = 0; i < qs; i++) {
int q = get_int();
int idx = upper_bound(unzip, size, q);
if(idx == -1) {
ans[aidx++] = INF;
} else {
ans[aidx++] = get_val(seg, size2, idx);
}
}
for(i = 0; i < qs; i++) {
printf("%d\n", ans[i] == INF ? -1 : ans[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150375/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150375/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.list = type { i32, i32, ptr }
%struct.work = type { %struct.range, i32 }
%struct.range = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@create_htable.htable = internal global [65536 x %struct.list] zeroinitializer, align 16
@compress.sorted = internal global [400050 x i32] zeroinitializer, align 16
@main.works = internal global [200000 x %struct.work] zeroinitializer, align 16
@main.unzip = internal global [400050 x i32] zeroinitializer, align 16
@main.seg = internal global [1048576 x i32] zeroinitializer, align 16
@main.ans = internal unnamed_addr global [200000 x i32] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #15
ret i32 %0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int2(ptr noundef %a1, ptr noundef %a2) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %a1, ptr noundef %a2)
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int3(ptr noundef %a1, ptr noundef %a2, ptr noundef %a3) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %a1, ptr noundef %a2, ptr noundef %a3)
ret i32 0
}
; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local nonnull ptr @create_htable() local_unnamed_addr #3 {
entry:
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body ]
%arrayidx = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv
%next = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv, i32 2
store ptr %arrayidx, ptr %next, align 8, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next
%next.1 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next, i32 2
store ptr %arrayidx.1, ptr %next.1, align 8, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.1
%next.2 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.1, i32 2
store ptr %arrayidx.2, ptr %next.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.2
%next.3 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.2, i32 2
store ptr %arrayidx.3, ptr %next.3, align 8, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 65536
br i1 %exitcond.not.3, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body
ret ptr @create_htable.htable
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @get_key(i32 noundef %num) local_unnamed_addr #4 {
entry:
%and = and i32 %num, 65535
ret i32 %and
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @find_idx(ptr noundef readonly %htable, i32 noundef %num) local_unnamed_addr #5 {
entry:
%and.i = and i32 %num, 65535
%idxprom = zext i32 %and.i to i64
%arrayidx = getelementptr inbounds %struct.list, ptr %htable, i64 %idxprom
%next = getelementptr inbounds %struct.list, ptr %htable, i64 %idxprom, i32 2
%elem.011 = load ptr, ptr %next, align 8, !tbaa !9
%cmp.not12 = icmp eq ptr %elem.011, %arrayidx
br i1 %cmp.not12, label %cleanup, label %for.body
for.body: ; preds = %entry, %for.inc
%elem.013 = phi ptr [ %elem.0, %for.inc ], [ %elem.011, %entry ]
%0 = load i32, ptr %elem.013, align 8, !tbaa !14
%cmp2 = icmp eq i32 %0, %num
br i1 %cmp2, label %if.then, label %for.inc
if.then: ; preds = %for.body
%idx = getelementptr inbounds %struct.list, ptr %elem.013, i64 0, i32 1
%1 = load i32, ptr %idx, align 4, !tbaa !15
br label %cleanup
for.inc: ; preds = %for.body
%next3 = getelementptr inbounds %struct.list, ptr %elem.013, i64 0, i32 2
%elem.0 = load ptr, ptr %next3, align 8, !tbaa !9
%cmp.not = icmp eq ptr %elem.0, %arrayidx
br i1 %cmp.not, label %cleanup, label %for.body, !llvm.loop !16
cleanup: ; preds = %for.inc, %entry, %if.then
%retval.0 = phi i32 [ %1, %if.then ], [ -1, %entry ], [ -1, %for.inc ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: readwrite) uwtable
define dso_local void @add_elem(ptr nocapture noundef %htable, i32 noundef %num, i32 noundef %idx) local_unnamed_addr #6 {
entry:
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #16
%and.i = and i32 %num, 65535
%idxprom = zext i32 %and.i to i64
%next = getelementptr inbounds %struct.list, ptr %htable, i64 %idxprom, i32 2
%0 = load ptr, ptr %next, align 8, !tbaa !9
%next2 = getelementptr inbounds %struct.list, ptr %call, i64 0, i32 2
store ptr %0, ptr %next2, align 8, !tbaa !9
store i32 %num, ptr %call, align 8, !tbaa !14
%idx4 = getelementptr inbounds %struct.list, ptr %call, i64 0, i32 1
store i32 %idx, ptr %idx4, align 4, !tbaa !15
store ptr %call, ptr %next, align 8, !tbaa !9
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 #7
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @desc_by_pos(ptr nocapture noundef readonly %a1, ptr nocapture noundef readonly %a2) #8 {
entry:
%pos = getelementptr inbounds %struct.work, ptr %a2, i64 0, i32 1
%0 = load i32, ptr %pos, align 4, !tbaa !17
%pos1 = getelementptr inbounds %struct.work, ptr %a1, i64 0, i32 1
%1 = load i32, ptr %pos1, align 4, !tbaa !17
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @upper_bound(ptr nocapture noundef readonly %arr, i32 noundef %size, i32 noundef %key) local_unnamed_addr #9 {
entry:
%cmp8 = icmp sgt i32 %size, 0
br i1 %cmp8, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%low.010 = phi i32 [ %low.0.div, %while.body ], [ -1, %entry ]
%high.09 = phi i32 [ %div.high.0, %while.body ], [ %size, %entry ]
%add1 = add nsw i32 %low.010, %high.09
%div = sdiv i32 %add1, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp2.not = icmp sgt i32 %0, %key
%div.high.0 = select i1 %cmp2.not, i32 %div, i32 %high.09
%low.0.div = select i1 %cmp2.not, i32 %low.010, i32 %div
%add = add nsw i32 %low.0.div, 1
%cmp = icmp slt i32 %add, %div.high.0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !20
while.end: ; preds = %while.body, %entry
%low.0.lcssa = phi i32 [ -1, %entry ], [ %low.0.div, %while.body ]
ret i32 %low.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @asc(ptr nocapture noundef readonly %a1, ptr nocapture noundef readonly %a2) #8 {
entry:
%0 = load i32, ptr %a1, align 4, !tbaa !5
%1 = load i32, ptr %a2, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @compress(ptr nocapture noundef %works, i32 noundef %size, ptr nocapture noundef writeonly %unzip) local_unnamed_addr #0 {
entry:
%cmp113 = icmp sgt i32 %size, 0
br i1 %cmp113, label %for.body.preheader, label %for.end13
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %size to i64
%min.iters.check = icmp ult i32 %size, 21
br i1 %min.iters.check, label %for.body.preheader170, label %vector.memcheck
for.body.preheader170: ; preds = %vector.body, %vector.memcheck, %for.body.preheader
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %vector.body ]
%0 = sub nsw i64 %wide.trip.count, %indvars.iv.ph
%1 = xor i64 %indvars.iv.ph, -1
%2 = add nsw i64 %1, %wide.trip.count
%xtraiter = and i64 %0, 3
%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.preheader170, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader170 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader170 ]
%arrayidx.prol = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv.prol
%3 = load i32, ptr %arrayidx.prol, align 4, !tbaa !21
%arrayidx2.prol = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %indvars.iv.prol
store i32 %3, ptr %arrayidx2.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !22
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader170
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader170 ], [ %indvars.iv.next.prol, %for.body.prol ]
%4 = icmp ult i64 %2, 3
br i1 %4, label %for.cond3.preheader, label %for.body
vector.memcheck: ; preds = %for.body.preheader
%5 = shl nuw nsw i64 %wide.trip.count, 2
%scevgep = getelementptr i8, ptr @compress.sorted, i64 %5
%6 = mul nuw nsw i64 %wide.trip.count, 12
%7 = getelementptr i8, ptr %works, i64 %6
%scevgep148 = getelementptr i8, ptr %7, i64 -8
%bound0 = icmp ugt ptr %scevgep148, @compress.sorted
%bound1 = icmp ugt ptr %scevgep, %works
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body.preheader170, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.mod.vf = and i64 %wide.trip.count, 7
%8 = icmp eq i64 %n.mod.vf, 0
%9 = select i1 %8, i64 8, i64 %n.mod.vf
%n.vec = sub nsw i64 %wide.trip.count, %9
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%10 = or i64 %index, 1
%11 = or i64 %index, 2
%12 = or i64 %index, 3
%13 = or i64 %index, 4
%14 = or i64 %index, 5
%15 = or i64 %index, 6
%16 = or i64 %index, 7
%17 = getelementptr inbounds %struct.work, ptr %works, i64 %index
%18 = getelementptr inbounds %struct.work, ptr %works, i64 %10
%19 = getelementptr inbounds %struct.work, ptr %works, i64 %11
%20 = getelementptr inbounds %struct.work, ptr %works, i64 %12
%21 = getelementptr inbounds %struct.work, ptr %works, i64 %13
%22 = getelementptr inbounds %struct.work, ptr %works, i64 %14
%23 = getelementptr inbounds %struct.work, ptr %works, i64 %15
%24 = getelementptr inbounds %struct.work, ptr %works, i64 %16
%25 = load i32, ptr %17, align 4, !tbaa !21, !alias.scope !24
%26 = load i32, ptr %18, align 4, !tbaa !21, !alias.scope !24
%27 = load i32, ptr %19, align 4, !tbaa !21, !alias.scope !24
%28 = load i32, ptr %20, align 4, !tbaa !21, !alias.scope !24
%29 = insertelement <4 x i32> poison, i32 %25, i64 0
%30 = insertelement <4 x i32> %29, i32 %26, i64 1
%31 = insertelement <4 x i32> %30, i32 %27, i64 2
%32 = insertelement <4 x i32> %31, i32 %28, i64 3
%33 = load i32, ptr %21, align 4, !tbaa !21, !alias.scope !24
%34 = load i32, ptr %22, align 4, !tbaa !21, !alias.scope !24
%35 = load i32, ptr %23, align 4, !tbaa !21, !alias.scope !24
%36 = load i32, ptr %24, align 4, !tbaa !21, !alias.scope !24
%37 = insertelement <4 x i32> poison, i32 %33, i64 0
%38 = insertelement <4 x i32> %37, i32 %34, i64 1
%39 = insertelement <4 x i32> %38, i32 %35, i64 2
%40 = insertelement <4 x i32> %39, i32 %36, i64 3
%41 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %index
store <4 x i32> %32, ptr %41, align 16, !tbaa !5, !alias.scope !27, !noalias !24
%42 = getelementptr inbounds i32, ptr %41, i64 4
store <4 x i32> %40, ptr %42, align 16, !tbaa !5, !alias.scope !27, !noalias !24
%index.next = add nuw i64 %index, 8
%43 = icmp eq i64 %index.next, %n.vec
br i1 %43, label %for.body.preheader170, label %vector.body, !llvm.loop !29
for.cond3.preheader: ; preds = %for.body, %for.body.prol.loopexit
br i1 %cmp113, label %for.body5.preheader, label %for.end13
for.body5.preheader: ; preds = %for.cond3.preheader
%44 = zext i32 %size to i64
%wide.trip.count130 = zext i32 %size to i64
%min.iters.check159 = icmp ult i32 %size, 17
br i1 %min.iters.check159, label %for.body5.preheader169, label %vector.memcheck149
for.body5.preheader169: ; preds = %vector.body164, %vector.memcheck149, %for.body5.preheader
%indvars.iv126.ph = phi i64 [ 0, %vector.memcheck149 ], [ 0, %for.body5.preheader ], [ %n.vec162, %vector.body164 ]
%45 = sub nsw i64 %wide.trip.count, %indvars.iv126.ph
%xtraiter171 = and i64 %45, 1
%lcmp.mod172.not = icmp eq i64 %xtraiter171, 0
br i1 %lcmp.mod172.not, label %for.body5.prol.loopexit, label %for.body5.prol
for.body5.prol: ; preds = %for.body5.preheader169
%end.prol = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv126.ph, i32 0, i32 1
%46 = load i32, ptr %end.prol, align 4, !tbaa !32
%47 = add nuw nsw i64 %indvars.iv126.ph, %44
%arrayidx10.prol = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %47
store i32 %46, ptr %arrayidx10.prol, align 4, !tbaa !5
%indvars.iv.next127.prol = add nuw nsw i64 %indvars.iv126.ph, 1
br label %for.body5.prol.loopexit
for.body5.prol.loopexit: ; preds = %for.body5.prol, %for.body5.preheader169
%indvars.iv126.unr = phi i64 [ %indvars.iv126.ph, %for.body5.preheader169 ], [ %indvars.iv.next127.prol, %for.body5.prol ]
%48 = sub nsw i64 0, %wide.trip.count
%49 = xor i64 %indvars.iv126.ph, %48
%50 = icmp eq i64 %49, -1
br i1 %50, label %for.end13, label %for.body5
vector.memcheck149: ; preds = %for.body5.preheader
%51 = shl nuw nsw i64 %wide.trip.count, 2
%scevgep150 = getelementptr i8, ptr @compress.sorted, i64 %51
%52 = shl nuw nsw i64 %wide.trip.count, 3
%scevgep151 = getelementptr i8, ptr @compress.sorted, i64 %52
%scevgep152 = getelementptr i8, ptr %works, i64 4
%53 = mul nuw nsw i64 %wide.trip.count, 12
%54 = getelementptr i8, ptr %works, i64 %53
%scevgep153 = getelementptr i8, ptr %54, i64 -4
%bound0154 = icmp ult ptr %scevgep150, %scevgep153
%bound1155 = icmp ult ptr %scevgep152, %scevgep151
%found.conflict156 = and i1 %bound0154, %bound1155
br i1 %found.conflict156, label %for.body5.preheader169, label %vector.ph160
vector.ph160: ; preds = %vector.memcheck149
%n.mod.vf161 = and i64 %wide.trip.count, 7
%55 = icmp eq i64 %n.mod.vf161, 0
%56 = select i1 %55, i64 8, i64 %n.mod.vf161
%n.vec162 = sub nsw i64 %wide.trip.count, %56
br label %vector.body164
vector.body164: ; preds = %vector.body164, %vector.ph160
%index165 = phi i64 [ 0, %vector.ph160 ], [ %index.next166, %vector.body164 ]
%57 = or i64 %index165, 1
%58 = or i64 %index165, 2
%59 = or i64 %index165, 3
%60 = or i64 %index165, 4
%61 = or i64 %index165, 5
%62 = or i64 %index165, 6
%63 = or i64 %index165, 7
%64 = getelementptr inbounds %struct.work, ptr %works, i64 %index165, i32 0, i32 1
%65 = getelementptr inbounds %struct.work, ptr %works, i64 %57, i32 0, i32 1
%66 = getelementptr inbounds %struct.work, ptr %works, i64 %58, i32 0, i32 1
%67 = getelementptr inbounds %struct.work, ptr %works, i64 %59, i32 0, i32 1
%68 = getelementptr inbounds %struct.work, ptr %works, i64 %60, i32 0, i32 1
%69 = getelementptr inbounds %struct.work, ptr %works, i64 %61, i32 0, i32 1
%70 = getelementptr inbounds %struct.work, ptr %works, i64 %62, i32 0, i32 1
%71 = getelementptr inbounds %struct.work, ptr %works, i64 %63, i32 0, i32 1
%72 = load i32, ptr %64, align 4, !tbaa !32, !alias.scope !33
%73 = load i32, ptr %65, align 4, !tbaa !32, !alias.scope !33
%74 = load i32, ptr %66, align 4, !tbaa !32, !alias.scope !33
%75 = load i32, ptr %67, align 4, !tbaa !32, !alias.scope !33
%76 = insertelement <4 x i32> poison, i32 %72, i64 0
%77 = insertelement <4 x i32> %76, i32 %73, i64 1
%78 = insertelement <4 x i32> %77, i32 %74, i64 2
%79 = insertelement <4 x i32> %78, i32 %75, i64 3
%80 = load i32, ptr %68, align 4, !tbaa !32, !alias.scope !33
%81 = load i32, ptr %69, align 4, !tbaa !32, !alias.scope !33
%82 = load i32, ptr %70, align 4, !tbaa !32, !alias.scope !33
%83 = load i32, ptr %71, align 4, !tbaa !32, !alias.scope !33
%84 = insertelement <4 x i32> poison, i32 %80, i64 0
%85 = insertelement <4 x i32> %84, i32 %81, i64 1
%86 = insertelement <4 x i32> %85, i32 %82, i64 2
%87 = insertelement <4 x i32> %86, i32 %83, i64 3
%88 = add nuw nsw i64 %index165, %44
%89 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %88
store <4 x i32> %79, ptr %89, align 4, !tbaa !5, !alias.scope !36, !noalias !33
%90 = getelementptr inbounds i32, ptr %89, i64 4
store <4 x i32> %87, ptr %90, align 4, !tbaa !5, !alias.scope !36, !noalias !33
%index.next166 = add nuw i64 %index165, 8
%91 = icmp eq i64 %index.next166, %n.vec162
br i1 %91, label %for.body5.preheader169, label %vector.body164, !llvm.loop !38
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv
%92 = load i32, ptr %arrayidx, align 4, !tbaa !21
%arrayidx2 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %indvars.iv
store i32 %92, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv.next
%93 = load i32, ptr %arrayidx.1, align 4, !tbaa !21
%arrayidx2.1 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %indvars.iv.next
store i32 %93, ptr %arrayidx2.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv.next.1
%94 = load i32, ptr %arrayidx.2, align 4, !tbaa !21
%arrayidx2.2 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %indvars.iv.next.1
store i32 %94, ptr %arrayidx2.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv.next.2
%95 = load i32, ptr %arrayidx.3, align 4, !tbaa !21
%arrayidx2.3 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %indvars.iv.next.2
store i32 %95, ptr %arrayidx2.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond3.preheader, label %for.body, !llvm.loop !39
for.body5: ; preds = %for.body5.prol.loopexit, %for.body5
%indvars.iv126 = phi i64 [ %indvars.iv.next127.1, %for.body5 ], [ %indvars.iv126.unr, %for.body5.prol.loopexit ]
%end = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv126, i32 0, i32 1
%96 = load i32, ptr %end, align 4, !tbaa !32
%97 = add nuw nsw i64 %indvars.iv126, %44
%arrayidx10 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %97
store i32 %96, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%end.1 = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv.next127, i32 0, i32 1
%98 = load i32, ptr %end.1, align 4, !tbaa !32
%99 = add nuw nsw i64 %indvars.iv.next127, %44
%arrayidx10.1 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %99
store i32 %98, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next127.1 = add nuw nsw i64 %indvars.iv126, 2
%exitcond131.not.1 = icmp eq i64 %indvars.iv.next127.1, %wide.trip.count130
br i1 %exitcond131.not.1, label %for.end13, label %for.body5, !llvm.loop !40
for.end13: ; preds = %for.body5.prol.loopexit, %for.body5, %entry, %for.cond3.preheader
%mul = shl nsw i32 %size, 1
%conv = sext i32 %mul to i64
tail call void @qsort(ptr noundef nonnull @compress.sorted, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @asc) #15
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.end13
%indvars.iv.i = phi i64 [ 0, %for.end13 ], [ %indvars.iv.next.i.3, %for.body.i ]
%arrayidx.i = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.i
%next.i = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.i, i32 2
store ptr %arrayidx.i, ptr %next.i, align 8, !tbaa !9
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i
%next.i.1 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i, i32 2
store ptr %arrayidx.i.1, ptr %next.i.1, align 8, !tbaa !9
%indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2
%arrayidx.i.2 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i.1
%next.i.2 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i.1, i32 2
store ptr %arrayidx.i.2, ptr %next.i.2, align 8, !tbaa !9
%indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3
%arrayidx.i.3 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i.2
%next.i.3 = getelementptr inbounds [65536 x %struct.list], ptr @create_htable.htable, i64 0, i64 %indvars.iv.next.i.2, i32 2
store ptr %arrayidx.i.3, ptr %next.i.3, align 8, !tbaa !9
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, 65536
br i1 %exitcond.not.i.3, label %create_htable.exit, label %for.body.i, !llvm.loop !12
create_htable.exit: ; preds = %for.body.i
br i1 %cmp113, label %for.body18.preheader, label %for.end51
for.body18.preheader: ; preds = %create_htable.exit
%100 = load i32, ptr @compress.sorted, align 16, !tbaa !5
%sub = add nsw i32 %100, -1
%smax = tail call i32 @llvm.smax.i32(i32 %mul, i32 1)
%wide.trip.count135 = zext i32 %smax to i64
br label %for.body18
for.cond29.preheader: ; preds = %cleanup
br i1 %cmp113, label %for.body32.preheader, label %for.end51
for.body32.preheader: ; preds = %for.cond29.preheader
%wide.trip.count140 = zext i32 %size to i64
br label %for.body32
for.body18: ; preds = %for.body18.preheader, %cleanup
%indvars.iv132 = phi i64 [ 0, %for.body18.preheader ], [ %indvars.iv.next133, %cleanup ]
%prev.0119 = phi i32 [ %sub, %for.body18.preheader ], [ %prev.1, %cleanup ]
%idx.0118 = phi i32 [ 0, %for.body18.preheader ], [ %idx.1, %cleanup ]
%arrayidx20 = getelementptr inbounds [400050 x i32], ptr @compress.sorted, i64 0, i64 %indvars.iv132
%101 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21 = icmp eq i32 %prev.0119, %101
br i1 %cmp21, label %cleanup, label %if.end
if.end: ; preds = %for.body18
%call.i = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #16
%and.i.i = and i32 %101, 65535
%idxprom.i = zext i32 %and.i.i to i64
%next.i88 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %idxprom.i, i32 2
%102 = load ptr, ptr %next.i88, align 8, !tbaa !9
%next2.i = getelementptr inbounds %struct.list, ptr %call.i, i64 0, i32 2
store ptr %102, ptr %next2.i, align 8, !tbaa !9
store i32 %101, ptr %call.i, align 8, !tbaa !14
%idx4.i = getelementptr inbounds %struct.list, ptr %call.i, i64 0, i32 1
store i32 %idx.0118, ptr %idx4.i, align 4, !tbaa !15
store ptr %call.i, ptr %next.i88, align 8, !tbaa !9
%idxprom23 = sext i32 %idx.0118 to i64
%arrayidx24 = getelementptr inbounds i32, ptr %unzip, i64 %idxprom23
store i32 %101, ptr %arrayidx24, align 4, !tbaa !5
%inc25 = add nsw i32 %idx.0118, 1
br label %cleanup
cleanup: ; preds = %for.body18, %if.end
%idx.1 = phi i32 [ %inc25, %if.end ], [ %idx.0118, %for.body18 ]
%prev.1 = phi i32 [ %101, %if.end ], [ %prev.0119, %for.body18 ]
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%exitcond136.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count135
br i1 %exitcond136.not, label %for.cond29.preheader, label %for.body18, !llvm.loop !41
for.body32: ; preds = %for.body32.preheader, %find_idx.exit110
%indvars.iv137 = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next138, %find_idx.exit110 ]
%arrayidx35 = getelementptr inbounds %struct.work, ptr %works, i64 %indvars.iv137
%r33.sroa.0.0.copyload = load i32, ptr %arrayidx35, align 4, !tbaa.struct !42
%r33.sroa.4.0.r36.sroa_idx = getelementptr inbounds i8, ptr %arrayidx35, i64 4
%r33.sroa.4.0.copyload = load i32, ptr %r33.sroa.4.0.r36.sroa_idx, align 4, !tbaa.struct !43
%and.i.i89 = and i32 %r33.sroa.0.0.copyload, 65535
%idxprom.i90 = zext i32 %and.i.i89 to i64
%arrayidx.i91 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %idxprom.i90
%next.i92 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %idxprom.i90, i32 2
%elem.011.i = load ptr, ptr %next.i92, align 8, !tbaa !9
%cmp.not12.i = icmp eq ptr %elem.011.i, %arrayidx.i91
br i1 %cmp.not12.i, label %find_idx.exit, label %for.body.i93
for.body.i93: ; preds = %for.body32, %for.inc.i
%elem.013.i = phi ptr [ %elem.0.i, %for.inc.i ], [ %elem.011.i, %for.body32 ]
%103 = load i32, ptr %elem.013.i, align 8, !tbaa !14
%cmp2.i = icmp eq i32 %103, %r33.sroa.0.0.copyload
br i1 %cmp2.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body.i93
%idx.i = getelementptr inbounds %struct.list, ptr %elem.013.i, i64 0, i32 1
%104 = load i32, ptr %idx.i, align 4, !tbaa !15
br label %find_idx.exit
for.inc.i: ; preds = %for.body.i93
%next3.i = getelementptr inbounds %struct.list, ptr %elem.013.i, i64 0, i32 2
%elem.0.i = load ptr, ptr %next3.i, align 8, !tbaa !9
%cmp.not.i = icmp eq ptr %elem.0.i, %arrayidx.i91
br i1 %cmp.not.i, label %find_idx.exit, label %for.body.i93, !llvm.loop !16
find_idx.exit: ; preds = %for.inc.i, %for.body32, %if.then.i
%retval.0.i = phi i32 [ %104, %if.then.i ], [ -1, %for.body32 ], [ -1, %for.inc.i ]
store i32 %retval.0.i, ptr %arrayidx35, align 4, !tbaa !21
%and.i.i94 = and i32 %r33.sroa.4.0.copyload, 65535
%idxprom.i95 = zext i32 %and.i.i94 to i64
%arrayidx.i96 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %idxprom.i95
%next.i97 = getelementptr inbounds %struct.list, ptr @create_htable.htable, i64 %idxprom.i95, i32 2
%elem.011.i98 = load ptr, ptr %next.i97, align 8, !tbaa !9
%cmp.not12.i99 = icmp eq ptr %elem.011.i98, %arrayidx.i96
br i1 %cmp.not12.i99, label %find_idx.exit110, label %for.body.i100
for.body.i100: ; preds = %find_idx.exit, %for.inc.i103
%elem.013.i101 = phi ptr [ %elem.0.i105, %for.inc.i103 ], [ %elem.011.i98, %find_idx.exit ]
%105 = load i32, ptr %elem.013.i101, align 8, !tbaa !14
%cmp2.i102 = icmp eq i32 %105, %r33.sroa.4.0.copyload
br i1 %cmp2.i102, label %if.then.i108, label %for.inc.i103
if.then.i108: ; preds = %for.body.i100
%idx.i109 = getelementptr inbounds %struct.list, ptr %elem.013.i101, i64 0, i32 1
%106 = load i32, ptr %idx.i109, align 4, !tbaa !15
br label %find_idx.exit110
for.inc.i103: ; preds = %for.body.i100
%next3.i104 = getelementptr inbounds %struct.list, ptr %elem.013.i101, i64 0, i32 2
%elem.0.i105 = load ptr, ptr %next3.i104, align 8, !tbaa !9
%cmp.not.i106 = icmp eq ptr %elem.0.i105, %arrayidx.i96
br i1 %cmp.not.i106, label %find_idx.exit110, label %for.body.i100, !llvm.loop !16
find_idx.exit110: ; preds = %for.inc.i103, %find_idx.exit, %if.then.i108
%retval.0.i107 = phi i32 [ %106, %if.then.i108 ], [ -1, %find_idx.exit ], [ -1, %for.inc.i103 ]
store i32 %retval.0.i107, ptr %r33.sroa.4.0.r36.sroa_idx, align 4, !tbaa !32
%indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
%exitcond141.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count140
br i1 %exitcond141.not, label %for.end51, label %for.body32, !llvm.loop !44
for.end51: ; preds = %find_idx.exit110, %create_htable.exit, %for.cond29.preheader
%idx.0.lcssa143 = phi i32 [ %idx.1, %for.cond29.preheader ], [ 0, %create_htable.exit ], [ %idx.1, %find_idx.exit110 ]
ret i32 %idx.0.lcssa143
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #10
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @is_overlap(i64 %r1.coerce, i64 %r2.coerce) local_unnamed_addr #4 {
entry:
%r1.sroa.0.0.extract.trunc = trunc i64 %r1.coerce to i32
%r1.sroa.2.0.extract.shift = lshr i64 %r1.coerce, 32
%r1.sroa.2.0.extract.trunc = trunc i64 %r1.sroa.2.0.extract.shift to i32
%r2.sroa.0.0.extract.trunc = trunc i64 %r2.coerce to i32
%r2.sroa.2.0.extract.shift = lshr i64 %r2.coerce, 32
%r2.sroa.2.0.extract.trunc = trunc i64 %r2.sroa.2.0.extract.shift to i32
%cmp = icmp sgt i32 %r1.sroa.2.0.extract.trunc, %r2.sroa.0.0.extract.trunc
%cmp3 = icmp sgt i32 %r2.sroa.2.0.extract.trunc, %r1.sroa.0.0.extract.trunc
%0 = select i1 %cmp, i1 %cmp3, i1 false
%land.ext = zext i1 %0 to i32
ret i32 %land.ext
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @is_contain(i64 %this.coerce, i64 %box.coerce) local_unnamed_addr #4 {
entry:
%this.sroa.0.0.extract.trunc = trunc i64 %this.coerce to i32
%this.sroa.2.0.extract.shift = lshr i64 %this.coerce, 32
%this.sroa.2.0.extract.trunc = trunc i64 %this.sroa.2.0.extract.shift to i32
%box.sroa.0.0.extract.trunc = trunc i64 %box.coerce to i32
%box.sroa.2.0.extract.shift = lshr i64 %box.coerce, 32
%box.sroa.2.0.extract.trunc = trunc i64 %box.sroa.2.0.extract.shift to i32
%cmp = icmp sle i32 %box.sroa.0.0.extract.trunc, %this.sroa.0.0.extract.trunc
%cmp3 = icmp sle i32 %this.sroa.2.0.extract.trunc, %box.sroa.2.0.extract.trunc
%0 = select i1 %cmp, i1 %cmp3, i1 false
%land.ext = zext i1 %0 to i32
ret i32 %land.ext
}
; Function Attrs: nofree nosync nounwind memory(argmem: write) uwtable
define dso_local void @update(ptr nocapture noundef writeonly %seg, i64 %r.coerce, i32 noundef %val, i32 noundef %node, i64 %nr.coerce) local_unnamed_addr #11 {
entry:
%r1.sroa.0.0.extract.trunc.i = trunc i64 %r.coerce to i32
%r1.sroa.2.0.extract.shift.i = lshr i64 %r.coerce, 32
%r1.sroa.2.0.extract.trunc.i = trunc i64 %r1.sroa.2.0.extract.shift.i to i32
%nr.sroa.0.0.extract.trunc45 = trunc i64 %nr.coerce to i32
%nr.sroa.6.0.extract.shift46 = lshr i64 %nr.coerce, 32
%nr.sroa.6.0.extract.trunc47 = trunc i64 %nr.sroa.6.0.extract.shift46 to i32
%cmp.i50 = icmp sle i32 %r1.sroa.2.0.extract.trunc.i, %nr.sroa.0.0.extract.trunc45
%cmp3.i51 = icmp sle i32 %nr.sroa.6.0.extract.trunc47, %r1.sroa.0.0.extract.trunc.i
%.not52 = or i1 %cmp.i50, %cmp3.i51
br i1 %.not52, label %return, label %if.end
if.end: ; preds = %entry, %if.end4
%nr.sroa.0.0.insert.ext57.in = phi i64 [ %right.sroa.0.0.insert.insert, %if.end4 ], [ %nr.coerce, %entry ]
%nr.sroa.6.0.extract.trunc55 = phi i32 [ %nr.sroa.6.0.extract.trunc, %if.end4 ], [ %nr.sroa.6.0.extract.trunc47, %entry ]
%nr.sroa.0.0.extract.trunc54 = phi i32 [ %div, %if.end4 ], [ %nr.sroa.0.0.extract.trunc45, %entry ]
%node.tr53 = phi i32 [ %add16, %if.end4 ], [ %node, %entry ]
%cmp.i40 = icmp slt i32 %nr.sroa.0.0.extract.trunc54, %r1.sroa.0.0.extract.trunc.i
%cmp3.i41 = icmp sgt i32 %nr.sroa.6.0.extract.trunc55, %r1.sroa.2.0.extract.trunc.i
%.not43 = or i1 %cmp.i40, %cmp3.i41
br i1 %.not43, label %if.end4, label %if.then3
if.then3: ; preds = %if.end
%idxprom = sext i32 %node.tr53 to i64
%arrayidx = getelementptr inbounds i32, ptr %seg, i64 %idxprom
store i32 %val, ptr %arrayidx, align 4, !tbaa !5
br label %return
if.end4: ; preds = %if.end
%nr.sroa.6.0.insert.shift56 = and i64 %nr.sroa.0.0.insert.ext57.in, -4294967296
%nr.sroa.0.0.insert.ext57 = and i64 %nr.sroa.0.0.insert.ext57.in, 4294967295
%add = add nsw i32 %nr.sroa.6.0.extract.trunc55, %nr.sroa.0.0.extract.trunc54
%div = sdiv i32 %add, 2
%mul = shl nsw i32 %node.tr53, 1
%left.sroa.4.0.insert.ext = zext i32 %div to i64
%left.sroa.4.0.insert.shift = shl nuw i64 %left.sroa.4.0.insert.ext, 32
%left.sroa.0.0.insert.insert = or i64 %left.sroa.4.0.insert.shift, %nr.sroa.0.0.insert.ext57
tail call void @update(ptr noundef %seg, i64 %r.coerce, i32 noundef %val, i32 noundef %mul, i64 %left.sroa.0.0.insert.insert)
%add16 = or i32 %mul, 1
%right.sroa.0.0.insert.insert = or i64 %nr.sroa.6.0.insert.shift56, %left.sroa.4.0.insert.ext
%nr.sroa.6.0.extract.shift = lshr i64 %nr.sroa.0.0.insert.ext57.in, 32
%nr.sroa.6.0.extract.trunc = trunc i64 %nr.sroa.6.0.extract.shift to i32
%cmp.i = icmp sge i32 %div, %r1.sroa.2.0.extract.trunc.i
%cmp3.i = icmp sle i32 %nr.sroa.6.0.extract.trunc, %r1.sroa.0.0.extract.trunc.i
%.not = or i1 %cmp.i, %cmp3.i
br i1 %.not, label %return, label %if.end
return: ; preds = %if.end4, %entry, %if.then3
ret void
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @get_val(ptr nocapture noundef readonly %seg, i32 noundef %size2, i32 noundef %idx) local_unnamed_addr #12 {
entry:
%add = add nsw i32 %idx, %size2
%tobool.not9 = icmp eq i32 %add, 0
br i1 %tobool.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%ans.011 = phi i32 [ %ans.0., %while.body ], [ 2139062143, %entry ]
%node.010 = phi i32 [ %div, %while.body ], [ %add, %entry ]
%idxprom = sext i32 %node.010 to i64
%arrayidx = getelementptr inbounds i32, ptr %seg, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%ans.0. = tail call i32 @llvm.smin.i32(i32 %0, i32 %ans.011)
%div = sdiv i32 %node.010, 2
%node.010.off = add i32 %node.010, 1
%tobool.not = icmp ult i32 %node.010.off, 3
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !45
while.end: ; preds = %while.body, %entry
%ans.0.lcssa = phi i32 [ 2139062143, %entry ], [ %ans.0., %while.body ]
ret i32 %ans.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num.i = alloca i32, align 4
%num = alloca i32, align 4
%qs = alloca i32, align 4
%start = alloca i32, align 4
%end = alloca i32, align 4
%pos = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %qs) #15
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num, ptr noundef nonnull %qs)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp105 = icmp sgt i32 %0, 0
br i1 %cmp105, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %start) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %end) #15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %pos) #15
%call.i96 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %start, ptr noundef nonnull %end, ptr noundef nonnull %pos)
%arrayidx = getelementptr inbounds [200000 x %struct.work], ptr @main.works, i64 0, i64 %indvars.iv
%1 = load i32, ptr %start, align 4
%2 = load i32, ptr %pos, align 4
%sub = sub nsw i32 %1, %2
%cond = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%3 = load i32, ptr %end, align 4
%sub6 = sub nsw i32 %3, %2
%cond12 = call i32 @llvm.smax.i32(i32 %sub6, i32 0)
store i32 %cond, ptr %arrayidx, align 4, !tbaa.struct !46
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 4
store i32 %cond12, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !42
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
store i32 %2, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx, align 4, !tbaa.struct !43
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %pos) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %end) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %start) #15
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %num, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !47
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %4, %for.body ]
%call14 = call i32 @compress(ptr noundef nonnull @main.works, i32 noundef %.lcssa, ptr noundef nonnull @main.unzip)
%call14.fr = freeze i32 %call14
br label %while.cond
while.cond: ; preds = %while.cond, %for.end
%size2.0 = phi i32 [ 1, %for.end ], [ %mul, %while.cond ]
%cmp15 = icmp sgt i32 %call14.fr, %size2.0
%mul = shl nsw i32 %size2.0, 1
br i1 %cmp15, label %while.cond, label %while.end, !llvm.loop !48
while.end: ; preds = %while.cond
%6 = load i32, ptr %num, align 4, !tbaa !5
%conv = sext i32 %6 to i64
call void @qsort(ptr noundef nonnull @main.works, i64 noundef %conv, i64 noundef 12, ptr noundef nonnull @desc_by_pos) #15
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4194304) @main.seg, i8 127, i64 4194304, i1 false)
%7 = load i32, ptr %num, align 4, !tbaa !5
%cmp19107 = icmp sgt i32 %7, 0
br i1 %cmp19107, label %for.body21.lr.ph, label %for.cond33.preheader
for.body21.lr.ph: ; preds = %while.end
%whole.sroa.4.0.insert.ext = zext i32 %size2.0 to i64
%whole.sroa.4.0.insert.shift = shl nuw nsw i64 %whole.sroa.4.0.insert.ext, 32
%wide.trip.count = zext i32 %7 to i64
br label %for.body21
for.cond33.preheader: ; preds = %cleanup, %while.end
%8 = load i32, ptr %qs, align 4, !tbaa !5
%cmp34109 = icmp sgt i32 %8, 0
br i1 %cmp34109, label %for.body36.lr.ph, label %for.end70
for.body36.lr.ph: ; preds = %for.cond33.preheader
%cmp8.i = icmp sgt i32 %call14.fr, 0
br i1 %cmp8.i, label %for.body36.us, label %for.body36
for.body36.us: ; preds = %for.body36.lr.ph, %if.end49.us
%indvars.iv125 = phi i64 [ %indvars.iv.next126, %if.end49.us ], [ 0, %for.body36.lr.ph ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num.i) #15
%call.i97.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num.i)
%9 = load i32, ptr %num.i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num.i) #15
br label %while.body.i.us
while.body.i.us: ; preds = %for.body36.us, %while.body.i.us
%low.010.i.us = phi i32 [ %low.0.div.i.us, %while.body.i.us ], [ -1, %for.body36.us ]
%high.09.i.us = phi i32 [ %div.high.0.i.us, %while.body.i.us ], [ %call14.fr, %for.body36.us ]
%add1.i.us = add nsw i32 %high.09.i.us, %low.010.i.us
%div.i.us = sdiv i32 %add1.i.us, 2
%idxprom.i.us = sext i32 %div.i.us to i64
%arrayidx.i.us = getelementptr inbounds i32, ptr @main.unzip, i64 %idxprom.i.us
%10 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%cmp2.not.i.us = icmp sgt i32 %10, %9
%div.high.0.i.us = select i1 %cmp2.not.i.us, i32 %div.i.us, i32 %high.09.i.us
%low.0.div.i.us = select i1 %cmp2.not.i.us, i32 %low.010.i.us, i32 %div.i.us
%add.i.us = add nsw i32 %low.0.div.i.us, 1
%cmp.i.us = icmp slt i32 %add.i.us, %div.high.0.i.us
br i1 %cmp.i.us, label %while.body.i.us, label %upper_bound.exit.us, !llvm.loop !20
upper_bound.exit.us: ; preds = %while.body.i.us
%cmp39.us = icmp eq i32 %low.0.div.i.us, -1
%add.i98.us = add nsw i32 %low.0.div.i.us, %size2.0
%tobool.not9.i.us = icmp eq i32 %add.i98.us, 0
%or.cond = select i1 %cmp39.us, i1 true, i1 %tobool.not9.i.us
br i1 %or.cond, label %if.end49.us, label %while.body.i99.us
while.body.i99.us: ; preds = %upper_bound.exit.us, %while.body.i99.us
%ans.011.i.us = phi i32 [ %ans.0..i.us, %while.body.i99.us ], [ 2139062143, %upper_bound.exit.us ]
%node.010.i.us = phi i32 [ %div.i102.us, %while.body.i99.us ], [ %add.i98.us, %upper_bound.exit.us ]
%idxprom.i100.us = sext i32 %node.010.i.us to i64
%arrayidx.i101.us = getelementptr inbounds i32, ptr @main.seg, i64 %idxprom.i100.us
%11 = load i32, ptr %arrayidx.i101.us, align 4, !tbaa !5
%ans.0..i.us = call i32 @llvm.smin.i32(i32 %11, i32 %ans.011.i.us)
%div.i102.us = sdiv i32 %node.010.i.us, 2
%node.010.off.i.us = add i32 %node.010.i.us, 1
%tobool.not.i.us = icmp ult i32 %node.010.off.i.us, 3
br i1 %tobool.not.i.us, label %if.end49.us, label %while.body.i99.us, !llvm.loop !45
if.end49.us: ; preds = %while.body.i99.us, %upper_bound.exit.us
%.sink = phi i32 [ 2139062143, %upper_bound.exit.us ], [ %ans.0..i.us, %while.body.i99.us ]
%arrayidx44.us = getelementptr inbounds [200000 x i32], ptr @main.ans, i64 0, i64 %indvars.iv125
store i32 %.sink, ptr %arrayidx44.us, align 4, !tbaa !5
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%indvars127 = trunc i64 %indvars.iv.next126 to i32
%12 = load i32, ptr %qs, align 4, !tbaa !5
%cmp34.us = icmp sgt i32 %12, %indvars127
br i1 %cmp34.us, label %for.body36.us, label %for.cond53.preheader, !llvm.loop !49
for.body21: ; preds = %for.body21.lr.ph, %cleanup
%indvars.iv117 = phi i64 [ 0, %for.body21.lr.ph ], [ %indvars.iv.next118, %cleanup ]
%arrayidx23 = getelementptr inbounds [200000 x %struct.work], ptr @main.works, i64 0, i64 %indvars.iv117
%w.sroa.0.0.copyload = load i64, ptr %arrayidx23, align 4, !tbaa.struct !46
%cmp26 = icmp ult i64 %w.sroa.0.0.copyload, 4294967296
br i1 %cmp26, label %cleanup, label %if.end
if.end: ; preds = %for.body21
%w.sroa.5.0.arrayidx23.sroa_idx = getelementptr inbounds i8, ptr %arrayidx23, i64 8
%w.sroa.5.0.copyload = load i32, ptr %w.sroa.5.0.arrayidx23.sroa_idx, align 4, !tbaa.struct !43
call void @update(ptr noundef nonnull @main.seg, i64 %w.sroa.0.0.copyload, i32 noundef %w.sroa.5.0.copyload, i32 noundef 1, i64 %whole.sroa.4.0.insert.shift)
br label %cleanup
cleanup: ; preds = %for.body21, %if.end
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%exitcond.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count
br i1 %exitcond.not, label %for.cond33.preheader, label %for.body21, !llvm.loop !50
for.cond53.preheader: ; preds = %for.body36, %if.end49.us
%13 = phi i32 [ %12, %if.end49.us ], [ %14, %for.body36 ]
%cmp54112 = icmp sgt i32 %13, 0
br i1 %cmp54112, label %for.body56, label %for.end70
for.body36: ; preds = %for.body36.lr.ph, %for.body36
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.body36 ], [ 0, %for.body36.lr.ph ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num.i) #15
%call.i97 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num.i) #15
%arrayidx44 = getelementptr inbounds [200000 x i32], ptr @main.ans, i64 0, i64 %indvars.iv120
store i32 2139062143, ptr %arrayidx44, align 4, !tbaa !5
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%indvars = trunc i64 %indvars.iv.next121 to i32
%14 = load i32, ptr %qs, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %14, %indvars
br i1 %cmp34, label %for.body36, label %for.cond53.preheader, !llvm.loop !49
for.body56: ; preds = %for.cond53.preheader, %for.body56
%indvars.iv131 = phi i64 [ %indvars.iv.next132, %for.body56 ], [ 0, %for.cond53.preheader ]
%arrayidx58 = getelementptr inbounds [200000 x i32], ptr @main.ans, i64 0, i64 %indvars.iv131
%15 = load i32, ptr %arrayidx58, align 4, !tbaa !5
%cmp59 = icmp eq i32 %15, 2139062143
%spec.select = select i1 %cmp59, i32 -1, i32 %15
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %spec.select)
%indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
%16 = load i32, ptr %qs, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp54 = icmp slt i64 %indvars.iv.next132, %17
br i1 %cmp54, label %for.body56, label %for.end70, !llvm.loop !51
for.end70: ; preds = %for.body56, %for.cond33.preheader, %for.cond53.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %qs) #15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #15
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #13
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #14
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 #5 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 #9 = { 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 #10 = { 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 #11 = { nofree nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { 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 #13 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #14 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #15 = { nounwind }
attributes #16 = { 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, !11, i64 8}
!10 = !{!"list", !6, i64 0, !6, i64 4, !11, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 0}
!15 = !{!10, !6, i64 4}
!16 = distinct !{!16, !13}
!17 = !{!18, !6, i64 8}
!18 = !{!"work", !19, i64 0, !6, i64 8}
!19 = !{!"range", !6, i64 0, !6, i64 4}
!20 = distinct !{!20, !13}
!21 = !{!18, !6, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.unroll.disable"}
!24 = !{!25}
!25 = distinct !{!25, !26}
!26 = distinct !{!26, !"LVerDomain"}
!27 = !{!28}
!28 = distinct !{!28, !26}
!29 = distinct !{!29, !13, !30, !31}
!30 = !{!"llvm.loop.isvectorized", i32 1}
!31 = !{!"llvm.loop.unroll.runtime.disable"}
!32 = !{!18, !6, i64 4}
!33 = !{!34}
!34 = distinct !{!34, !35}
!35 = distinct !{!35, !"LVerDomain"}
!36 = !{!37}
!37 = distinct !{!37, !35}
!38 = distinct !{!38, !13, !30, !31}
!39 = distinct !{!39, !13, !30}
!40 = distinct !{!40, !13, !30}
!41 = distinct !{!41, !13}
!42 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!43 = !{i64 0, i64 4, !5}
!44 = distinct !{!44, !13}
!45 = distinct !{!45, !13}
!46 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!47 = distinct !{!47, !13}
!48 = distinct !{!48, !13}
!49 = distinct !{!49, !13}
!50 = distinct !{!50, !13}
!51 = distinct !{!51, !13}
|
#include<stdio.h>
#include<string.h>
int cmp(char s[100001],char t[100001],int st,int fin)
{
if(strlen(t)>(fin-st+1))
{
return 0;
}
int j=0;
for(int i=st;i<=fin;i++)
{
if(s[i] != t[j])
{
break;
}
j++;
}
if(j==(fin-st+1))
{
return 1;
}
else
{
return 0;
}
}
int main(void)
{
int point=0,judge=0;
char s[100001],t[100001];
fgets(s,sizeof(s),stdin);
int len = strlen(s) - 1;
while(point<len-4)
{
if(cmp(s,"dream",point,point+4))
{
judge = 1;
point = point + 5;
if(s[point] == 'e'&&s[point+1] == 'r'&&cmp(s,"erase",point,point+4)==0)
{
point = point+2;
}
}
if(cmp(s,"erase",point,point+4))
{
judge = 1;
point = point + 5;
if(s[point] == 'r')
{
point++;
}
}
if(judge==0)
{
printf("NO");
return 0;
}
else
{
judge = 0;
}
}
if(point==len)
printf("YES");
else
{
printf("NO");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150425/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150425/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %s, ptr nocapture noundef readonly %t, i32 noundef %st, i32 noundef %fin) local_unnamed_addr #0 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %t) #5
%sub = sub nsw i32 %fin, %st
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%cmp = icmp ugt i64 %call, %conv
br i1 %cmp, label %return, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp2.not28 = icmp sgt i32 %st, %fin
br i1 %cmp2.not28, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%0 = sext i32 %st to i64
%wide.trip.count = zext i32 %add to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %if.end11
%indvars.iv32 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next33, %if.end11 ]
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %if.end11 ]
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
%arrayidx6 = getelementptr inbounds i8, ptr %t, i64 %indvars.iv32
%2 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp8.not = icmp eq i8 %1, %2
br i1 %cmp8.not, label %if.end11, label %cleanup.loopexit.split.loop.exit
if.end11: ; preds = %for.body
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next33, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !8
cleanup.loopexit.split.loop.exit: ; preds = %for.body
%3 = trunc i64 %indvars.iv32 to i32
br label %cleanup
cleanup: ; preds = %if.end11, %cleanup.loopexit.split.loop.exit, %for.cond.preheader
%j.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %3, %cleanup.loopexit.split.loop.exit ], [ %add, %if.end11 ]
%cmp15 = icmp eq i32 %j.0.lcssa, %add
%. = zext i1 %cmp15 to i32
br label %return
return: ; preds = %entry, %cleanup
%retval.1 = phi i32 [ %., %cleanup ], [ 0, %entry ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%s = alloca [100001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #6
%0 = load ptr, ptr @stdin, align 8, !tbaa !10
%call = call ptr @fgets(ptr noundef nonnull %s, i32 noundef 100001, ptr noundef %0)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%1 = trunc i64 %call2 to i32
%conv = add i32 %1, -1
%sub3 = add i32 %1, -5
%invariant.gep = getelementptr inbounds i8, ptr %s, i64 1
%invariant.gep147 = getelementptr inbounds i8, ptr %s, i64 2
%invariant.gep149 = getelementptr inbounds i8, ptr %s, i64 3
%invariant.gep151 = getelementptr inbounds i8, ptr %s, i64 4
%invariant.gep153 = getelementptr inbounds i8, ptr %s, i64 2
%invariant.gep155 = getelementptr inbounds i8, ptr %s, i64 3
%invariant.gep157 = getelementptr inbounds i8, ptr %s, i64 4
%invariant.gep159 = getelementptr inbounds i8, ptr %s, i64 1
%invariant.gep161 = getelementptr inbounds i8, ptr %s, i64 2
%invariant.gep163 = getelementptr inbounds i8, ptr %s, i64 3
%invariant.gep165 = getelementptr inbounds i8, ptr %s, i64 4
br label %while.cond
while.cond: ; preds = %if.end39, %entry
%point.0 = phi i32 [ 0, %entry ], [ %point.2, %if.end39 ]
%cmp = icmp slt i32 %point.0, %sub3
br i1 %cmp, label %for.cond.preheader.i, label %while.end
for.cond.preheader.i: ; preds = %while.cond
%2 = sext i32 %point.0 to i64
%arrayidx.i = getelementptr inbounds i8, ptr %s, i64 %2
%3 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp8.not.i = icmp eq i8 %3, 100
br i1 %cmp8.not.i, label %if.end11.i, label %for.cond.preheader.i94
if.end11.i: ; preds = %for.cond.preheader.i
%gep = getelementptr i8, ptr %invariant.gep, i64 %2
%4 = load i8, ptr %gep, align 1, !tbaa !5
%cmp8.not.i.1 = icmp eq i8 %4, 114
br i1 %cmp8.not.i.1, label %if.end11.i.1, label %for.cond.preheader.i94
if.end11.i.1: ; preds = %if.end11.i
%gep148 = getelementptr i8, ptr %invariant.gep147, i64 %2
%5 = load i8, ptr %gep148, align 1, !tbaa !5
%cmp8.not.i.2 = icmp eq i8 %5, 101
br i1 %cmp8.not.i.2, label %if.end11.i.2, label %for.cond.preheader.i94
if.end11.i.2: ; preds = %if.end11.i.1
%gep150 = getelementptr i8, ptr %invariant.gep149, i64 %2
%6 = load i8, ptr %gep150, align 1, !tbaa !5
%cmp8.not.i.3 = icmp eq i8 %6, 97
br i1 %cmp8.not.i.3, label %if.end11.i.3, label %for.cond.preheader.i94
if.end11.i.3: ; preds = %if.end11.i.2
%gep152 = getelementptr i8, ptr %invariant.gep151, i64 %2
%7 = load i8, ptr %gep152, align 1, !tbaa !5
%cmp8.not.i.4 = icmp eq i8 %7, 109
br i1 %cmp8.not.i.4, label %if.then, label %for.cond.preheader.i94
if.then: ; preds = %if.end11.i.3
%add7 = add nsw i32 %point.0, 5
%idxprom = sext i32 %add7 to i64
%arrayidx = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom
%8 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp9 = icmp eq i8 %8, 101
br i1 %cmp9, label %land.lhs.true, label %for.cond.preheader.i94
land.lhs.true: ; preds = %if.then
%add11 = add nsw i32 %point.0, 6
%idxprom12 = sext i32 %add11 to i64
%arrayidx13 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom12
%9 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%cmp15 = icmp eq i8 %9, 114
br i1 %cmp15, label %if.end11.i87.1, label %for.cond.preheader.i94
if.end11.i87.1: ; preds = %land.lhs.true
%gep154 = getelementptr i8, ptr %invariant.gep153, i64 %idxprom
%10 = load i8, ptr %gep154, align 1, !tbaa !5
%cmp8.not.i80.2 = icmp eq i8 %10, 97
br i1 %cmp8.not.i80.2, label %if.end11.i87.2, label %cmp.exit91
if.end11.i87.2: ; preds = %if.end11.i87.1
%gep156 = getelementptr i8, ptr %invariant.gep155, i64 %idxprom
%11 = load i8, ptr %gep156, align 1, !tbaa !5
%cmp8.not.i80.3 = icmp eq i8 %11, 115
br i1 %cmp8.not.i80.3, label %if.end11.i87.3, label %cmp.exit91
if.end11.i87.3: ; preds = %if.end11.i87.2
%gep158 = getelementptr i8, ptr %invariant.gep157, i64 %idxprom
%12 = load i8, ptr %gep158, align 1, !tbaa !5
%cmp8.not.i80.4 = icmp eq i8 %12, 101
br i1 %cmp8.not.i80.4, label %for.cond.preheader.i94, label %cmp.exit91
cmp.exit91: ; preds = %if.end11.i87.3, %if.end11.i87.2, %if.end11.i87.1
%add24 = add nsw i32 %point.0, 7
%.pre = sext i32 %add24 to i64
br label %for.cond.preheader.i94
for.cond.preheader.i94: ; preds = %if.end11.i87.3, %for.cond.preheader.i, %if.end11.i, %if.end11.i.1, %if.end11.i.2, %if.end11.i.3, %cmp.exit91, %land.lhs.true, %if.then
%.pre-phi = phi i64 [ %.pre, %cmp.exit91 ], [ %idxprom, %land.lhs.true ], [ %idxprom, %if.then ], [ %2, %if.end11.i.3 ], [ %2, %if.end11.i.2 ], [ %2, %if.end11.i.1 ], [ %2, %if.end11.i ], [ %2, %for.cond.preheader.i ], [ %idxprom, %if.end11.i87.3 ]
%judge.1 = phi i32 [ 1, %cmp.exit91 ], [ 1, %land.lhs.true ], [ 1, %if.then ], [ 0, %if.end11.i.3 ], [ 0, %if.end11.i.2 ], [ 0, %if.end11.i.1 ], [ 0, %if.end11.i ], [ 0, %for.cond.preheader.i ], [ 1, %if.end11.i87.3 ]
%point.1 = phi i32 [ %add24, %cmp.exit91 ], [ %add7, %land.lhs.true ], [ %add7, %if.then ], [ %point.0, %if.end11.i.3 ], [ %point.0, %if.end11.i.2 ], [ %point.0, %if.end11.i.1 ], [ %point.0, %if.end11.i ], [ %point.0, %for.cond.preheader.i ], [ %add7, %if.end11.i87.3 ]
%arrayidx.i98 = getelementptr inbounds i8, ptr %s, i64 %.pre-phi
%13 = load i8, ptr %arrayidx.i98, align 1, !tbaa !5
%cmp8.not.i100 = icmp eq i8 %13, 101
br i1 %cmp8.not.i100, label %if.end11.i107, label %if.end39
if.end11.i107: ; preds = %for.cond.preheader.i94
%gep160 = getelementptr i8, ptr %invariant.gep159, i64 %.pre-phi
%14 = load i8, ptr %gep160, align 1, !tbaa !5
%cmp8.not.i100.1 = icmp eq i8 %14, 114
br i1 %cmp8.not.i100.1, label %if.end11.i107.1, label %if.end39
if.end11.i107.1: ; preds = %if.end11.i107
%gep162 = getelementptr i8, ptr %invariant.gep161, i64 %.pre-phi
%15 = load i8, ptr %gep162, align 1, !tbaa !5
%cmp8.not.i100.2 = icmp eq i8 %15, 97
br i1 %cmp8.not.i100.2, label %if.end11.i107.2, label %if.end39
if.end11.i107.2: ; preds = %if.end11.i107.1
%gep164 = getelementptr i8, ptr %invariant.gep163, i64 %.pre-phi
%16 = load i8, ptr %gep164, align 1, !tbaa !5
%cmp8.not.i100.3 = icmp eq i8 %16, 115
br i1 %cmp8.not.i100.3, label %if.end11.i107.3, label %if.end39
if.end11.i107.3: ; preds = %if.end11.i107.2
%gep166 = getelementptr i8, ptr %invariant.gep165, i64 %.pre-phi
%17 = load i8, ptr %gep166, align 1, !tbaa !5
%cmp8.not.i100.4 = icmp eq i8 %17, 101
br i1 %cmp8.not.i100.4, label %if.then30, label %if.end39
if.then30: ; preds = %if.end11.i107.3
%add31 = add nsw i32 %point.1, 5
%idxprom32 = sext i32 %add31 to i64
%arrayidx33 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom32
%18 = load i8, ptr %arrayidx33, align 1, !tbaa !5
%cmp35 = icmp eq i8 %18, 114
%inc = add nsw i32 %point.1, 6
%spec.select71 = select i1 %cmp35, i32 %inc, i32 %add31
br label %if.end39
if.end39: ; preds = %for.cond.preheader.i94, %if.end11.i107, %if.end11.i107.1, %if.end11.i107.2, %if.end11.i107.3, %if.then30
%judge.2 = phi i32 [ 1, %if.then30 ], [ %judge.1, %if.end11.i107.3 ], [ %judge.1, %if.end11.i107.2 ], [ %judge.1, %if.end11.i107.1 ], [ %judge.1, %if.end11.i107 ], [ %judge.1, %for.cond.preheader.i94 ]
%point.2 = phi i32 [ %spec.select71, %if.then30 ], [ %point.1, %if.end11.i107.3 ], [ %point.1, %if.end11.i107.2 ], [ %point.1, %if.end11.i107.1 ], [ %point.1, %if.end11.i107 ], [ %point.1, %for.cond.preheader.i94 ]
%cmp40 = icmp eq i32 %judge.2, 0
br i1 %cmp40, label %cleanup, label %while.cond, !llvm.loop !12
while.end: ; preds = %while.cond
%cmp45 = icmp eq i32 %point.0, %conv
%.str.3..str.2 = select i1 %cmp45, ptr @.str.3, ptr @.str.2
br label %cleanup
cleanup: ; preds = %if.end39, %while.end
%.str.3.sink = phi ptr [ %.str.3..str.2, %while.end ], [ @.str.2, %if.end39 ]
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind willreturn memory(read) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = distinct !{!12, !9}
|
#include <stdio.h>
#include <string.h>
int main(){
char s,t[5];
t[4] = '\0';
int flag = 0;
int flag2 = 0;//dream**=1, erase*2, dreamer3
int ret,ret2;
while(1){
ret = scanf("%c",&s);
if(ret == EOF || s == '\n') break;
if(s == 'd'){
ret2 = scanf("%c%c%c%c",&t[0],&t[1],&t[2],&t[3]);
if(ret2 == EOF || strcmp(t,"ream") != 0) flag = 1;
flag2 = 1;
}else if(s == 'e'){
if(flag2 == 0 || flag2 == 3 || flag2 == 2){
ret2 = scanf("%c%c%c%c",&t[0],&t[1],&t[2],&t[3]);
if(ret2 == EOF || strcmp(t,"rase") != 0) flag = 1;
flag2 = 2;
}else if(flag2 == 1){//(~dream)e
ret2 = scanf("%c",&t[0]);
if(ret2 == EOF || t[0] != 'r') flag = 1;
else flag2 = 3;// -> (~dreamer)(~) or (~dreamer)ase(r)(~)
}else flag = 1;
}else if(flag2 == 2 && s == 'r') flag2 = 0;
else if(flag2 == 3 && s == 'a'){
ret2 = scanf("%c%c",&t[0],&t[1]);
if(ret2 == EOF || t[0] != 's' || t[1] != 'e') flag = 1;
else flag2 = 2;
}
else flag = 1;
if(flag == 1) break;
}
if(flag == 0) printf("YES\n");
else printf("NO\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150469/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150469/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%c\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%c%c%c%c\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"ream\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"rase\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.7 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i8, align 1
%t = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %t) #5
%arrayidx = getelementptr inbounds [5 x i8], ptr %t, i64 0, i64 4
store i8 0, ptr %arrayidx, align 1, !tbaa !5
%call140 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp141 = icmp eq i32 %call140, -1
%0 = load i8, ptr %s, align 1
%cmp1142 = icmp eq i8 %0, 10
%or.cond143 = select i1 %cmp141, i1 true, i1 %cmp1142
br i1 %or.cond143, label %if.end114, label %if.end.lr.ph
if.end.lr.ph: ; preds = %entry
%arrayidx34 = getelementptr inbounds [5 x i8], ptr %t, i64 0, i64 1
%arrayidx35 = getelementptr inbounds [5 x i8], ptr %t, i64 0, i64 2
%arrayidx36 = getelementptr inbounds [5 x i8], ptr %t, i64 0, i64 3
br label %if.end
if.end: ; preds = %if.end.lr.ph, %if.end103
%1 = phi i8 [ %0, %if.end.lr.ph ], [ %5, %if.end103 ]
%flag2.0144 = phi i32 [ 0, %if.end.lr.ph ], [ %flag2.1, %if.end103 ]
switch i8 %1, label %if.else66 [
i8 100, label %if.then6
i8 101, label %if.then23
]
if.then6: ; preds = %if.end
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %arrayidx34, ptr noundef nonnull %arrayidx35, ptr noundef nonnull %arrayidx36)
%cmp12 = icmp eq i32 %call11, -1
br i1 %cmp12, label %if.end114, label %lor.lhs.false14
lor.lhs.false14: ; preds = %if.then6
%bcmp131 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %t, ptr noundef nonnull dereferenceable(5) @.str.2, i64 5)
%cmp16.not = icmp eq i32 %bcmp131, 0
br i1 %cmp16.not, label %if.end103, label %if.end114
if.then23: ; preds = %if.end
switch i32 %flag2.0144, label %if.end114 [
i32 3, label %if.then32
i32 2, label %if.then32
i32 0, label %if.then32
i32 1, label %if.then50
]
if.then32: ; preds = %if.then23, %if.then23, %if.then23
%call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %arrayidx34, ptr noundef nonnull %arrayidx35, ptr noundef nonnull %arrayidx36)
%cmp38 = icmp eq i32 %call37, -1
br i1 %cmp38, label %if.end114, label %lor.lhs.false40
lor.lhs.false40: ; preds = %if.then32
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %t, ptr noundef nonnull dereferenceable(5) @.str.3, i64 5)
%cmp43.not = icmp eq i32 %bcmp, 0
br i1 %cmp43.not, label %if.end103, label %if.end114
if.then50: ; preds = %if.then23
%call52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%cmp53 = icmp eq i32 %call52, -1
%2 = load i8, ptr %t, align 1
%cmp58 = icmp ne i8 %2, 114
%or.cond117 = select i1 %cmp53, i1 true, i1 %cmp58
br i1 %or.cond117, label %if.end114, label %if.end103
if.else66: ; preds = %if.end
%cmp67 = icmp eq i32 %flag2.0144, 2
%cmp70 = icmp eq i8 %1, 114
%or.cond118 = and i1 %cmp67, %cmp70
br i1 %or.cond118, label %if.end103, label %if.else73
if.else73: ; preds = %if.else66
%cmp74 = icmp eq i32 %flag2.0144, 3
%cmp78 = icmp eq i8 %1, 97
%or.cond119 = and i1 %cmp74, %cmp78
br i1 %or.cond119, label %if.then80, label %if.end114
if.then80: ; preds = %if.else73
%call83 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %t, ptr noundef nonnull %arrayidx34)
%cmp84 = icmp eq i32 %call83, -1
%3 = load i8, ptr %t, align 1
%cmp89 = icmp ne i8 %3, 115
%or.cond120 = select i1 %cmp84, i1 true, i1 %cmp89
%4 = load i8, ptr %arrayidx34, align 1
%cmp94 = icmp ne i8 %4, 101
%or.cond121 = select i1 %or.cond120, i1 true, i1 %cmp94
br i1 %or.cond121, label %if.end114, label %if.end103
if.end103: ; preds = %if.then80, %if.then50, %if.else66, %lor.lhs.false40, %lor.lhs.false14
%flag2.1 = phi i32 [ 1, %lor.lhs.false14 ], [ 2, %lor.lhs.false40 ], [ 3, %if.then50 ], [ 0, %if.else66 ], [ 2, %if.then80 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp = icmp eq i32 %call, -1
%5 = load i8, ptr %s, align 1
%cmp1 = icmp eq i8 %5, 10
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
br i1 %or.cond, label %if.end114, label %if.end
if.end114: ; preds = %if.then23, %if.else73, %lor.lhs.false14, %if.then6, %lor.lhs.false40, %if.then32, %if.then50, %if.then80, %if.end103, %entry
%str.sink = phi ptr [ @str.7, %entry ], [ @str.7, %if.end103 ], [ @str, %if.then80 ], [ @str, %if.then50 ], [ @str, %if.then32 ], [ @str, %lor.lhs.false40 ], [ @str, %if.then6 ], [ @str, %lor.lhs.false14 ], [ @str, %if.else73 ], [ @str, %if.then23 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main() {
// char *buf=(char*)malloc(sizeof(char) * 20000);
char buf[100100];
scanf("%[^\n]", buf);
char* cur = buf;
int length = strlen(buf);
char l1[] = "dream";
char l2[] = "dreamer";
char l3[] = "erase";
char l4[] = "eraser";
int a1 = 5;
int a2 = 7;
int a3 = 5;
int a4 = 6;
while (length > 0) {
if (strstr(cur, l4) == cur) {
length -= a4;
if (length <= 0) {
break;
}
cur = cur + a4;
} else if (strstr(cur, l3) == cur) {
length -= a3;
if (length <= 0) {
break;
}
cur = cur + a3;
} else if (strstr(cur, "dreamerase") == cur) {
length -= a1;
if (length <= 0) {
break;
}
cur = cur + a1;
} else if (strstr(cur, l2) == cur) {
length -= a2;
if (length <= 0) {
break;
}
cur = cur + a2;
} else if (strstr(cur, l1) == cur) {
length -= a1;
if (length <= 0) {
break;
}
cur = cur + a1;
} else {
break;
}
}
if (length == 0) {
printf("YES\n");
} else {
printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150511/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150511/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%[^\0A]\00", align 1
@__const.main.l1 = private unnamed_addr constant [6 x i8] c"dream\00", align 1
@__const.main.l2 = private unnamed_addr constant [8 x i8] c"dreamer\00", align 1
@__const.main.l3 = private unnamed_addr constant [6 x i8] c"erase\00", align 1
@__const.main.l4 = private unnamed_addr constant [7 x i8] c"eraser\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"dreamerase\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:
%buf = alloca [100100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100100, ptr nonnull %buf) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %buf)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %buf) #7
%conv = trunc i64 %call3 to i32
%cmp118 = icmp sgt i32 %conv, 0
br i1 %cmp118, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end67
%cur.0120 = phi ptr [ %add.ptr23, %if.end67 ], [ %buf, %entry ]
%length.0119 = phi i32 [ %length.1, %if.end67 ], [ %conv, %entry ]
%strncmp = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %cur.0120, ptr noundef nonnull dereferenceable(7) @__const.main.l4, i64 6)
%cmp106 = icmp eq i32 %strncmp, 0
br i1 %cmp106, label %if.then, label %if.else
if.then: ; preds = %while.body
%sub = add nsw i32 %length.0119, -6
%cmp9 = icmp ult i32 %length.0119, 7
br i1 %cmp9, label %while.end, label %if.end67
if.else: ; preds = %while.body
%strncmp107 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %cur.0120, ptr noundef nonnull dereferenceable(6) @__const.main.l3, i64 5)
%cmp108 = icmp eq i32 %strncmp107, 0
br i1 %cmp108, label %if.then16, label %if.else24
if.then16: ; preds = %if.else
%sub17 = add nsw i32 %length.0119, -5
%cmp18 = icmp ult i32 %length.0119, 6
br i1 %cmp18, label %while.end, label %if.end67
if.else24: ; preds = %if.else
%strncmp109 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %cur.0120, ptr noundef nonnull dereferenceable(11) @.str.1, i64 10)
%cmp110 = icmp eq i32 %strncmp109, 0
br i1 %cmp110, label %if.then28, label %if.else36
if.then28: ; preds = %if.else24
%sub29 = add nsw i32 %length.0119, -5
%cmp30 = icmp ult i32 %length.0119, 6
br i1 %cmp30, label %while.end, label %if.end67
if.else36: ; preds = %if.else24
%strncmp111 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %cur.0120, ptr noundef nonnull dereferenceable(8) @__const.main.l2, i64 7)
%cmp112 = icmp eq i32 %strncmp111, 0
br i1 %cmp112, label %if.then41, label %if.else49
if.then41: ; preds = %if.else36
%sub42 = add nsw i32 %length.0119, -7
%cmp43 = icmp ult i32 %length.0119, 8
br i1 %cmp43, label %while.end, label %if.end67
if.else49: ; preds = %if.else36
%strncmp113 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %cur.0120, ptr noundef nonnull dereferenceable(6) @__const.main.l1, i64 5)
%cmp114 = icmp eq i32 %strncmp113, 0
br i1 %cmp114, label %if.then54, label %if.else72
if.then54: ; preds = %if.else49
%sub55 = add nsw i32 %length.0119, -5
%cmp56 = icmp ult i32 %length.0119, 6
br i1 %cmp56, label %while.end, label %if.end67
if.end67: ; preds = %if.then54, %if.then41, %if.then28, %if.then16, %if.then
%.sink = phi i64 [ 6, %if.then ], [ 5, %if.then16 ], [ 5, %if.then28 ], [ 7, %if.then41 ], [ 5, %if.then54 ]
%length.1 = phi i32 [ %sub, %if.then ], [ %sub17, %if.then16 ], [ %sub29, %if.then28 ], [ %sub42, %if.then41 ], [ %sub55, %if.then54 ]
%add.ptr23 = getelementptr inbounds i8, ptr %cur.0120, i64 %.sink
%cmp = icmp sgt i32 %length.1, 0
br i1 %cmp, label %while.body, label %if.else72, !llvm.loop !5
while.end: ; preds = %if.then, %if.then16, %if.then28, %if.then41, %if.then54, %entry
%length.2 = phi i32 [ %conv, %entry ], [ %sub55, %if.then54 ], [ %sub42, %if.then41 ], [ %sub29, %if.then28 ], [ %sub17, %if.then16 ], [ %sub, %if.then ]
%cmp68 = icmp eq i32 %length.2, 0
br i1 %cmp68, label %if.end74, label %if.else72
if.else72: ; preds = %if.end67, %if.else49, %while.end
br label %if.end74
if.end74: ; preds = %while.end, %if.else72
%str.sink = phi ptr [ @str, %if.else72 ], [ @str.4, %while.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 100100, ptr nonnull %buf) #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(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 willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
; 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(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 willreturn memory(argmem: read) }
attributes #5 = { nofree nounwind }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if((a+b)>c&& a<=c)
printf("YES");
else
printf("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150555/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150555/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%cmp = icmp sle i32 %add, %2
%cmp1.not = icmp sgt i32 %0, %2
%or.cond = or i1 %cmp, %cmp1.not
%.str.2..str.1 = select i1 %or.cond, ptr @.str.2, ptr @.str.1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int a, b, x;
scanf("%d %d %d", &a, &b, &x);
printf(x > a + b || a > x ? "NO\n" : "YES\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150599/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150599/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"NO\0A\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"YES\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4
%1 = load i32, ptr %a, align 4
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%cmp = icmp sgt i32 %0, %add
%cmp1 = icmp sgt i32 %1, %0
%3 = or i1 %cmp1, %cmp
%cond = select i1 %3, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{int a,b,x;
scanf("%d%d%d",&a,&b,&x);
if(a+b>=x&&a<=x)
printf("YES\n");
else
printf("NO\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150641/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150641/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %x, align 4, !tbaa !5
%cmp.not = icmp slt i32 %add, %2
%cmp1.not = icmp sgt i32 %0, %2
%or.cond = or i1 %cmp.not, %cmp1.not
%str.str.3 = select i1 %or.cond, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int a,b,x;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&x);
if(a<=x && a+b>x){
printf("YES");
}else{
printf("NO");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150685/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150685/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%b = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %entry
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %0
%cmp3 = icmp sgt i32 %add, %1
br i1 %cmp3, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %land.lhs.true ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a, b, x;
scanf("%d%d%d", &a, &b, &x);
if (a <= x && a + b >= x) printf ("YES");
else printf ("NO");
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150728/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150728/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %entry
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %0
%cmp1.not = icmp slt i32 %add, %1
br i1 %cmp1.not, label %if.else, label %if.end
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %land.lhs.true ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int a,b,x;
scanf("%d %d %d",&a,&b,&x);
if(x<=(a+b)&&a<=x){printf("YES\n");}
else {printf("NO\n");}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150779/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150779/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%cmp.not = icmp sgt i32 %0, %add
%cmp1.not = icmp sgt i32 %1, %0
%or.cond = or i1 %cmp1.not, %cmp.not
%str.str.3 = select i1 %or.cond, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int A, B, X;
scanf("%d %d %d", &A, &B, &X);
if(A<=X && X<=A+B) printf("YES\n");
else printf("NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150829/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150829/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %X)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %X, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %entry
%2 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %2, %0
%cmp1.not = icmp sgt i32 %1, %add
br i1 %cmp1.not, label %if.else, label %if.end
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %land.lhs.true ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int A, B, X;
scanf("%d %d %d", &A, &B, &X);
if (A <= X && X - A <= B) {
puts("YES");
} else {
puts("NO");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150872/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150872/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %X)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %X, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %entry
%sub = sub nsw i32 %1, %0
%2 = load i32, ptr %B, align 4, !tbaa !5
%cmp1.not = icmp sgt i32 %sub, %2
br i1 %cmp1.not, label %if.else, label %if.end
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %land.lhs.true ]
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a,b,c,d,e;
scanf("%d %d %d",&e,&a,&b);
if(a>=b){
c=b;
d=(a+b)-e;
}else{
c=a;
d=(a+b)-e;
}
if(d<=0){
d=0;
}
printf("%d %d\n",c,d);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150973/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150973/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%e = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %e, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add1 = add nsw i32 %1, %0
%2 = load i32, ptr %e, align 4, !tbaa !5
%sub2 = sub i32 %add1, %2
%. = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%spec.store.select = call i32 @llvm.smax.i32(i32 %sub2, i32 0)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %., i32 noundef %spec.store.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int n,a,b;
scanf("%d%d%d",&n,&a,&b);
printf("%d %d",a>b?b:a,n-a-b>0?0:a+b-n);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151015/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151015/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4
%1 = load i32, ptr %b, align 4
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = add i32 %1, %0
%sub1 = sub i32 %2, %3
%cmp2 = icmp sgt i32 %sub1, 0
%sub5 = sub nsw i32 %3, %2
%cond7 = select i1 %cmp2, i32 0, i32 %sub5
%cond = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond, i32 noundef %cond7)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
int main(){
char indata[1000000],load[10000];
int i,j,in,ln,state;
scanf("%s",indata);
scanf("%s",load);
in=strlen(indata);
ln=strlen(load);
//printf("in = %d , ln = %d\n",in,ln);
for(i=0;i<in;i++){
state=1;
if(indata[i]==load[0]){
state=0;
for(j=0;j<ln;j++){
if(indata[i+j]!=load[j]){
state=1;
break;
}
}
}
if(state==0)printf("%d\n",i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151066/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151066/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%indata = alloca [1000000 x i8], align 16
%load = alloca [10000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %indata) #4
call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %load) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %indata)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %load)
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %indata) #5
%conv = trunc i64 %call4 to i32
%call6 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %load) #5
%call6.fr = freeze i64 %call6
%cmp45 = icmp sgt i32 %conv, 0
br i1 %cmp45, label %for.body.lr.ph, label %for.end35
for.body.lr.ph: ; preds = %entry
%conv7 = trunc i64 %call6.fr to i32
%cmp1543 = icmp sgt i32 %conv7, 0
%wide.trip.count58 = and i64 %call4, 4294967295
br i1 %cmp1543, label %for.body.us.preheader, label %for.body
for.body.us.preheader: ; preds = %for.body.lr.ph
%wide.trip.count53 = and i64 %call6.fr, 4294967295
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.inc33.us
%indvars.iv55 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next56, %for.inc33.us ]
%arrayidx.us = getelementptr inbounds [1000000 x i8], ptr %indata, i64 0, i64 %indvars.iv55
%0 = load i8, ptr %arrayidx.us, align 1, !tbaa !5
%1 = load i8, ptr %load, align 16, !tbaa !5
%cmp12.us = icmp eq i8 %0, %1
br i1 %cmp12.us, label %for.body17.us, label %for.inc33.us
for.cond14.us: ; preds = %for.body17.us
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%exitcond54.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count53
br i1 %exitcond54.not, label %for.cond14.if.then30.critedge_crit_edge.us, label %for.body17.us, !llvm.loop !8
for.body17.us: ; preds = %for.body.us, %for.cond14.us
%indvars.iv49 = phi i64 [ %indvars.iv.next50, %for.cond14.us ], [ 0, %for.body.us ]
%2 = add nuw nsw i64 %indvars.iv49, %indvars.iv55
%arrayidx19.us = getelementptr inbounds [1000000 x i8], ptr %indata, i64 0, i64 %2
%3 = load i8, ptr %arrayidx19.us, align 1, !tbaa !5
%arrayidx22.us = getelementptr inbounds [10000 x i8], ptr %load, i64 0, i64 %indvars.iv49
%4 = load i8, ptr %arrayidx22.us, align 1, !tbaa !5
%cmp24.not.us = icmp eq i8 %3, %4
br i1 %cmp24.not.us, label %for.cond14.us, label %for.inc33.us
for.inc33.us: ; preds = %for.body17.us, %for.cond14.if.then30.critedge_crit_edge.us, %for.body.us
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count58
br i1 %exitcond59.not, label %for.end35, label %for.body.us, !llvm.loop !10
for.cond14.if.then30.critedge_crit_edge.us: ; preds = %for.cond14.us
%5 = trunc i64 %indvars.iv55 to i32
%call31.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
br label %for.inc33.us
for.body: ; preds = %for.body.lr.ph, %for.inc33
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc33 ], [ 0, %for.body.lr.ph ]
%arrayidx = getelementptr inbounds [1000000 x i8], ptr %indata, i64 0, i64 %indvars.iv
%6 = load i8, ptr %arrayidx, align 1, !tbaa !5
%7 = load i8, ptr %load, align 16, !tbaa !5
%cmp12 = icmp eq i8 %6, %7
br i1 %cmp12, label %for.cond14.preheader, label %for.inc33
for.cond14.preheader: ; preds = %for.body
%8 = trunc i64 %indvars.iv to i32
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
br label %for.inc33
for.inc33: ; preds = %for.body, %for.cond14.preheader
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count58
br i1 %exitcond.not, label %for.end35, label %for.body, !llvm.loop !10
for.end35: ; preds = %for.inc33, %for.inc33.us, %entry
call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %load) #4
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %indata) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
#include <string.h>
char t[1000], p[1000];
int n1, n2;
int flag;
int main(void) {
int i, j;
scanf("%s", t);
scanf(" %s", p);
n1 = strlen(t);
n2 = strlen(p);
for (i = 0; i <= n1 - n2; i++) {
flag = 0;
for (j = 0; j < n2; j++) {
if (t[i + j] != p[j]) {
flag = 1;
break;
}
}
if (flag == 0)
printf("%d\n", i);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151109/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151109/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@t = dso_local global [1000 x i8] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c" %s\00", align 1
@p = dso_local global [1000 x i8] zeroinitializer, align 16
@n1 = dso_local local_unnamed_addr global i32 0, align 4
@n2 = dso_local local_unnamed_addr global i32 0, align 4
@flag = dso_local local_unnamed_addr global i32 0, align 4
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @p)
%call2 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @t) #3
%conv = trunc i64 %call2 to i32
store i32 %conv, ptr @n1, align 4, !tbaa !5
%call3 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @p) #3
%conv4 = trunc i64 %call3 to i32
store i32 %conv4, ptr @n2, align 4, !tbaa !5
%cmp.not34 = icmp slt i32 %conv, %conv4
br i1 %cmp.not34, label %for.end23, label %for.body
for.body: ; preds = %entry, %for.inc21
%0 = phi i32 [ %6, %for.inc21 ], [ %conv4, %entry ]
%1 = phi i32 [ %7, %for.inc21 ], [ %conv, %entry ]
%indvars.iv38 = phi i64 [ %indvars.iv.next39, %for.inc21 ], [ 0, %entry ]
store i32 0, ptr @flag, align 4, !tbaa !5
%cmp731 = icmp sgt i32 %0, 0
br i1 %cmp731, label %for.body9.preheader, label %if.then18
for.body9.preheader: ; preds = %for.body
%wide.trip.count = zext i32 %0 to i64
br label %for.body9
for.cond6: ; preds = %for.body9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %if.then18, label %for.body9, !llvm.loop !9
for.body9: ; preds = %for.body9.preheader, %for.cond6
%indvars.iv = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next, %for.cond6 ]
%2 = add nuw nsw i64 %indvars.iv, %indvars.iv38
%arrayidx = getelementptr inbounds [1000 x i8], ptr @t, i64 0, i64 %2
%3 = load i8, ptr %arrayidx, align 1, !tbaa !11
%arrayidx12 = getelementptr inbounds [1000 x i8], ptr @p, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx12, align 1, !tbaa !11
%cmp14.not = icmp eq i8 %3, %4
br i1 %cmp14.not, label %for.cond6, label %for.end.thread
for.end.thread: ; preds = %for.body9
store i32 1, ptr @flag, align 4, !tbaa !5
br label %for.inc21
if.then18: ; preds = %for.cond6, %for.body
%5 = trunc i64 %indvars.iv38 to i32
%call19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %5)
%.pre = load i32, ptr @n1, align 4, !tbaa !5
%.pre41 = load i32, ptr @n2, align 4, !tbaa !5
br label %for.inc21
for.inc21: ; preds = %for.end.thread, %if.then18
%6 = phi i32 [ %0, %for.end.thread ], [ %.pre41, %if.then18 ]
%7 = phi i32 [ %1, %for.end.thread ], [ %.pre, %if.then18 ]
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%sub = sub nsw i32 %7, %6
%8 = sext i32 %sub to i64
%cmp.not.not = icmp slt i64 %indvars.iv38, %8
br i1 %cmp.not.not, label %for.body, label %for.end23, !llvm.loop !12
for.end23: ; preds = %for.inc21, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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}
|
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
typedef int32_t i32;
#define POS(i, j) ((i) * n + (j))
int dfs (i32 v, uint8_t *g, i32 n, uint8_t *c, i32 *cnt) {
cnt[c[v]]++;
for (i32 i = 0; i < n; ++i) {
if (i == v || g[POS(v, i)]) continue;
if (c[i] == 2) {
c[i] = c[v] ^ 1;
if (dfs (i, g, n, c, cnt)) return 1;
}
if (c[i] == c[v]) return 1;
}
return 0;
}
void run (void) {
i32 n, m;
scanf ("%" SCNi32 "%" SCNi32, &n, &m);
uint8_t *mat = (uint8_t *) calloc (n * n, sizeof (uint8_t));
while (m--) {
i32 a, b;
scanf ("%" SCNi32 "%" SCNi32, &a, &b);
a--;
b--;
mat[POS(a, b)] = mat[POS(b, a)] = 1;
}
uint8_t *c = (uint8_t *) calloc (n, sizeof (uint8_t));
for (i32 i = 0; i < n; ++i) {
c[i] = 2;
}
i32 *a = (i32 *) calloc (n, sizeof (i32));
i32 *b = (i32 *) calloc (n, sizeof (i32));
i32 len = 0;
for (i32 i = 0; i < n; ++i) {
if (c[i] < 2) continue;
c[i] = 0;
i32 cnt[2] = {0, 0};
if (dfs (i, mat, n, c, cnt)) {
puts ("-1");
return;
}
a[len] = cnt[0];
b[len] = cnt[1];
len++;
}
i32 *dp = (i32 *) calloc (n + 1, sizeof (i32));
dp[0] = 1;
for (i32 i = 0; i < len; ++i) {
for (i32 j = n - 1; j >= 0; --j) {
if (dp[j] == 0) continue;
dp[j] = 0;
dp[j + a[i]] = dp[j + b[i]] = 1;
}
}
i32 min = n * n;
for (i32 i = 1; i < n; ++i) {
i32 v = i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2;
if (dp[i] && v < min) min = v;
}
printf ("%" PRIi32 "\n", min);
}
int main (void) {
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151167/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151167/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%i%i\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"%i\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @dfs(i32 noundef %v, ptr nocapture noundef readonly %g, i32 noundef %n, ptr nocapture noundef %c, ptr nocapture noundef %cnt) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %v to i64
%arrayidx = getelementptr inbounds i8, ptr %c, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%idxprom1 = zext i8 %0 to i64
%arrayidx2 = getelementptr inbounds i32, ptr %cnt, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !8
%inc = add nsw i32 %1, 1
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !8
%cmp.not54 = icmp sgt i32 %n, 0
br i1 %cmp.not54, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %entry
%mul = mul nsw i32 %n, %v
%2 = sext i32 %mul to i64
%3 = zext i32 %v to i64
%4 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
%invariant.gep = getelementptr i8, ptr %g, i64 %2
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%cmp.not57 = phi i1 [ true, %for.body.lr.ph ], [ %cmp.not, %for.inc ]
%cmp3 = icmp eq i64 %indvars.iv, %3
br i1 %cmp3, label %for.inc, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body
%gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv
%5 = load i8, ptr %gep, align 1, !tbaa !5
%tobool.not = icmp eq i8 %5, 0
br i1 %tobool.not, label %if.end, label %for.inc
if.end: ; preds = %lor.lhs.false
%arrayidx7 = getelementptr inbounds i8, ptr %c, i64 %indvars.iv
%6 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %6, 2
%.pre62 = load i8, ptr %arrayidx, align 1, !tbaa !5
br i1 %cmp9, label %if.then11, label %if.end21
if.then11: ; preds = %if.end
%7 = xor i8 %.pre62, 1
store i8 %7, ptr %arrayidx7, align 1, !tbaa !5
%8 = trunc i64 %indvars.iv to i32
%call = tail call i32 @dfs(i32 noundef %8, ptr noundef nonnull %g, i32 noundef %n, ptr noundef nonnull %c, ptr noundef %cnt), !range !10
%tobool18.not = icmp eq i32 %call, 0
br i1 %tobool18.not, label %if.then11.if.end21_crit_edge, label %cleanup.loopexit
if.then11.if.end21_crit_edge: ; preds = %if.then11
%.pre = load i8, ptr %arrayidx7, align 1, !tbaa !5
%.pre61 = load i8, ptr %arrayidx, align 1, !tbaa !5
br label %if.end21
if.end21: ; preds = %if.then11.if.end21_crit_edge, %if.end
%9 = phi i8 [ %.pre61, %if.then11.if.end21_crit_edge ], [ %.pre62, %if.end ]
%10 = phi i8 [ %.pre, %if.then11.if.end21_crit_edge ], [ %6, %if.end ]
%cmp28 = icmp eq i8 %10, %9
br i1 %cmp28, label %cleanup.loopexit, label %for.inc
for.inc: ; preds = %if.end21, %for.body, %lor.lhs.false
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp.not = icmp ult i64 %indvars.iv.next, %4
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup.loopexit, label %for.body, !llvm.loop !11
cleanup.loopexit: ; preds = %if.end21, %if.then11, %for.inc
%cmp.not.lcssa.ph = phi i1 [ %cmp.not, %for.inc ], [ %cmp.not57, %if.then11 ], [ %cmp.not57, %if.end21 ]
%11 = zext i1 %cmp.not.lcssa.ph to i32
br label %cleanup
cleanup: ; preds = %cleanup.loopexit, %entry
%cmp.not.lcssa = phi i32 [ 0, %entry ], [ %11, %cleanup.loopexit ]
ret i32 %cmp.not.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%cnt = alloca [2 x i32], align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !8
%mul = mul nsw i32 %0, %0
%conv = zext i32 %mul to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 1) #7
%1 = load i32, ptr %m, align 4, !tbaa !8
%dec171 = add nsw i32 %1, -1
store i32 %dec171, ptr %m, align 4, !tbaa !8
%tobool.not172 = icmp eq i32 %1, 0
br i1 %tobool.not172, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !8
%dec3 = add nsw i32 %2, -1
%3 = load i32, ptr %b, align 4, !tbaa !8
%dec4 = add nsw i32 %3, -1
%4 = load i32, ptr %n, align 4, !tbaa !8
%mul5 = mul nsw i32 %4, %dec4
%add = add nsw i32 %mul5, %dec3
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds i8, ptr %call1, i64 %idxprom
store i8 1, ptr %arrayidx, align 1, !tbaa !5
%mul6 = mul nsw i32 %4, %dec3
%add7 = add nsw i32 %mul6, %dec4
%idxprom8 = sext i32 %add7 to i64
%arrayidx9 = getelementptr inbounds i8, ptr %call1, i64 %idxprom8
store i8 1, ptr %arrayidx9, align 1, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
%5 = load i32, ptr %m, align 4, !tbaa !8
%dec = add nsw i32 %5, -1
store i32 %dec, ptr %m, align 4, !tbaa !8
%tobool.not = icmp eq i32 %5, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
%6 = phi i32 [ %0, %entry ], [ %4, %while.body ]
%conv10 = sext i32 %6 to i64
%call11 = call noalias ptr @calloc(i64 noundef %conv10, i64 noundef 1) #7
%cmp173 = icmp sgt i32 %6, 0
br i1 %cmp173, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %while.end
%7 = zext i32 %6 to i64
call void @llvm.memset.p0.i64(ptr align 1 %call11, i8 2, i64 %7, i1 false), !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %while.end
%call17 = call noalias ptr @calloc(i64 noundef %conv10, i64 noundef 4) #7
%call20 = call noalias ptr @calloc(i64 noundef %conv10, i64 noundef 4) #7
br i1 %cmp173, label %for.body26.lr.ph, label %for.end50
for.body26.lr.ph: ; preds = %for.cond.cleanup
%arrayidx42 = getelementptr inbounds [2 x i32], ptr %cnt, i64 0, i64 1
%wide.trip.count = zext i32 %6 to i64
br label %for.body26
for.body26: ; preds = %for.body26.lr.ph, %for.inc46
%indvars.iv = phi i64 [ 0, %for.body26.lr.ph ], [ %indvars.iv.next, %for.inc46 ]
%len.0177 = phi i32 [ 0, %for.body26.lr.ph ], [ %len.2, %for.inc46 ]
%arrayidx28 = getelementptr inbounds i8, ptr %call11, i64 %indvars.iv
%8 = load i8, ptr %arrayidx28, align 1, !tbaa !5
%cmp30 = icmp ult i8 %8, 2
br i1 %cmp30, label %for.inc46, label %if.end
if.end: ; preds = %for.body26
store i8 0, ptr %arrayidx28, align 1, !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %cnt) #6
store i64 0, ptr %cnt, align 8
%9 = trunc i64 %indvars.iv to i32
%call34 = call i32 @dfs(i32 noundef %9, ptr noundef %call1, i32 noundef %6, ptr noundef nonnull %call11, ptr noundef nonnull %cnt), !range !10
%tobool35.not = icmp eq i32 %call34, 0
br i1 %tobool35.not, label %cleanup.thread, label %cleanup48.thread
cleanup.thread: ; preds = %if.end
%10 = load i32, ptr %cnt, align 8, !tbaa !8
%idxprom40 = sext i32 %len.0177 to i64
%arrayidx41 = getelementptr inbounds i32, ptr %call17, i64 %idxprom40
store i32 %10, ptr %arrayidx41, align 4, !tbaa !8
%11 = load i32, ptr %arrayidx42, align 4, !tbaa !8
%arrayidx44 = getelementptr inbounds i32, ptr %call20, i64 %idxprom40
store i32 %11, ptr %arrayidx44, align 4, !tbaa !8
%inc45 = add nsw i32 %len.0177, 1
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %cnt) #6
br label %for.inc46
cleanup48.thread: ; preds = %if.end
%call37 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %cnt) #6
br label %cleanup119
for.inc46: ; preds = %cleanup.thread, %for.body26
%len.2 = phi i32 [ %len.0177, %for.body26 ], [ %inc45, %cleanup.thread ]
%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.end50, label %for.body26, !llvm.loop !14
for.end50: ; preds = %for.inc46, %for.cond.cleanup
%len.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %len.2, %for.inc46 ]
%add51 = add nsw i32 %6, 1
%conv52 = sext i32 %add51 to i64
%call53 = call noalias ptr @calloc(i64 noundef %conv52, i64 noundef 4) #7
store i32 1, ptr %call53, align 4, !tbaa !8
%cmp57181 = icmp sgt i32 %len.0.lcssa, 0
br i1 %cmp57181, label %for.cond61.preheader.lr.ph, label %for.cond.cleanup59
for.cond61.preheader.lr.ph: ; preds = %for.end50
br i1 %cmp173, label %for.cond61.preheader.us.preheader, label %for.cond.cleanup59.thread
for.cond.cleanup59.thread: ; preds = %for.cond61.preheader.lr.ph
%mul92206 = mul nsw i32 %6, %6
br label %for.cond.cleanup97
for.cond61.preheader.us.preheader: ; preds = %for.cond61.preheader.lr.ph
%12 = zext i32 %6 to i64
%wide.trip.count197 = zext i32 %len.0.lcssa to i64
br label %for.cond61.preheader.us
for.cond61.preheader.us: ; preds = %for.cond61.preheader.us.preheader, %for.cond61.for.cond.cleanup64_crit_edge.us
%indvars.iv193 = phi i64 [ 0, %for.cond61.preheader.us.preheader ], [ %indvars.iv.next194, %for.cond61.for.cond.cleanup64_crit_edge.us ]
%arrayidx75.us = getelementptr inbounds i32, ptr %call20, i64 %indvars.iv193
%arrayidx80.us = getelementptr inbounds i32, ptr %call17, i64 %indvars.iv193
br label %for.body65.us
for.body65.us: ; preds = %for.cond61.preheader.us, %for.inc84.us
%indvars.iv190 = phi i64 [ %12, %for.cond61.preheader.us ], [ %indvars.iv.next191, %for.inc84.us ]
%indvars.iv.next191 = add nsw i64 %indvars.iv190, -1
%idxprom66.us = and i64 %indvars.iv.next191, 4294967295
%arrayidx67.us = getelementptr inbounds i32, ptr %call53, i64 %idxprom66.us
%13 = load i32, ptr %arrayidx67.us, align 4, !tbaa !8
%cmp68.us = icmp eq i32 %13, 0
br i1 %cmp68.us, label %for.inc84.us, label %if.end71.us
if.end71.us: ; preds = %for.body65.us
%indvars = trunc i64 %indvars.iv.next191 to i32
store i32 0, ptr %arrayidx67.us, align 4, !tbaa !8
%14 = load i32, ptr %arrayidx75.us, align 4, !tbaa !8
%add76.us = add nsw i32 %14, %indvars
%idxprom77.us = sext i32 %add76.us to i64
%arrayidx78.us = getelementptr inbounds i32, ptr %call53, i64 %idxprom77.us
store i32 1, ptr %arrayidx78.us, align 4, !tbaa !8
%15 = load i32, ptr %arrayidx80.us, align 4, !tbaa !8
%add81.us = add nsw i32 %15, %indvars
%idxprom82.us = sext i32 %add81.us to i64
%arrayidx83.us = getelementptr inbounds i32, ptr %call53, i64 %idxprom82.us
store i32 1, ptr %arrayidx83.us, align 4, !tbaa !8
br label %for.inc84.us
for.inc84.us: ; preds = %if.end71.us, %for.body65.us
%cmp62.us = icmp sgt i64 %indvars.iv190, 1
br i1 %cmp62.us, label %for.body65.us, label %for.cond61.for.cond.cleanup64_crit_edge.us, !llvm.loop !15
for.cond61.for.cond.cleanup64_crit_edge.us: ; preds = %for.inc84.us
%indvars.iv.next194 = add nuw nsw i64 %indvars.iv193, 1
%exitcond198.not = icmp eq i64 %indvars.iv.next194, %wide.trip.count197
br i1 %exitcond198.not, label %for.cond.cleanup59, label %for.cond61.preheader.us, !llvm.loop !16
for.cond.cleanup59: ; preds = %for.cond61.for.cond.cleanup64_crit_edge.us, %for.end50
%mul92 = mul nsw i32 %6, %6
%cmp95183 = icmp sgt i32 %6, 1
br i1 %cmp95183, label %for.body98.preheader, label %for.cond.cleanup97
for.body98.preheader: ; preds = %for.cond.cleanup59
%wide.trip.count204 = zext i32 %6 to i64
br label %for.body98
for.cond.cleanup97: ; preds = %for.body98, %for.cond.cleanup59.thread, %for.cond.cleanup59
%min.0.lcssa = phi i32 [ %mul92, %for.cond.cleanup59 ], [ %mul92206, %for.cond.cleanup59.thread ], [ %min.1, %for.body98 ]
%call118 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.0.lcssa)
br label %cleanup119
for.body98: ; preds = %for.body98.preheader, %for.body98
%indvars.iv199 = phi i64 [ 1, %for.body98.preheader ], [ %indvars.iv.next200, %for.body98 ]
%min.0184 = phi i32 [ %mul92, %for.body98.preheader ], [ %min.1, %for.body98 ]
%indvars203 = trunc i64 %indvars.iv199 to i32
%sub99 = add nsw i32 %indvars203, -1
%mul100 = mul nsw i32 %sub99, %indvars203
%div = sdiv i32 %mul100, 2
%sub101 = sub nsw i32 %6, %indvars203
%sub103 = add nsw i32 %sub101, -1
%mul104 = mul nsw i32 %sub103, %sub101
%div105 = sdiv i32 %mul104, 2
%add106 = add nsw i32 %div105, %div
%arrayidx108 = getelementptr inbounds i32, ptr %call53, i64 %indvars.iv199
%16 = load i32, ptr %arrayidx108, align 4, !tbaa !8
%tobool109.not = icmp ne i32 %16, 0
%cmp110 = icmp slt i32 %add106, %min.0184
%or.cond = select i1 %tobool109.not, i1 %cmp110, i1 false
%min.1 = select i1 %or.cond, i32 %add106, i32 %min.0184
%indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
%exitcond205.not = icmp eq i64 %indvars.iv.next200, %wide.trip.count204
br i1 %exitcond205.not, label %for.cond.cleanup97, label %for.body98, !llvm.loop !17
cleanup119: ; preds = %cleanup48.thread, %for.cond.cleanup97
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 void
}
; 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,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
tail call void @run()
ret i32 0
}
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{i32 0, i32 2}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
|
#if 0
cat <<EOF >mistaken-paste
#endif
// thanks for @rsk0315_h4x
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define BIG 2000000007
#define VERYBIG 2000000000000007LL
#define MOD 1000000007
#define FOD 998244353
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 1048576
#ifdef __cplusplus
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <functional>
#include <array>
using std::queue;
using std::priority_queue;
using std::stack;
using std::tuple;
using std::set;
using std::map;
using std::vector;
using std::greater;
using std::pair;
using std::string;
using std::get;
template <typename T, typename U>
pair<T, U> operator+(pair<T, U> l, pair<T, U> r) {
return pair<T, U>(l.first + r.first, l.second + r.second);
}
#endif
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
sll a;
sll b;
sll c;
} hwllc;
typedef struct {
hwll a;
hwll b;
} linell;
ull n, m;
ull h, w;
ull k;
ull q;
sll va, vb, vc, vd, ve, vf;
ull ua, ub, uc, ud, ue, uf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
char ch, dh;
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
ull divide (ull a, ull b, ull modulo) {
return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
ull udiff (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sdiff (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
#define BEGCMP(NAME) int32_t NAME (const void *left, const void *right)
#define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right
#define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1
// int32_t pullcomp (const void *left, const void *right) {
// ull l = *(ull*)left;
// ull r = *(ull*)right;
// if (l < r) {
// return -1;
// }
// if (l > r) {
// return +1;
// }
// return 0;
// }
BEGCMP(pullcomp){
DEFLR(ull);
CMPRET(l, r);
return 0;
}
BEGCMP(prevcomp){
DEFLR(ull);
CMPRET(r, l);
return 0;
}
BEGCMP(psllcomp){
DEFLR(sll);
CMPRET(l, r);
return 0;
}
BEGCMP(pcharcomp){
DEFLR(char);
CMPRET(l, r);
return 0;
}
BEGCMP(pdoublecomp){
DEFLR(double);
CMPRET(l, r);
return 0;
}
int32_t pstrcomp (const void *left, const void *right) {
char* l = *(char**)left;
char* r = *(char**)right;
return strcmp(l, r);
}
BEGCMP(phwllABcomp){
DEFLR(hwll);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
return 0;
}
BEGCMP(phwllREVcomp){
DEFLR(hwll);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
return 0;
}
BEGCMP(ptriplecomp){
DEFLR(hwllc);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
CMPRET(l.c, r.c);
return 0;
}
BEGCMP(ptripleREVcomp){
DEFLR(hwllc);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
CMPRET(l.c, r.c);
return 0;
}
int32_t pquadcomp (const void *left, const void *right) {
linell l = *(linell*)left;
linell r = *(linell*)right;
sll ac = phwllABcomp(&(l.a), &(r.a));
if (ac) return ac;
sll bc = phwllABcomp(&(l.b), &(r.b));
if (bc) return bc;
return 0;
}
bool isinrange (sll left, sll x, sll right) {
return (left <= x && x <= right);
}
bool isinrange_soft (sll left, sll x, sll right) {
return (left <= x && x <= right) || (left >= x && x >= right);
}
sll a[N_MAX + 5];
// ull a[N_MAX + 5];
// sll a[3001][3001];
sll b[N_MAX + 5];
// ull b[N_MAX + 5];
// sll b[3001][3001];
sll c[N_MAX + 5];
sll d[N_MAX + 5];
sll e[N_MAX];
char s[N_MAX + 1];
// char s[3010][3010];
char t[N_MAX + 1];
// char t[3010][3010];
char u[N_MAX + 1];
hwll xy[N_MAX + 5];
hwllc tup[N_MAX + 5];
// sll table[3005][3005];
ull gin[N_MAX];
// here we go
bool isok (ull x) {
ull y = 0;
while (x > 2) {
x = (x - 1) / 2;
y++;
}
return (y <= n);
}
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;
for (i = n; i; i--) {
a[i] = a[i - 1];
}
a[0] = -VERYBIG;
a[n + 1] = +VERYBIG;
for (i = m; i; i--) {
b[i] = b[i - 1];
}
b[0] = -VERYBIG;
b[m + 1] = +VERYBIG;
while (q--) {
sll x;
scanf("%lld", &x);
ull ok1 = 0, ng1 = n + 1;
while (ok1 + 1 < ng1) {
ull med = (ok1 + ng1) / 2;
if (a[med] <= x) {
ok1 = med;
} else {
ng1 = med;
}
}
ull ok2 = 0, ng2 = m + 1;
while (ok2 + 1 < ng2) {
ull med = (ok2 + ng2) / 2;
if (b[med] <= x) {
ok2 = med;
} else {
ng2 = med;
}
}
sll l1 = smin(x - a[ok1], x - b[ok2]), l2 = smax(x - a[ok1], x - b[ok2]);
sll r1 = smin(a[ng1] - x, b[ng2] - x), r2 = smax(a[ng1] - x, b[ng2] - x);
result = smin(smin(l2, r2), smin(
(x - a[ok1]) + (b[ng2] - x) + smin(x - a[ok1], b[ng2] - x),
(a[ng1] - x) + (x - b[ok2]) + smin(a[ng1] - x, x - b[ok2])
));
if (result < 0) abort();
printf("%lld\n", result);
}
// printf("%lld\n", result);
// printf("%.15lf\n", dresult);
// puts(s);
return 0;
success:
// puts("YES");
puts("Yes");
// printf("%llu\n", result);
// puts("0");
// puts("Hanako");
return 0;
fail:
// puts("NO");
// puts("No");
puts("0");
// puts("-1");
// puts("-1 -1 -1");
// puts("Jiro");
return 1;
}
int32_t main (int argc, char *argv[]) {
int32_t i, j;
n = 3;
m = 0;
// scanf("%llu%llu", &h, &w);
scanf("%llu%llu", &n, &m);
// scanf("%llu", &k, &n, &m);
// scanf("%llu%llu", &h, &w);
// scanf("%s", s);
scanf("%llu", &q);
// scanf("%lld%lld", &va, &vb, &vc, &vd);
// scanf("%llu%llu%llu", &ua, &ub, &uc, &ud, &ue);
// scanf("%s", t);
// scanf("%s", u);
// scanf("%llu", &k);
// scanf("%lld", &m);
// for (i = 0; i < n; i++) {
// scanf("%llu", &d[i]);
// }
for (i = 0; i < n; i++) {
// scanf("%lld%lld", &xy[i].a, &xy[i].b);
// scanf("%lld%lld%lld", &tup[i].a, &tup[i].b, &tup[i].c);
scanf("%lld", &a[i]);
// scanf("%lld", &b[i]);
// scanf("%lld", &c[i]);
// scanf("%lld", &d[i]);
// a[i]--;
// b[i]--;
// c[i]--;
// d[i]--;
// xy[i].a--;
// xy[i].b--;
// tup[i].a--;
// tup[i].b--;
}
for (i = 0; i < m; i++) {
// scanf("%lld%lld", &a[i], &b[i]);
scanf("%lld", &b[i]);
// a[i]--;
// b[i]--;
}
// for (i = 0; i < q; i++) {
// // scanf("%lld%lld", &xy[i].a, &xy[i].b);
// scanf("%lld", &c[i]);
// // xy[i].a--;
// // xy[i].b--;
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < m; j++) {
// scanf("%lld", &table[i][j]);
// // table[i][j]--;
// }
// }
// for (i = 0; i < h; i++) {
// scanf("%s", s[i]);
// }
// scanf("%llu", &q);
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151217/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151217/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.hwll = type { i64, i64 }
%struct.hwllc = type { i64, i64, i64 }
@n = dso_local global i64 0, align 8
@a = dso_local global [1048581 x i64] zeroinitializer, align 16
@m = dso_local global i64 0, align 8
@b = dso_local global [1048581 x i64] zeroinitializer, align 16
@q = dso_local global i64 0, align 8
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.4 = private unnamed_addr constant [9 x i8] c"%llu%llu\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = dso_local local_unnamed_addr global i64 0, align 8
@k = 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
@c = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@e = dso_local local_unnamed_addr global [1048576 x i64] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global [1048577 x i8] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [1048577 x i8] zeroinitializer, align 16
@u = dso_local local_unnamed_addr global [1048577 x i8] zeroinitializer, align 16
@xy = dso_local local_unnamed_addr global [1048581 x %struct.hwll] zeroinitializer, align 16
@tup = dso_local local_unnamed_addr global [1048581 x %struct.hwllc] zeroinitializer, align 16
@gin = dso_local local_unnamed_addr global [1048576 x i64] 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree norecurse nosync nounwind memory(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 #3 {
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 #4 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp ult i64 %0, %1
%cmp1 = icmp ugt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @prevcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp ult i64 %1, %0
%cmp1 = icmp ugt i64 %1, %0
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
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 #4 {
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 #4 {
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 #5 {
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) #13
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree 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 #4 {
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 #4 {
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 #4 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptripleREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pquadcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !20
%l.sroa.4.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.4.0.copyload = load i64, ptr %l.sroa.4.0.left.sroa_idx, align 8, !tbaa.struct !19
%l.sroa.5.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0.left.sroa_idx, align 8, !tbaa.struct !17
%l.sroa.6.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 24
%l.sroa.6.0.copyload = load i64, ptr %l.sroa.6.0.left.sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !20
%r.sroa.4.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.4.0.copyload = load i64, ptr %r.sroa.4.0.right.sroa_idx, align 8, !tbaa.struct !19
%r.sroa.5.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0.right.sroa_idx, align 8, !tbaa.struct !17
%r.sroa.6.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 24
%r.sroa.6.0.copyload = load i64, ptr %r.sroa.6.0.right.sroa_idx, align 8, !tbaa.struct !18
%cmp.i = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp.i, label %cleanup10, label %if.end.i
if.end.i: ; preds = %entry
%cmp4.i = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4.i, label %cleanup10, label %if.end6.i
if.end6.i: ; preds = %if.end.i
%cmp8.i = icmp slt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp8.i, label %cleanup10, label %phwllABcomp.exit
phwllABcomp.exit: ; preds = %if.end6.i
%cmp13.i.not = icmp sgt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp13.i.not, label %cleanup10, label %if.end
if.end: ; preds = %phwllABcomp.exit
%cmp.i21 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp.i21, label %cleanup10, label %if.end.i22
if.end.i22: ; preds = %if.end
%cmp4.i23 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4.i23, label %cleanup10, label %if.end6.i24
if.end6.i24: ; preds = %if.end.i22
%cmp8.i25 = icmp slt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
br i1 %cmp8.i25, label %cleanup10, label %if.end10.i26
if.end10.i26: ; preds = %if.end6.i24
%cmp13.i27 = icmp sgt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
%..i28 = zext i1 %cmp13.i27 to i32
br label %cleanup10
cleanup10: ; preds = %if.end10.i26, %if.end6.i24, %if.end.i22, %if.end, %if.end6.i, %if.end.i, %entry, %phwllABcomp.exit
%retval.1 = phi i32 [ 1, %phwllABcomp.exit ], [ -1, %if.end6.i ], [ 1, %if.end.i ], [ -1, %entry ], [ -1, %if.end ], [ 1, %if.end.i22 ], [ -1, %if.end6.i24 ], [ %..i28, %if.end10.i26 ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #3 {
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 #3 {
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 norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local zeroext i1 @isok(i64 noundef %x) local_unnamed_addr #7 {
entry:
%cmp5 = icmp ugt i64 %x, 2
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%y.07 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div4, %while.body ], [ %x, %entry ]
%sub = add i64 %x.addr.06, -1
%div4 = lshr i64 %sub, 1
%inc = add i64 %y.07, 1
%cmp = icmp ugt i64 %sub, 5
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !21
while.end: ; preds = %while.body, %entry
%y.0.lcssa = phi i64 [ 0, %entry ], [ %inc, %while.body ]
%0 = load i64, ptr @n, align 8, !tbaa !8
%cmp1 = icmp ule i64 %y.0.lcssa, %0
ret i1 %cmp1
}
; Function Attrs: nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #8 {
entry:
%x = alloca i64, align 8
%0 = load i64, ptr @n, align 8, !tbaa !8
%tobool.not140 = icmp eq i64 %0, 0
br i1 %tobool.not140, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = shl nuw i64 %0, 3
tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 8 getelementptr inbounds ([1048581 x i64], ptr @a, i64 0, i64 1), ptr nonnull align 16 @a, i64 %1, i1 false), !tbaa !8
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
store i64 -2000000000000007, ptr @a, align 16, !tbaa !8
%add = add i64 %0, 1
%arrayidx2 = getelementptr inbounds [1048581 x i64], ptr @a, i64 0, i64 %add
store i64 2000000000000007, ptr %arrayidx2, align 8, !tbaa !8
%2 = load i64, ptr @m, align 8, !tbaa !8
%tobool4.not142 = icmp eq i64 %2, 0
br i1 %tobool4.not142, label %for.end11, label %for.body5.preheader
for.body5.preheader: ; preds = %for.end
%3 = shl nuw i64 %2, 3
tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 8 getelementptr inbounds ([1048581 x i64], ptr @b, i64 0, i64 1), ptr nonnull align 16 @b, i64 %3, i1 false), !tbaa !8
br label %for.end11
for.end11: ; preds = %for.body5.preheader, %for.end
store i64 -2000000000000007, ptr @b, align 16, !tbaa !8
%add12 = add i64 %2, 1
%arrayidx13 = getelementptr inbounds [1048581 x i64], ptr @b, i64 0, i64 %add12
store i64 2000000000000007, ptr %arrayidx13, align 8, !tbaa !8
%4 = load i64, ptr @q, align 8, !tbaa !8
%dec14153 = add i64 %4, -1
store i64 %dec14153, ptr @q, align 8, !tbaa !8
%tobool15.not154 = icmp eq i64 %4, 0
br i1 %tobool15.not154, label %while.end86, label %while.body
while.body: ; preds = %for.end11, %if.end84
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 %x)
%5 = load i64, ptr @n, align 8, !tbaa !8
%add16 = add i64 %5, 1
%cmp144 = icmp ugt i64 %add16, 1
%.pre.pre = load i64, ptr %x, align 8, !tbaa !8
br i1 %cmp144, label %while.body19, label %while.end
while.body19: ; preds = %while.body, %while.body19
%ok1.0146 = phi i64 [ %ok1.0.div131, %while.body19 ], [ 0, %while.body ]
%ng1.0145 = phi i64 [ %div131.ng1.0, %while.body19 ], [ %add16, %while.body ]
%add20 = add i64 %ok1.0146, %ng1.0145
%div131 = lshr i64 %add20, 1
%arrayidx21 = getelementptr inbounds [1048581 x i64], ptr @a, i64 0, i64 %div131
%6 = load i64, ptr %arrayidx21, align 8, !tbaa !8
%cmp22.not = icmp sgt i64 %6, %.pre.pre
%div131.ng1.0 = select i1 %cmp22.not, i64 %div131, i64 %ng1.0145
%ok1.0.div131 = select i1 %cmp22.not, i64 %ok1.0146, i64 %div131
%add18 = add nuw i64 %ok1.0.div131, 1
%cmp = icmp ult i64 %add18, %div131.ng1.0
br i1 %cmp, label %while.body19, label %while.end, !llvm.loop !22
while.end: ; preds = %while.body19, %while.body
%ng1.0.lcssa = phi i64 [ %add16, %while.body ], [ %div131.ng1.0, %while.body19 ]
%ok1.0.lcssa = phi i64 [ 0, %while.body ], [ %ok1.0.div131, %while.body19 ]
%7 = load i64, ptr @m, align 8, !tbaa !8
%add23 = add i64 %7, 1
%cmp26148 = icmp ugt i64 %add23, 1
br i1 %cmp26148, label %while.body27, label %while.end36
while.body27: ; preds = %while.end, %while.body27
%ok2.0150 = phi i64 [ %ok2.0.div30130, %while.body27 ], [ 0, %while.end ]
%ng2.0149 = phi i64 [ %div30130.ng2.0, %while.body27 ], [ %add23, %while.end ]
%add29 = add i64 %ok2.0150, %ng2.0149
%div30130 = lshr i64 %add29, 1
%arrayidx31 = getelementptr inbounds [1048581 x i64], ptr @b, i64 0, i64 %div30130
%8 = load i64, ptr %arrayidx31, align 8, !tbaa !8
%cmp32.not = icmp sgt i64 %8, %.pre.pre
%div30130.ng2.0 = select i1 %cmp32.not, i64 %div30130, i64 %ng2.0149
%ok2.0.div30130 = select i1 %cmp32.not, i64 %ok2.0150, i64 %div30130
%add25 = add nuw i64 %ok2.0.div30130, 1
%cmp26 = icmp ult i64 %add25, %div30130.ng2.0
br i1 %cmp26, label %while.body27, label %while.end36, !llvm.loop !23
while.end36: ; preds = %while.body27, %while.end
%ng2.0.lcssa = phi i64 [ %add23, %while.end ], [ %div30130.ng2.0, %while.body27 ]
%ok2.0.lcssa = phi i64 [ 0, %while.end ], [ %ok2.0.div30130, %while.body27 ]
%arrayidx37 = getelementptr inbounds [1048581 x i64], ptr @a, i64 0, i64 %ok1.0.lcssa
%9 = load i64, ptr %arrayidx37, align 8, !tbaa !8
%sub38 = sub nsw i64 %.pre.pre, %9
%arrayidx39 = getelementptr inbounds [1048581 x i64], ptr @b, i64 0, i64 %ok2.0.lcssa
%10 = load i64, ptr %arrayidx39, align 8, !tbaa !8
%sub40 = sub nsw i64 %.pre.pre, %10
%cond.i132 = call i64 @llvm.smax.i64(i64 %sub38, i64 %sub40)
%arrayidx47 = getelementptr inbounds [1048581 x i64], ptr @a, i64 0, i64 %ng1.0.lcssa
%11 = load i64, ptr %arrayidx47, align 8, !tbaa !8
%sub48 = sub nsw i64 %11, %.pre.pre
%arrayidx49 = getelementptr inbounds [1048581 x i64], ptr @b, i64 0, i64 %ng2.0.lcssa
%12 = load i64, ptr %arrayidx49, align 8, !tbaa !8
%sub50 = sub nsw i64 %12, %.pre.pre
%cond.i134 = call i64 @llvm.smax.i64(i64 %sub48, i64 %sub50)
%cond.i135 = call i64 @llvm.smin.i64(i64 %cond.i132, i64 %cond.i134)
%add62 = add nsw i64 %sub50, %sub38
%cond.i136 = call i64 @llvm.smin.i64(i64 %sub38, i64 %sub50)
%add68 = add nsw i64 %add62, %cond.i136
%add73 = add nsw i64 %sub48, %sub40
%cond.i137 = call i64 @llvm.smin.i64(i64 %sub48, i64 %sub40)
%add79 = add nsw i64 %add73, %cond.i137
%cond.i138 = call i64 @llvm.smin.i64(i64 %add68, i64 %add79)
%cond.i139 = call i64 @llvm.smin.i64(i64 %cond.i135, i64 %cond.i138)
%cmp82 = icmp slt i64 %cond.i139, 0
br i1 %cmp82, label %if.then83, label %if.end84
if.then83: ; preds = %while.end36
call void @abort() #15
unreachable
if.end84: ; preds = %while.end36
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %cond.i139)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #14
%13 = load i64, ptr @q, align 8, !tbaa !8
%dec14 = add i64 %13, -1
store i64 %dec14, ptr @q, align 8, !tbaa !8
%tobool15.not = icmp eq i64 %13, 0
br i1 %tobool15.not, label %while.end86, label %while.body, !llvm.loop !24
while.end86: ; preds = %if.end84, %for.end11
ret i64 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #10
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #8 {
entry:
store i64 3, ptr @n, align 8, !tbaa !8
store i64 0, ptr @m, align 8, !tbaa !8
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @n, ptr noundef nonnull @m)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @q)
%0 = load i64, ptr @n, align 8, !tbaa !8
%cmp21.not = icmp eq i64 %0, 0
br i1 %cmp21.not, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body, %entry
%1 = load i64, ptr @m, align 8, !tbaa !8
%cmp624.not = icmp eq i64 %1, 0
br i1 %cmp624.not, label %for.end14, label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1048581 x i64], ptr @a, i64 0, i64 %indvars.iv
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%2 = load i64, ptr @n, align 8, !tbaa !8
%cmp = icmp ugt i64 %2, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !25
for.body8: ; preds = %for.cond4.preheader, %for.body8
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body8 ], [ 0, %for.cond4.preheader ]
%arrayidx10 = getelementptr inbounds [1048581 x i64], ptr @b, i64 0, i64 %indvars.iv28
%call11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10)
%indvars.iv.next29 = add nuw i64 %indvars.iv28, 1
%3 = load i64, ptr @m, align 8, !tbaa !8
%cmp6 = icmp ugt i64 %3, %indvars.iv.next29
br i1 %cmp6, label %for.body8, label %for.end14, !llvm.loop !26
for.end14: ; preds = %for.body8, %for.cond4.preheader
%call15 = tail call i64 @solve()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #11
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #12
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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(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 #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 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #12 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #13 = { nounwind willreturn memory(read) }
attributes #14 = { nounwind }
attributes #15 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!10, !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !10, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !10, i64 0}
!17 = !{i64 0, i64 8, !8, i64 8, i64 8, !8}
!18 = !{i64 0, i64 8, !8}
!19 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8}
!20 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8, i64 24, i64 8, !8}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = distinct !{!25, !6}
!26 = distinct !{!26, !6}
|
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
int main(){
ll n;
while(scanf("%lld",&n),n){
ll a[110][110]={};
ll b[110]={};
rep(i,0,n){
ll m;
scanf("%lld",&m);
rep(_,0,m){
ll t;
scanf("%lld",&t);
a[i][t]=1;
}
}
ll k;
scanf("%lld",&k);
rep(i,0,k)scanf("%lld",b+i);
ll idx=-1;
rep(i,0,n){
int flag=1;
rep(j,0,k)flag&=a[i][b[j]];
if(flag){
if(idx==-1)idx=i+1;
else idx=-2;
}
}
printf("%lld\n",idx>0?idx:-1);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151260/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151260/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca [110 x [110 x i64]], align 16
%b = alloca [110 x i64], align 16
%m = alloca i64, align 8
%t = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call75 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%tobool.not76 = icmp eq i64 %0, 0
br i1 %tobool.not76, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup24.thread
%1 = phi i64 [ %26, %for.cond.cleanup24.thread ], [ %0, %entry ]
call void @llvm.lifetime.start.p0(i64 96800, ptr nonnull %a) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(96800) %a, i8 0, i64 96800, i1 false)
call void @llvm.lifetime.start.p0(i64 880, ptr nonnull %b) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(880) %b, i8 0, i64 880, i1 false)
%cmp63 = icmp sgt i64 %1, 0
br i1 %cmp63, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup4, %while.body
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%2 = load i64, ptr %k, align 8, !tbaa !5
%cmp1465 = icmp sgt i64 %2, 0
br i1 %cmp1465, label %for.body16, label %for.cond22.preheader
for.body: ; preds = %while.body, %for.cond.cleanup4
%i.064 = phi i64 [ %inc9, %for.cond.cleanup4 ], [ 0, %while.body ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%3 = load i64, ptr %m, align 8, !tbaa !5
%cmp361 = icmp sgt i64 %3, 0
br i1 %cmp361, label %for.body5, label %for.cond.cleanup4
for.cond.cleanup4: ; preds = %for.body5, %for.body
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #4
%inc9 = add nuw nsw i64 %i.064, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc9, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.body5: ; preds = %for.body, %for.body5
%_.062 = phi i64 [ %inc, %for.body5 ], [ 0, %for.body ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%5 = load i64, ptr %t, align 8, !tbaa !5
%arrayidx7 = getelementptr inbounds [110 x [110 x i64]], ptr %a, i64 0, i64 %i.064, i64 %5
store i64 1, ptr %arrayidx7, align 8, !tbaa !5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #4
%inc = add nuw nsw i64 %_.062, 1
%6 = load i64, ptr %m, align 8, !tbaa !5
%cmp3 = icmp slt i64 %inc, %6
br i1 %cmp3, label %for.body5, label %for.cond.cleanup4, !llvm.loop !11
for.cond22.preheader: ; preds = %for.body16, %for.cond.cleanup
%.lcssa = phi i64 [ %2, %for.cond.cleanup ], [ %24, %for.body16 ]
%7 = load i64, ptr %n, align 8, !tbaa !5
%cmp2371 = icmp sgt i64 %7, 0
br i1 %cmp2371, label %for.cond26.preheader.lr.ph, label %for.cond.cleanup24.thread
for.cond26.preheader.lr.ph: ; preds = %for.cond22.preheader
%cmp2767 = icmp sgt i64 %.lcssa, 0
br i1 %cmp2767, label %for.cond26.preheader.us.preheader, label %for.cond26.preheader.preheader
for.cond26.preheader.us.preheader: ; preds = %for.cond26.preheader.lr.ph
%xtraiter = and i64 %.lcssa, 3
%8 = icmp ult i64 %.lcssa, 4
%unroll_iter = and i64 %.lcssa, -4
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond26.preheader.us
for.cond26.preheader.preheader: ; preds = %for.cond26.preheader.lr.ph
%exitcond.peel.not = icmp eq i64 %7, 1
br i1 %exitcond.peel.not, label %for.cond.cleanup24.thread85, label %for.cond.cleanup24.thread
for.cond26.preheader.us: ; preds = %for.cond26.preheader.us.preheader, %for.cond26.for.cond.cleanup28_crit_edge.us
%i21.073.us = phi i64 [ %add.us, %for.cond26.for.cond.cleanup28_crit_edge.us ], [ 0, %for.cond26.preheader.us.preheader ]
%idx.072.us = phi i64 [ %idx.1.us.fr, %for.cond26.for.cond.cleanup28_crit_edge.us ], [ -1, %for.cond26.preheader.us.preheader ]
br i1 %8, label %for.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa, label %for.body29.us
for.body29.us: ; preds = %for.cond26.preheader.us, %for.body29.us
%j.069.us = phi i64 [ %inc35.us.3, %for.body29.us ], [ 0, %for.cond26.preheader.us ]
%flag.068.us = phi i32 [ %conv33.us.3, %for.body29.us ], [ 1, %for.cond26.preheader.us ]
%niter = phi i64 [ %niter.next.3, %for.body29.us ], [ 0, %for.cond26.preheader.us ]
%arrayidx31.us = getelementptr inbounds [110 x i64], ptr %b, i64 0, i64 %j.069.us
%9 = load i64, ptr %arrayidx31.us, align 16, !tbaa !5
%arrayidx32.us = getelementptr inbounds [110 x [110 x i64]], ptr %a, i64 0, i64 %i21.073.us, i64 %9
%10 = load i64, ptr %arrayidx32.us, align 8, !tbaa !5
%11 = trunc i64 %10 to i32
%conv33.us = and i32 %flag.068.us, %11
%inc35.us = or i64 %j.069.us, 1
%arrayidx31.us.1 = getelementptr inbounds [110 x i64], ptr %b, i64 0, i64 %inc35.us
%12 = load i64, ptr %arrayidx31.us.1, align 8, !tbaa !5
%arrayidx32.us.1 = getelementptr inbounds [110 x [110 x i64]], ptr %a, i64 0, i64 %i21.073.us, i64 %12
%13 = load i64, ptr %arrayidx32.us.1, align 8, !tbaa !5
%14 = trunc i64 %13 to i32
%conv33.us.1 = and i32 %conv33.us, %14
%inc35.us.1 = or i64 %j.069.us, 2
%arrayidx31.us.2 = getelementptr inbounds [110 x i64], ptr %b, i64 0, i64 %inc35.us.1
%15 = load i64, ptr %arrayidx31.us.2, align 16, !tbaa !5
%arrayidx32.us.2 = getelementptr inbounds [110 x [110 x i64]], ptr %a, i64 0, i64 %i21.073.us, i64 %15
%16 = load i64, ptr %arrayidx32.us.2, align 8, !tbaa !5
%17 = trunc i64 %16 to i32
%conv33.us.2 = and i32 %conv33.us.1, %17
%inc35.us.2 = or i64 %j.069.us, 3
%arrayidx31.us.3 = getelementptr inbounds [110 x i64], ptr %b, i64 0, i64 %inc35.us.2
%18 = load i64, ptr %arrayidx31.us.3, align 8, !tbaa !5
%arrayidx32.us.3 = getelementptr inbounds [110 x [110 x i64]], ptr %a, i64 0, i64 %i21.073.us, i64 %18
%19 = load i64, ptr %arrayidx32.us.3, align 8, !tbaa !5
%20 = trunc i64 %19 to i32
%conv33.us.3 = and i32 %conv33.us.2, %20
%inc35.us.3 = add nuw nsw i64 %j.069.us, 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.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa, label %for.body29.us, !llvm.loop !12
for.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa: ; preds = %for.body29.us, %for.cond26.preheader.us
%conv33.us.lcssa.ph = phi i32 [ undef, %for.cond26.preheader.us ], [ %conv33.us.3, %for.body29.us ]
%j.069.us.unr = phi i64 [ 0, %for.cond26.preheader.us ], [ %inc35.us.3, %for.body29.us ]
%flag.068.us.unr = phi i32 [ 1, %for.cond26.preheader.us ], [ %conv33.us.3, %for.body29.us ]
br i1 %lcmp.mod.not, label %for.cond26.for.cond.cleanup28_crit_edge.us, label %for.body29.us.epil
for.body29.us.epil: ; preds = %for.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa, %for.body29.us.epil
%j.069.us.epil = phi i64 [ %inc35.us.epil, %for.body29.us.epil ], [ %j.069.us.unr, %for.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa ]
%flag.068.us.epil = phi i32 [ %conv33.us.epil, %for.body29.us.epil ], [ %flag.068.us.unr, %for.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body29.us.epil ], [ 0, %for.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa ]
%arrayidx31.us.epil = getelementptr inbounds [110 x i64], ptr %b, i64 0, i64 %j.069.us.epil
%21 = load i64, ptr %arrayidx31.us.epil, align 8, !tbaa !5
%arrayidx32.us.epil = getelementptr inbounds [110 x [110 x i64]], ptr %a, i64 0, i64 %i21.073.us, i64 %21
%22 = load i64, ptr %arrayidx32.us.epil, align 8, !tbaa !5
%23 = trunc i64 %22 to i32
%conv33.us.epil = and i32 %flag.068.us.epil, %23
%inc35.us.epil = add nuw nsw i64 %j.069.us.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.cond26.for.cond.cleanup28_crit_edge.us, label %for.body29.us.epil, !llvm.loop !13
for.cond26.for.cond.cleanup28_crit_edge.us: ; preds = %for.body29.us.epil, %for.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa
%conv33.us.lcssa = phi i32 [ %conv33.us.lcssa.ph, %for.cond26.for.cond.cleanup28_crit_edge.us.unr-lcssa ], [ %conv33.us.epil, %for.body29.us.epil ]
%tobool37.not.us = icmp eq i32 %conv33.us.lcssa, 0
%cmp38.us = icmp eq i64 %idx.072.us, -1
%add.us = add nuw nsw i64 %i21.073.us, 1
%spec.select.us = select i1 %cmp38.us, i64 %add.us, i64 -2
%idx.1.us = select i1 %tobool37.not.us, i64 %idx.072.us, i64 %spec.select.us
%idx.1.us.fr = freeze i64 %idx.1.us
%exitcond81.not = icmp eq i64 %add.us, %7
br i1 %exitcond81.not, label %for.cond.cleanup24, label %for.cond26.preheader.us, !llvm.loop !15
for.body16: ; preds = %for.cond.cleanup, %for.body16
%i12.066 = phi i64 [ %inc19, %for.body16 ], [ 0, %for.cond.cleanup ]
%add.ptr = getelementptr inbounds i64, ptr %b, i64 %i12.066
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%inc19 = add nuw nsw i64 %i12.066, 1
%24 = load i64, ptr %k, align 8, !tbaa !5
%cmp14 = icmp slt i64 %inc19, %24
br i1 %cmp14, label %for.body16, label %for.cond22.preheader, !llvm.loop !16
for.cond.cleanup24: ; preds = %for.cond26.for.cond.cleanup28_crit_edge.us
%cmp45 = icmp sgt i64 %idx.1.us.fr, 0
br i1 %cmp45, label %for.cond.cleanup24.thread85, label %for.cond.cleanup24.thread
for.cond.cleanup24.thread85: ; preds = %for.cond26.preheader.preheader, %for.cond.cleanup24
%idx.0.lcssa89 = phi i64 [ %idx.1.us.fr, %for.cond.cleanup24 ], [ 1, %for.cond26.preheader.preheader ]
br label %for.cond.cleanup24.thread
for.cond.cleanup24.thread: ; preds = %for.cond26.preheader.preheader, %for.cond22.preheader, %for.cond.cleanup24, %for.cond.cleanup24.thread85
%25 = phi i64 [ %idx.0.lcssa89, %for.cond.cleanup24.thread85 ], [ -1, %for.cond.cleanup24 ], [ -1, %for.cond22.preheader ], [ -1, %for.cond26.preheader.preheader ]
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %25)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 880, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 96800, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%26 = load i64, ptr %n, align 8, !tbaa !5
%tobool.not = icmp eq i64 %26, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %for.cond.cleanup24.thread, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#include<math.h>
int main(){
int N;
double D,x,y;
int n=0;
scanf("%d %lf",&N,&D);
for(int i=0;i<N;i++){
scanf("%lf %lf",&x,&y);
if(sqrt(x*x+y*y)<=D)
n++;
}
printf("%d\n",n);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151303/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151303/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %lf\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%lf %lf\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
%D = alloca double, align 8
%x = alloca double, align 8
%y = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %D) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %D)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %0, 0
br i1 %cmp9, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%n.0.lcssa = phi i32 [ 0, %entry ], [ %n.1, %for.body ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %n.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %D) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
for.body: ; preds = %entry, %for.body
%i.011 = phi i32 [ %inc5, %for.body ], [ 0, %entry ]
%n.010 = phi i32 [ %n.1, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load double, ptr %x, align 8, !tbaa !9
%2 = load double, ptr %y, align 8, !tbaa !9
%mul2 = fmul double %2, %2
%3 = call double @llvm.fmuladd.f64(double %1, double %1, double %mul2)
%sqrt = call double @llvm.sqrt.f64(double %3)
%4 = load double, ptr %D, align 8, !tbaa !9
%cmp4 = fcmp ole double %sqrt, %4
%inc = zext i1 %cmp4 to i32
%n.1 = add nuw nsw i32 %n.010, %inc
%inc5 = add nuw nsw i32 %i.011, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc5, %5
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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(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 = !{!"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"}
|
#include <stdio.h>
#include <math.h>
int main()
{
long long n,ans=0,i;
long long k;
scanf("%lld%lld",&n,&k);
long long x[n],y[n];
for(i=0;i<n;i++)
scanf("%lld %lld",&x[i],&y[i]);
for(i=0;i<n;i++){
if(((x[i]*x[i])+(y[i]*y[i]))<=k*k)
ans++;
}
printf("%lld\n",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151347/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151347/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
%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
%vla1 = alloca i64, i64 %2, align 16
%cmp29 = icmp sgt i64 %2, 0
br i1 %cmp29, label %for.body, label %for.end17
for.cond4.preheader: ; preds = %for.body
%cmp531 = icmp sgt i64 %5, 0
br i1 %cmp531, label %for.body6.lr.ph, label %for.end17
for.body6.lr.ph: ; preds = %for.cond4.preheader
%3 = load i64, ptr %k, align 8, !tbaa !5
%mul12 = mul nsw i64 %3, %3
%xtraiter = and i64 %5, 1
%4 = icmp eq i64 %5, 1
br i1 %4, label %for.end17.loopexit.unr-lcssa, label %for.body6.lr.ph.new
for.body6.lr.ph.new: ; preds = %for.body6.lr.ph
%unroll_iter = and i64 %5, -2
br label %for.body6
for.body: ; preds = %entry, %for.body
%i.030 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.030
%arrayidx2 = getelementptr inbounds i64, ptr %vla1, i64 %i.030
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%inc = add nuw nsw i64 %i.030, 1
%5 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %5
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.body6: ; preds = %for.body6, %for.body6.lr.ph.new
%ans.033 = phi i64 [ 0, %for.body6.lr.ph.new ], [ %spec.select.1, %for.body6 ]
%i.132 = phi i64 [ 0, %for.body6.lr.ph.new ], [ %inc16.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.lr.ph.new ], [ %niter.next.1, %for.body6 ]
%arrayidx7 = getelementptr inbounds i64, ptr %vla, i64 %i.132
%6 = load i64, ptr %arrayidx7, align 16, !tbaa !5
%mul = mul nsw i64 %6, %6
%arrayidx9 = getelementptr inbounds i64, ptr %vla1, i64 %i.132
%7 = load i64, ptr %arrayidx9, align 16, !tbaa !5
%mul11 = mul nsw i64 %7, %7
%add = add nuw nsw i64 %mul11, %mul
%cmp13.not = icmp ule i64 %add, %mul12
%inc14 = zext i1 %cmp13.not to i64
%spec.select = add nuw nsw i64 %ans.033, %inc14
%inc16 = or i64 %i.132, 1
%arrayidx7.1 = getelementptr inbounds i64, ptr %vla, i64 %inc16
%8 = load i64, ptr %arrayidx7.1, align 8, !tbaa !5
%mul.1 = mul nsw i64 %8, %8
%arrayidx9.1 = getelementptr inbounds i64, ptr %vla1, i64 %inc16
%9 = load i64, ptr %arrayidx9.1, align 8, !tbaa !5
%mul11.1 = mul nsw i64 %9, %9
%add.1 = add nuw nsw i64 %mul11.1, %mul.1
%cmp13.not.1 = icmp ule i64 %add.1, %mul12
%inc14.1 = zext i1 %cmp13.not.1 to i64
%spec.select.1 = add nuw nsw i64 %spec.select, %inc14.1
%inc16.1 = add nuw nsw i64 %i.132, 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.end17.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11
for.end17.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.lr.ph
%spec.select.lcssa.ph = phi i64 [ undef, %for.body6.lr.ph ], [ %spec.select.1, %for.body6 ]
%ans.033.unr = phi i64 [ 0, %for.body6.lr.ph ], [ %spec.select.1, %for.body6 ]
%i.132.unr = phi i64 [ 0, %for.body6.lr.ph ], [ %inc16.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end17, label %for.body6.epil
for.body6.epil: ; preds = %for.end17.loopexit.unr-lcssa
%arrayidx7.epil = getelementptr inbounds i64, ptr %vla, i64 %i.132.unr
%10 = load i64, ptr %arrayidx7.epil, align 8, !tbaa !5
%mul.epil = mul nsw i64 %10, %10
%arrayidx9.epil = getelementptr inbounds i64, ptr %vla1, i64 %i.132.unr
%11 = load i64, ptr %arrayidx9.epil, align 8, !tbaa !5
%mul11.epil = mul nsw i64 %11, %11
%add.epil = add nuw nsw i64 %mul11.epil, %mul.epil
%cmp13.not.epil = icmp ule i64 %add.epil, %mul12
%inc14.epil = zext i1 %cmp13.not.epil to i64
%spec.select.epil = add nuw nsw i64 %ans.033.unr, %inc14.epil
br label %for.end17
for.end17: ; preds = %for.body6.epil, %for.end17.loopexit.unr-lcssa, %entry, %for.cond4.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end17.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body6.epil ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!"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>
#include <math.h>
int main(void){
int n, d;
int ans=0;
scanf("%d %d", &n, &d);
for(int i=0; i<n; i++){
long int x, y;
scanf("%ld %ld", &x, &y);
if(sqrt(x*x+y*y)<=d)ans++;
}
printf("%d\n", ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151390/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151390/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [8 x i8] c"%ld %ld\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
%d = alloca i32, align 4
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %ans.1, %for.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%i.013 = phi i32 [ %inc7, %for.body ], [ 0, %entry ]
%ans.012 = phi i32 [ %ans.1, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i64, ptr %x, align 8, !tbaa !9
%mul = mul nsw i64 %1, %1
%2 = load i64, ptr %y, align 8, !tbaa !9
%mul2 = mul nsw i64 %2, %2
%add = add nuw nsw i64 %mul2, %mul
%conv = sitofp i64 %add to double
%call3 = call double @sqrt(double noundef %conv) #4
%3 = load i32, ptr %d, align 4, !tbaa !5
%conv4 = sitofp i32 %3 to double
%cmp5 = fcmp ole double %call3, %conv4
%inc = zext i1 %cmp5 to i32
%ans.1 = add nuw nsw i32 %ans.012, %inc
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
%inc7 = add nuw nsw i32 %i.013, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc7, %4
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 nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
int main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
long long num,d;
int count=0;
scanf("%lld",&num);
scanf("%lld",&d);
d = d * d;
long long x,y;
while (num--)
{
scanf("%lld %lld",&x,&y);
x = (x*x) + (y*y);
if(d >= x)
count++;
}
printf("%d\n",count);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151433/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151433/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i64, align 8
%d = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %num) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%0 = load i64, ptr %d, align 8, !tbaa !5
%mul = mul nsw i64 %0, %0
store i64 %mul, ptr %d, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3
%1 = load i64, ptr %num, align 8, !tbaa !5
%dec7 = add nsw i64 %1, -1
store i64 %dec7, ptr %num, align 8, !tbaa !5
%tobool.not8 = icmp eq i64 %1, 0
br i1 %tobool.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%count.09 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%2 = load i64, ptr %x, align 8, !tbaa !5
%mul3 = mul nsw i64 %2, %2
%3 = load i64, ptr %y, align 8, !tbaa !5
%mul4 = mul nsw i64 %3, %3
%add = add nuw nsw i64 %mul4, %mul3
store i64 %add, ptr %x, align 8, !tbaa !5
%4 = load i64, ptr %d, align 8, !tbaa !5
%cmp.not = icmp sge i64 %4, %add
%inc = zext i1 %cmp.not to i32
%spec.select = add nuw nsw i32 %count.09, %inc
%5 = load i64, ptr %num, align 8, !tbaa !5
%dec = add nsw i64 %5, -1
store i64 %dec, ptr %num, align 8, !tbaa !5
%tobool.not = icmp eq i64 %5, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %num) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void)
{
unsigned long int N,D,cnt=0,i;
long int X,Y;
//input
scanf("%ld %ld",&N,&D);
for(i=0;i<N;i++)
{
scanf("%lu %lu",&X,&Y);
//printf("%ld \n",X*X);
if(D*D>=X*X+Y*Y)
{
cnt++;
}
}
//output
printf("%d",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151484/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151484/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%lu %lu\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%D = alloca i64, align 8
%X = alloca i64, align 8
%Y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %D) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %Y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %D)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp9.not = icmp eq i64 %0, 0
br i1 %cmp9.not, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%i.011 = phi i64 [ %inc5, %for.body ], [ 0, %entry ]
%cnt.010 = phi i64 [ %spec.select, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %X, ptr noundef nonnull %Y)
%1 = load i64, ptr %D, align 8, !tbaa !5
%mul = mul i64 %1, %1
%2 = load i64, ptr %X, align 8, !tbaa !5
%mul2 = mul nsw i64 %2, %2
%3 = load i64, ptr %Y, align 8, !tbaa !5
%mul3 = mul nsw i64 %3, %3
%add = add nuw nsw i64 %mul3, %mul2
%cmp4.not = icmp uge i64 %mul, %add
%inc = zext i1 %cmp4.not to i64
%spec.select = add i64 %cnt.010, %inc
%inc5 = add nuw i64 %i.011, 1
%4 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp ult i64 %inc5, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%cnt.0.lcssa = phi i64 [ 0, %entry ], [ %spec.select, %for.body ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %Y) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %X) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %D) #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", !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 N, D, count = 0;
scanf("%d %d", &N, &D);
long x, y;
for(int i=0; i<N; i++){
scanf("%ld %ld", &x, &y);
if(sqrt(pow(x,2)+pow(y, 2)) <= D)
count++;
}
printf("%d", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151527/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151527/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [8 x i8] c"%ld %ld\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%D = alloca i32, align 4
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %D)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #4
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%i.016 = phi i32 [ %inc9, %for.body ], [ 0, %entry ]
%count.015 = phi i32 [ %count.1, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i64, ptr %x, align 8, !tbaa !9
%conv = sitofp i64 %1 to double
%square = fmul double %conv, %conv
%2 = load i64, ptr %y, align 8, !tbaa !9
%conv3 = sitofp i64 %2 to double
%square13 = fmul double %conv3, %conv3
%add = fadd double %square, %square13
%sqrt = call double @llvm.sqrt.f64(double %add)
%3 = load i32, ptr %D, align 4, !tbaa !5
%conv6 = sitofp i32 %3 to double
%cmp7 = fcmp ole double %sqrt, %conv6
%inc = zext i1 %cmp7 to i32
%count.1 = add nuw nsw i32 %count.015, %inc
%inc9 = add nuw nsw i32 %i.016, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc9, %4
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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//ABC174D
//ABC174C
//ABC174B
int main(void) {
long long n, d, k, i, cou=0, tmp;
scanf("%lld %lld", &n, &d);
long long x[n], y[n];
for(i=0; i<n; i++){
scanf("%lld %lld", &x[i], &y[i]);
if(pow(x[i], 2)+pow(y[i], 2)<=d*d) cou++;
}
printf("%lld", cou);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151585/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151585/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [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 i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d)
%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
%vla1 = alloca i64, i64 %2, align 16
%cmp21 = icmp sgt i64 %2, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.023 = phi i64 [ %inc12, %for.body ], [ 0, %entry ]
%cou.022 = phi i64 [ %cou.1, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.023
%arrayidx2 = getelementptr inbounds i64, ptr %vla1, i64 %i.023
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%3 = load i64, ptr %arrayidx, align 8, !tbaa !5
%conv = sitofp i64 %3 to double
%square = fmul double %conv, %conv
%4 = load i64, ptr %arrayidx2, align 8, !tbaa !5
%conv7 = sitofp i64 %4 to double
%square20 = fmul double %conv7, %conv7
%add = fadd double %square, %square20
%5 = load i64, ptr %d, align 8, !tbaa !5
%mul = mul nsw i64 %5, %5
%conv9 = sitofp i64 %mul to double
%cmp10 = fcmp ole double %add, %conv9
%inc = zext i1 %cmp10 to i64
%cou.1 = add nuw nsw i64 %cou.022, %inc
%inc12 = add nuw nsw i64 %i.023, 1
%6 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc12, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%cou.0.lcssa = phi i64 [ 0, %entry ], [ %cou.1, %for.body ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %cou.0.lcssa)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int n,i,j,cnt;
while(cnt=0,scanf("%d",&n),n){
for(i=1;i<n+1;i++){
for(j=5;n/j;j*=5){
if(i%j==0)cnt++;
}
}
printf("%d\n",cnt);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151628/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151628/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not23 = icmp eq i32 %0, 0
br i1 %tobool.not23, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end7
%1 = phi i32 [ %2, %for.end7 ], [ %0, %entry ]
%or.cond = icmp slt i32 %1, 5
br i1 %or.cond, label %for.end7, label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond.preheader, %for.cond1.for.inc5_crit_edge
%cnt.020 = phi i32 [ %spec.select, %for.cond1.for.inc5_crit_edge ], [ 0, %for.cond.preheader ]
%i.019 = phi i32 [ %inc6, %for.cond1.for.inc5_crit_edge ], [ 1, %for.cond.preheader ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%cnt.117 = phi i32 [ %cnt.020, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%j.016 = phi i32 [ 5, %for.cond1.preheader ], [ %mul, %for.body3 ]
%rem = urem i32 %i.019, %j.016
%cmp4 = icmp eq i32 %rem, 0
%inc = zext i1 %cmp4 to i32
%spec.select = add nsw i32 %cnt.117, %inc
%mul = mul nuw nsw i32 %j.016, 5
%div = sdiv i32 %1, %mul
%tobool2.not = icmp eq i32 %div, 0
br i1 %tobool2.not, label %for.cond1.for.inc5_crit_edge, label %for.body3, !llvm.loop !9
for.cond1.for.inc5_crit_edge: ; preds = %for.body3
%inc6 = add nuw i32 %i.019, 1
%exitcond.not = icmp eq i32 %i.019, %1
br i1 %exitcond.not, label %for.end7, label %for.cond1.preheader, !llvm.loop !11
for.end7: ; preds = %for.cond1.for.inc5_crit_edge, %for.cond.preheader
%cnt.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %spec.select, %for.cond1.for.inc5_crit_edge ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%2 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end7, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void)
{
int m,n,t,cs;
scanf("%d",&t);
for(cs=1;cs<=t;cs++){
scanf("%d %d",&m,&n);
if(m%n==0)printf("YES\n");
else printf("No\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_15170/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_15170/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not7 = icmp slt i32 %0, 1
br i1 %cmp.not7, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%cs.08 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m, ptr noundef nonnull %n)
%1 = load i32, ptr %m, align 4, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !5
%rem = srem i32 %1, %2
%cmp2 = icmp eq i32 %rem, 0
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%puts6 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
%inc = add nuw nsw i32 %cs.08, 1
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %cs.08, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void)
{
int a,b;
scanf("%d %d",&a,&b);
if(a<=9 && b<=9)
{
printf("%d\n",a*b);
}
else
{
printf("-1");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151765/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151765/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 10
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 10
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i32 %1, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int A, B;
scanf("%d %d", &A, &B);
if( (A <= 9) && (B <= 9) ){ printf("%d", A*B); }
else { printf("-1"); }
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151808/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151808/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 10
%1 = load i32, ptr %B, align 4
%cmp1 = icmp slt i32 %1, 10
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i32 %1, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int i,n,a,b,ans;
scanf("%d%d",&a,&b);
if(a<=9 && b<=9){
ans=a*b;
printf("%d",ans);}
else {
printf("-1");}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151859/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151859/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 10
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 10
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i32 %1, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int A, B;
scanf("%d %d", &A, &B);
if (1 <= A && A <= 9 && 1 <= B && B <= 9){
printf("%d", A * B);
}
else if(A < 1 || 9 < A || B < 1 || 9 < B){
printf("%d", -1);
}else{}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151901/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151901/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 9
%2 = load i32, ptr %B, align 4
%cmp3 = icmp sgt i32 %2, 0
%or.cond17 = select i1 %or.cond, i1 %cmp3, i1 false
%cmp5 = icmp slt i32 %2, 10
%or.cond18 = select i1 %or.cond17, i1 %cmp5, i1 false
br i1 %or.cond18, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nuw nsw i32 %2, %0
br label %if.end16.sink.split
if.else: ; preds = %entry
%3 = add i32 %0, -10
%or.cond19 = icmp ult i32 %3, -9
%cmp10 = icmp slt i32 %2, 1
%or.cond20 = select i1 %or.cond19, i1 true, i1 %cmp10
%cmp12 = icmp sgt i32 %2, 9
%or.cond21 = select i1 %or.cond20, i1 true, i1 %cmp12
br i1 %or.cond21, label %if.end16.sink.split, label %if.end16
if.end16.sink.split: ; preds = %if.else, %if.then
%.sink = phi i32 [ %mul, %if.then ], [ -1, %if.else ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
br label %if.end16
if.end16: ; preds = %if.end16.sink.split, %if.else
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if(a < 10 && b < 10)
{
printf("%d\n",a * b);
}
else
{
printf("-1\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151945/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151945/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 10
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 10
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i32 %1, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end
if.else: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int A,B;
scanf("%d %d",&A,&B);
if(A<=9 && A>=1 && B<=9 && B>=1){
printf("%d",A*B);
}
else{
printf("-1");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151989/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151989/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 9
%2 = load i32, ptr %B, align 4
%cmp3 = icmp slt i32 %2, 10
%or.cond8 = select i1 %or.cond, i1 %cmp3, i1 false
%cmp5 = icmp sgt i32 %2, 0
%or.cond9 = select i1 %or.cond8, i1 %cmp5, i1 false
br i1 %or.cond9, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nuw nsw i32 %2, %0
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end
if.else: ; preds = %entry
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(){
int a,b;
scanf("%d%d",&a,&b);
if (a>9) printf("-1\n");
else if (b>9) printf("-1\n");
else printf("%d\n",a*b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152030/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152030/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 9
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end7
if.else: ; preds = %entry
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %1, 9
br i1 %cmp2, label %if.then3, label %if.else5
if.then3: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end7
if.else5: ; preds = %if.else
%mul = mul nsw i32 %1, %0
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul)
br label %if.end7
if.end7: ; preds = %if.then3, %if.else5, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b;
scanf("%d",&a);
scanf("%d",&b);
if(a<10&&b<10)
printf("%d",a*b);
else printf("-1");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152074/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152074/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 10
%1 = load i32, ptr %b, align 4
%cmp2 = icmp slt i32 %1, 10
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i32 %1, %0
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul)
br label %if.end
if.else: ; preds = %entry
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
if(a> 9||b>9){
printf("-1\n");
}else{
printf("%d\n",a*b);
}return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152117/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152117/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [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:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 9
%1 = load i32, ptr %b, align 4
%cmp1 = icmp sgt i32 %1, 9
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
%mul = mul nsw i32 %1, %0
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
// Your code here!
int A,B;
scanf("%d %d",&A,&B);
if(A<=9&&B<=9){
printf("%d",A*B);
}else{
printf("%d",-1);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152160/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152160/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 10
%1 = load i32, ptr %B, align 4
%cmp1 = icmp slt i32 %1, 10
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%mul = mul nsw i32 %1, %0
%.sink = select i1 %or.cond, i32 %mul, i32 -1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int A,B;
scanf("%d %d",&A,&B);
if(A>=1 && A<=9){
if(B>=1 && B<=9){
printf("%d\n",A*B);
}
else{
printf("-1\n");
}
}
else{
printf("-1\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152203/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152203/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 9
br i1 %or.cond, label %if.then, label %if.else8
if.then: ; preds = %entry
%2 = load i32, ptr %B, align 4
%3 = add i32 %2, -1
%or.cond11 = icmp ult i32 %3, 9
br i1 %or.cond11, label %if.then5, label %if.else
if.then5: ; preds = %if.then
%mul = mul nuw nsw i32 %2, %0
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end10
if.else: ; preds = %if.then
%puts13 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end10
if.else8: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end10
if.end10: ; preds = %if.then5, %if.else, %if.else8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(void){
int A,B;
scanf("%d %d",&A,&B);
if(A>0 && A<10 && B>0 && B<10) printf("%d\n",A*B );
else printf("-1\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152247/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152247/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 9
%2 = load i32, ptr %B, align 4
%cmp3 = icmp sgt i32 %2, 0
%or.cond8 = select i1 %or.cond, i1 %cmp3, i1 false
%cmp5 = icmp slt i32 %2, 10
%or.cond9 = select i1 %or.cond8, i1 %cmp5, i1 false
br i1 %or.cond9, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nuw nsw i32 %2, %0
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end
if.else: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
if (a<=9 && b<=9) printf("%d\n",a*b);
else puts("-1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152290/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152290/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 10
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 10
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i32 %1, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
typedef long long ll;
#define MOD 1000000007
int main() {
int n, m;
ll ans = 0;
scanf("%d%d", &n, &m);
if (n == m || n - 1 == m || n == m - 1) {
if (n == m)
ans = 2;
else
ans = 1;
for (int i = 1; i <= n; i++) {
ans *= i;
ans %= MOD;
}
for (int i = 1; i <= m; i++) {
ans *= i;
ans %= MOD;
}
}
printf("%lld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152333/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152333/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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
%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 eq i32 %0, %1
%sub = add nsw i32 %0, -1
%cmp1 = icmp eq i32 %sub, %1
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
%sub3 = add nsw i32 %1, -1
%cmp4 = icmp eq i32 %0, %sub3
%or.cond31 = select i1 %or.cond, i1 true, i1 %cmp4
br i1 %or.cond31, label %if.then, label %if.end20
if.then: ; preds = %entry
%. = select i1 %cmp, i64 2, i64 1
%cmp7.not32 = icmp slt i32 %0, 1
br i1 %cmp7.not32, label %for.cond9.preheader, label %for.body.preheader
for.body.preheader: ; preds = %if.then
%2 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%4 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %3, 3
%5 = icmp ult i64 %4, 3
br i1 %5, label %for.cond9.preheader.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %3, -4
br label %for.body
for.cond9.preheader.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%rem.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rem.3, %for.body ]
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%ans.133.unr = phi i64 [ %., %for.body.preheader ], [ %rem.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond9.preheader.loopexit.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond9.preheader.loopexit.unr-lcssa ]
%ans.133.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %ans.133.unr, %for.cond9.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond9.preheader.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %ans.133.epil, %indvars.iv.epil
%rem.epil = srem i64 %mul.epil, 1000000007
%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.cond9.preheader, label %for.body.epil, !llvm.loop !9
for.cond9.preheader: ; preds = %for.cond9.preheader.loopexit.unr-lcssa, %for.body.epil, %if.then
%ans.1.lcssa = phi i64 [ %., %if.then ], [ %rem.lcssa.ph, %for.cond9.preheader.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ]
%cmp10.not35 = icmp slt i32 %1, 1
br i1 %cmp10.not35, label %if.end20, label %for.body13.preheader
for.body13.preheader: ; preds = %for.cond9.preheader
%6 = add nuw i32 %1, 1
%wide.trip.count43 = zext i32 %6 to i64
%7 = add nsw i64 %wide.trip.count43, -1
%8 = add nsw i64 %wide.trip.count43, -2
%xtraiter46 = and i64 %7, 3
%9 = icmp ult i64 %8, 3
br i1 %9, label %if.end20.loopexit.unr-lcssa, label %for.body13.preheader.new
for.body13.preheader.new: ; preds = %for.body13.preheader
%unroll_iter50 = and i64 %7, -4
br label %for.body13
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%ans.133 = phi i64 [ %., %for.body.preheader.new ], [ %rem.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%mul = mul nsw i64 %ans.133, %indvars.iv
%rem = srem i64 %mul, 1000000007
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%mul.1 = mul nsw i64 %rem, %indvars.iv.next
%rem.1 = srem i64 %mul.1, 1000000007
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%mul.2 = mul nsw i64 %rem.1, %indvars.iv.next.1
%rem.2 = srem i64 %mul.2, 1000000007
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%mul.3 = mul nsw i64 %rem.2, %indvars.iv.next.2
%rem.3 = srem i64 %mul.3, 1000000007
%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.cond9.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
for.body13: ; preds = %for.body13, %for.body13.preheader.new
%indvars.iv40 = phi i64 [ 1, %for.body13.preheader.new ], [ %indvars.iv.next41.3, %for.body13 ]
%ans.236 = phi i64 [ %ans.1.lcssa, %for.body13.preheader.new ], [ %rem16.3, %for.body13 ]
%niter51 = phi i64 [ 0, %for.body13.preheader.new ], [ %niter51.next.3, %for.body13 ]
%mul15 = mul nsw i64 %ans.236, %indvars.iv40
%rem16 = srem i64 %mul15, 1000000007
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%mul15.1 = mul nsw i64 %rem16, %indvars.iv.next41
%rem16.1 = srem i64 %mul15.1, 1000000007
%indvars.iv.next41.1 = add nuw nsw i64 %indvars.iv40, 2
%mul15.2 = mul nsw i64 %rem16.1, %indvars.iv.next41.1
%rem16.2 = srem i64 %mul15.2, 1000000007
%indvars.iv.next41.2 = add nuw nsw i64 %indvars.iv40, 3
%mul15.3 = mul nsw i64 %rem16.2, %indvars.iv.next41.2
%rem16.3 = srem i64 %mul15.3, 1000000007
%indvars.iv.next41.3 = add nuw nsw i64 %indvars.iv40, 4
%niter51.next.3 = add i64 %niter51, 4
%niter51.ncmp.3 = icmp eq i64 %niter51.next.3, %unroll_iter50
br i1 %niter51.ncmp.3, label %if.end20.loopexit.unr-lcssa, label %for.body13, !llvm.loop !13
if.end20.loopexit.unr-lcssa: ; preds = %for.body13, %for.body13.preheader
%rem16.lcssa.ph = phi i64 [ undef, %for.body13.preheader ], [ %rem16.3, %for.body13 ]
%indvars.iv40.unr = phi i64 [ 1, %for.body13.preheader ], [ %indvars.iv.next41.3, %for.body13 ]
%ans.236.unr = phi i64 [ %ans.1.lcssa, %for.body13.preheader ], [ %rem16.3, %for.body13 ]
%lcmp.mod48.not = icmp eq i64 %xtraiter46, 0
br i1 %lcmp.mod48.not, label %if.end20, label %for.body13.epil
for.body13.epil: ; preds = %if.end20.loopexit.unr-lcssa, %for.body13.epil
%indvars.iv40.epil = phi i64 [ %indvars.iv.next41.epil, %for.body13.epil ], [ %indvars.iv40.unr, %if.end20.loopexit.unr-lcssa ]
%ans.236.epil = phi i64 [ %rem16.epil, %for.body13.epil ], [ %ans.236.unr, %if.end20.loopexit.unr-lcssa ]
%epil.iter47 = phi i64 [ %epil.iter47.next, %for.body13.epil ], [ 0, %if.end20.loopexit.unr-lcssa ]
%mul15.epil = mul nsw i64 %ans.236.epil, %indvars.iv40.epil
%rem16.epil = srem i64 %mul15.epil, 1000000007
%indvars.iv.next41.epil = add nuw nsw i64 %indvars.iv40.epil, 1
%epil.iter47.next = add i64 %epil.iter47, 1
%epil.iter47.cmp.not = icmp eq i64 %epil.iter47.next, %xtraiter46
br i1 %epil.iter47.cmp.not, label %if.end20, label %for.body13.epil, !llvm.loop !14
if.end20: ; preds = %if.end20.loopexit.unr-lcssa, %for.body13.epil, %for.cond9.preheader, %entry
%ans.3 = phi i64 [ 0, %entry ], [ %ans.1.lcssa, %for.cond9.preheader ], [ %rem16.lcssa.ph, %if.end20.loopexit.unr-lcssa ], [ %rem16.epil, %for.body13.epil ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !10}
|
#define UNDERSTAND 1000000007
#include <stdio.h>
int main(void)
{
long int n,m;
long int temp=1;
long int change;
scanf("%ld %ld",&n,&m);
if(n < m){
change = m;
m = n;
n = change;
}
if((n-m==1)||(m-n==1)||(m==n)){
int count = m;
while(count>1){
temp = temp * count--;
temp = temp % UNDERSTAND;
}
temp = temp * temp;
temp = temp % UNDERSTAND;
if(n > m){
temp = temp * n;
temp = temp% UNDERSTAND;
}
if(n == m)printf("%ld\n",(temp*2) % UNDERSTAND);
else printf("%ld\n",temp % UNDERSTAND);
}
else printf("0\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_152384/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_152384/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #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 %n, ptr noundef nonnull %m)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = load i64, ptr %m, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i64 %0, ptr %m, align 8, !tbaa !5
store i64 %1, ptr %n, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i64 [ %0, %if.then ], [ %1, %entry ]
%3 = phi i64 [ %1, %if.then ], [ %0, %entry ]
%sub = sub nsw i64 %3, %2
%cmp1 = icmp eq i64 %sub, 1
%sub2 = sub nsw i64 %2, %3
%cmp3 = icmp eq i64 %sub2, 1
%or.cond = select i1 %cmp1, i1 true, i1 %cmp3
%cmp5 = icmp eq i64 %2, %3
%or.cond41 = or i1 %cmp5, %or.cond
br i1 %or.cond41, label %if.then6, label %if.else27
if.then6: ; preds = %if.end
%conv = trunc i64 %2 to i32
%cmp742 = icmp sgt i32 %conv, 1
br i1 %cmp742, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %if.then6
%4 = and i64 %2, 4294967295
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv = phi i64 [ %4, %while.body.preheader ], [ %indvars.iv.next, %while.body ]
%temp.043 = phi i64 [ 1, %while.body.preheader ], [ %rem, %while.body ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%mul = mul nuw nsw i64 %temp.043, %indvars.iv
%rem = urem i64 %mul, 1000000007
%cmp7 = icmp ugt i64 %indvars.iv, 2
br i1 %cmp7, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %if.then6
%temp.0.lcssa = phi i64 [ 1, %if.then6 ], [ %rem, %while.body ]
%mul10 = mul nuw nsw i64 %temp.0.lcssa, %temp.0.lcssa
%rem11 = urem i64 %mul10, 1000000007
%cmp12 = icmp sgt i64 %3, %2
br i1 %cmp12, label %if.then14, label %if.end17
if.then14: ; preds = %while.end
%mul15 = mul nsw i64 %rem11, %3
%rem16 = srem i64 %mul15, 1000000007
br label %if.end17
if.end17: ; preds = %if.then14, %while.end
%temp.1 = phi i64 [ %rem16, %if.then14 ], [ %rem11, %while.end ]
br i1 %cmp5, label %if.then20, label %if.else
if.then20: ; preds = %if.end17
%mul21 = shl nsw i64 %temp.1, 1
%rem22 = srem i64 %mul21, 1000000007
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %rem22)
br label %if.end29
if.else: ; preds = %if.end17
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %temp.1)
br label %if.end29
if.else27: ; preds = %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end29
if.end29: ; preds = %if.then20, %if.else, %if.else27
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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"}
|