Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
#include <stdbool.h>
bool is_lunlun(unsigned long int x) {
bool ans = true;
if (x / 10 > 0) {
unsigned long int temp = x % 10;
x = x /10;
while (x > 0) {
if (x % 10 != temp && x % 10 + 1 != temp && temp + 1 != x % 10) {
ans = false;
break;
}
temp = x % 10;
x = x / 10;
}
}
return ans;
}
int lb(int x) {
if (x == 0) return 0;
else return x-1;
}
int ub(int x) {
if (x == 0 || x == 9) return 9;
else return x+1;
}
unsigned long int answer(int i[]) {
unsigned long int ans = 0;
int j;
for (j=0; j<10; j++) {
ans = ans * 10 + (unsigned long int)i[j];
}
return ans;
}
bool judge(int i[]) {
int j;
for (j=0; i[j] == 0; j++) ;
bool ans = true;
int temp = i[j];
for (j++; j < 10; j++) {
if (temp-i[j] > 1 || temp-i[j] < -1) {
ans = false;
break;
}
temp = i[j];
}
return ans;
}
int main(void) {
int k;
scanf("%d", &k);
int count = -1;
int i[10] = {0};
unsigned long int ans;
for (i[0] = 0; i[0] <= 9; i[0]++) {
for (i[1] = lb(i[0]); i[1] <= ub(i[0]); i[1]++) {
for (i[2] = lb(i[1]); i[2] <= ub(i[1]); i[2]++) {
for (i[3] = lb(i[2]); i[3] <= ub(i[2]); i[3]++) {
for (i[4] = lb(i[3]); i[4] <= ub(i[3]); i[4]++) {
for (i[5] = lb(i[4]); i[5] <= ub(i[4]); i[5]++) {
for (i[6] = lb(i[5]); i[6] <= ub(i[5]); i[6]++) {
for (i[7] = lb(i[6]); i[7] <= ub(i[6]); i[7]++) {
for (i[8] = lb(i[7]); i[8] <= ub(i[7]); i[8]++) {
for (i[9] = lb(i[8]); i[9] <= ub(i[8]); i[9]++) {
if (judge(i)) count += 1;
if (count == k) goto ANS;
}
}
}
}
}
}
}
}
}
}
ANS:
ans = answer(i);
printf("%ld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229446/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229446/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local zeroext i1 @is_lunlun(i64 noundef %x) local_unnamed_addr #0 {
entry:
%cmp.not = icmp ult i64 %x, 10
br i1 %cmp.not, label %if.end14, label %if.then
if.then: ; preds = %entry
%rem = urem i64 %x, 10
br label %while.cond
while.cond: ; preds = %while.body, %if.then
%x.addr.0.in = phi i64 [ %x, %if.then ], [ %x.addr.0, %while.body ]
%temp.0 = phi i64 [ %rem, %if.then ], [ %rem3, %while.body ]
%cmp2.not = icmp ult i64 %x.addr.0.in, 10
br i1 %cmp2.not, label %if.end14, label %while.body
while.body: ; preds = %while.cond
%x.addr.0 = udiv i64 %x.addr.0.in, 10
%rem3 = urem i64 %x.addr.0, 10
%cmp4.not = icmp eq i64 %rem3, %temp.0
%add = add nuw nsw i64 %rem3, 1
%cmp6.not = icmp eq i64 %add, %temp.0
%or.cond = select i1 %cmp4.not, i1 true, i1 %cmp6.not
%add8 = add nuw nsw i64 %temp.0, 1
%cmp10.not = icmp eq i64 %add8, %rem3
%or.cond25 = select i1 %or.cond, i1 true, i1 %cmp10.not
br i1 %or.cond25, label %while.cond, label %if.end14, !llvm.loop !5
if.end14: ; preds = %while.cond, %while.body, %entry
%ans.1 = phi i1 [ true, %entry ], [ %cmp2.not, %while.body ], [ %cmp2.not, %while.cond ]
ret i1 %ans.1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @lb(i32 noundef %x) local_unnamed_addr #2 {
entry:
%retval.0 = tail call i32 @llvm.usub.sat.i32(i32 %x, i32 1)
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ub(i32 noundef %x) local_unnamed_addr #3 {
entry:
switch i32 %x, label %if.else [
i32 9, label %return
i32 0, label %return
]
if.else: ; preds = %entry
%add = add nsw i32 %x, 1
br label %return
return: ; preds = %entry, %entry, %if.else
%retval.0 = phi i32 [ %add, %if.else ], [ 9, %entry ], [ 9, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i64 @answer(ptr nocapture noundef readonly %i) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %i, align 4, !tbaa !7
%conv = sext i32 %0 to i64
%mul.1 = mul nsw i64 %conv, 10
%arrayidx.1 = getelementptr inbounds i32, ptr %i, i64 1
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !7
%conv.1 = sext i32 %1 to i64
%add.1 = add nsw i64 %mul.1, %conv.1
%mul.2 = mul nsw i64 %add.1, 10
%arrayidx.2 = getelementptr inbounds i32, ptr %i, i64 2
%2 = load i32, ptr %arrayidx.2, align 4, !tbaa !7
%conv.2 = sext i32 %2 to i64
%add.2 = add nsw i64 %mul.2, %conv.2
%mul.3 = mul nsw i64 %add.2, 10
%arrayidx.3 = getelementptr inbounds i32, ptr %i, i64 3
%3 = load i32, ptr %arrayidx.3, align 4, !tbaa !7
%conv.3 = sext i32 %3 to i64
%add.3 = add nsw i64 %mul.3, %conv.3
%mul.4 = mul nsw i64 %add.3, 10
%arrayidx.4 = getelementptr inbounds i32, ptr %i, i64 4
%4 = load i32, ptr %arrayidx.4, align 4, !tbaa !7
%conv.4 = sext i32 %4 to i64
%add.4 = add nsw i64 %mul.4, %conv.4
%mul.5 = mul nsw i64 %add.4, 10
%arrayidx.5 = getelementptr inbounds i32, ptr %i, i64 5
%5 = load i32, ptr %arrayidx.5, align 4, !tbaa !7
%conv.5 = sext i32 %5 to i64
%add.5 = add nsw i64 %mul.5, %conv.5
%mul.6 = mul nsw i64 %add.5, 10
%arrayidx.6 = getelementptr inbounds i32, ptr %i, i64 6
%6 = load i32, ptr %arrayidx.6, align 4, !tbaa !7
%conv.6 = sext i32 %6 to i64
%add.6 = add nsw i64 %mul.6, %conv.6
%mul.7 = mul nsw i64 %add.6, 10
%arrayidx.7 = getelementptr inbounds i32, ptr %i, i64 7
%7 = load i32, ptr %arrayidx.7, align 4, !tbaa !7
%conv.7 = sext i32 %7 to i64
%add.7 = add nsw i64 %mul.7, %conv.7
%mul.8 = mul nsw i64 %add.7, 10
%arrayidx.8 = getelementptr inbounds i32, ptr %i, i64 8
%8 = load i32, ptr %arrayidx.8, align 4, !tbaa !7
%conv.8 = sext i32 %8 to i64
%add.8 = add nsw i64 %mul.8, %conv.8
%mul.9 = mul nsw i64 %add.8, 10
%arrayidx.9 = getelementptr inbounds i32, ptr %i, i64 9
%9 = load i32, ptr %arrayidx.9, align 4, !tbaa !7
%conv.9 = sext i32 %9 to i64
%add.9 = add nsw i64 %mul.9, %conv.9
ret i64 %add.9
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local zeroext i1 @judge(ptr nocapture noundef readonly %i) local_unnamed_addr #5 {
entry:
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%indvars.iv36 = phi i32 [ %indvars.iv.next37, %for.cond ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %i, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !7
%cmp = icmp eq i32 %0, 0
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next37 = add nuw i32 %indvars.iv36, 1
br i1 %cmp, label %for.cond, label %for.cond4.preheader, !llvm.loop !11
for.cond4.preheader: ; preds = %for.cond
%umax = tail call i32 @llvm.umax.i32(i32 %indvars.iv36, i32 9)
%wide.trip.count = zext i32 %umax to i64
br label %for.cond4
for.cond4: ; preds = %for.cond4.preheader, %for.body6
%indvars.iv33 = phi i64 [ %indvars.iv, %for.cond4.preheader ], [ %indvars.iv.next34, %for.body6 ]
%temp.0 = phi i32 [ %0, %for.cond4.preheader ], [ %1, %for.body6 ]
%exitcond = icmp eq i64 %indvars.iv33, %wide.trip.count
br i1 %exitcond, label %for.end18, label %for.body6
for.body6: ; preds = %for.cond4
%indvars.iv.next34 = add nuw i64 %indvars.iv33, 1
%arrayidx8 = getelementptr inbounds i32, ptr %i, i64 %indvars.iv.next34
%1 = load i32, ptr %arrayidx8, align 4, !tbaa !7
%sub = add i32 %temp.0, -2
%2 = sub i32 %sub, %1
%or.cond = icmp ult i32 %2, -3
br i1 %or.cond, label %for.end18, label %for.cond4, !llvm.loop !12
for.end18: ; preds = %for.body6, %for.cond4
%cmp5 = icmp ugt i64 %indvars.iv33, 8
ret i1 %cmp5
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%k = alloca i32, align 4
%i = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %i) #9
%0 = getelementptr inbounds i8, ptr %i, i64 32
store i64 0, ptr %0, align 16
%arrayidx4 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 1
%arrayidx13 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 2
%arrayidx22 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 3
%arrayidx31 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 4
%arrayidx40 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 5
%arrayidx49 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 6
%arrayidx58 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 7
%arrayidx67 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 8
%arrayidx76 = getelementptr inbounds [10 x i32], ptr %i, i64 0, i64 9
%1 = load i32, ptr %k, align 4
store i32 0, ptr %i, align 16, !tbaa !7
br label %for.body
for.body: ; preds = %entry, %for.inc120
%2 = phi i32 [ 0, %entry ], [ %10, %for.inc120 ]
%3 = phi i32 [ 0, %entry ], [ %11, %for.inc120 ]
%4 = phi i32 [ 0, %entry ], [ %12, %for.inc120 ]
%5 = phi i32 [ 0, %entry ], [ %13, %for.inc120 ]
%6 = phi i32 [ 0, %entry ], [ %14, %for.inc120 ]
%7 = phi i32 [ 0, %entry ], [ %15, %for.inc120 ]
%8 = phi i32 [ 0, %entry ], [ %16, %for.inc120 ]
%9 = phi i32 [ 0, %entry ], [ %17, %for.inc120 ]
%count.0192 = phi i32 [ -1, %entry ], [ %count.1, %for.inc120 ]
%storemerge191 = phi i32 [ 0, %entry ], [ %add.i, %for.inc120 ]
%retval.0.i = call i32 @llvm.usub.sat.i32(i32 %storemerge191, i32 1)
%add.i = add nuw nsw i32 %storemerge191, 1
br label %for.cond5
for.cond5: ; preds = %ub.exit142, %for.body
%10 = phi i32 [ %2, %for.body ], [ %19, %ub.exit142 ]
%11 = phi i32 [ %3, %for.body ], [ %20, %ub.exit142 ]
%12 = phi i32 [ %4, %for.body ], [ %21, %ub.exit142 ]
%13 = phi i32 [ %5, %for.body ], [ %22, %ub.exit142 ]
%14 = phi i32 [ %6, %for.body ], [ %23, %ub.exit142 ]
%15 = phi i32 [ %7, %for.body ], [ %24, %ub.exit142 ]
%16 = phi i32 [ %8, %for.body ], [ %25, %ub.exit142 ]
%17 = phi i32 [ %9, %for.body ], [ %storemerge129, %ub.exit142 ]
%18 = phi i32 [ %retval.0.i, %for.body ], [ %add.i141, %ub.exit142 ]
%count.1 = phi i32 [ %count.0192, %for.body ], [ %count.2, %ub.exit142 ]
store i32 %18, ptr %arrayidx4, align 4, !tbaa !7
switch i32 %storemerge191, label %if.else.i [
i32 9, label %ub.exit
i32 0, label %ub.exit
]
if.else.i: ; preds = %for.cond5
br label %ub.exit
ub.exit: ; preds = %for.cond5, %for.cond5, %if.else.i
%retval.0.i137 = phi i32 [ %add.i, %if.else.i ], [ 9, %for.cond5 ], [ 9, %for.cond5 ]
%cmp9.not = icmp sgt i32 %18, %retval.0.i137
br i1 %cmp9.not, label %for.inc120, label %for.body10
for.body10: ; preds = %ub.exit
%retval.0.i138 = call i32 @llvm.usub.sat.i32(i32 %18, i32 1)
%add.i141 = add nuw nsw i32 %18, 1
br label %for.cond14
for.cond14: ; preds = %ub.exit147, %for.body10
%19 = phi i32 [ %10, %for.body10 ], [ %26, %ub.exit147 ]
%20 = phi i32 [ %11, %for.body10 ], [ %27, %ub.exit147 ]
%21 = phi i32 [ %12, %for.body10 ], [ %28, %ub.exit147 ]
%22 = phi i32 [ %13, %for.body10 ], [ %29, %ub.exit147 ]
%23 = phi i32 [ %14, %for.body10 ], [ %30, %ub.exit147 ]
%24 = phi i32 [ %15, %for.body10 ], [ %31, %ub.exit147 ]
%25 = phi i32 [ %16, %for.body10 ], [ %storemerge130, %ub.exit147 ]
%storemerge129 = phi i32 [ %retval.0.i138, %for.body10 ], [ %add.i146, %ub.exit147 ]
%count.2 = phi i32 [ %count.1, %for.body10 ], [ %count.3, %ub.exit147 ]
store i32 %storemerge129, ptr %arrayidx13, align 8, !tbaa !7
switch i32 %18, label %if.else.i140 [
i32 9, label %ub.exit142
i32 0, label %ub.exit142
]
if.else.i140: ; preds = %for.cond14
br label %ub.exit142
ub.exit142: ; preds = %for.cond14, %for.cond14, %if.else.i140
%retval.0.i139 = phi i32 [ %add.i141, %if.else.i140 ], [ 9, %for.cond14 ], [ 9, %for.cond14 ]
%cmp18.not = icmp sgt i32 %storemerge129, %retval.0.i139
br i1 %cmp18.not, label %for.cond5, label %for.body19, !llvm.loop !13
for.body19: ; preds = %ub.exit142
%retval.0.i143 = call i32 @llvm.usub.sat.i32(i32 %storemerge129, i32 1)
%add.i146 = add nuw nsw i32 %storemerge129, 1
br label %for.cond23
for.cond23: ; preds = %ub.exit152, %for.body19
%26 = phi i32 [ %19, %for.body19 ], [ %32, %ub.exit152 ]
%27 = phi i32 [ %20, %for.body19 ], [ %33, %ub.exit152 ]
%28 = phi i32 [ %21, %for.body19 ], [ %34, %ub.exit152 ]
%29 = phi i32 [ %22, %for.body19 ], [ %35, %ub.exit152 ]
%30 = phi i32 [ %23, %for.body19 ], [ %36, %ub.exit152 ]
%31 = phi i32 [ %24, %for.body19 ], [ %storemerge131, %ub.exit152 ]
%storemerge130 = phi i32 [ %retval.0.i143, %for.body19 ], [ %add.i151, %ub.exit152 ]
%count.3 = phi i32 [ %count.2, %for.body19 ], [ %count.4, %ub.exit152 ]
store i32 %storemerge130, ptr %arrayidx22, align 4, !tbaa !7
switch i32 %storemerge129, label %if.else.i145 [
i32 9, label %ub.exit147
i32 0, label %ub.exit147
]
if.else.i145: ; preds = %for.cond23
br label %ub.exit147
ub.exit147: ; preds = %for.cond23, %for.cond23, %if.else.i145
%retval.0.i144 = phi i32 [ %add.i146, %if.else.i145 ], [ 9, %for.cond23 ], [ 9, %for.cond23 ]
%cmp27.not = icmp sgt i32 %storemerge130, %retval.0.i144
br i1 %cmp27.not, label %for.cond14, label %for.body28, !llvm.loop !14
for.body28: ; preds = %ub.exit147
%retval.0.i148 = call i32 @llvm.usub.sat.i32(i32 %storemerge130, i32 1)
%add.i151 = add nsw i32 %storemerge130, 1
br label %for.cond32
for.cond32: ; preds = %ub.exit157, %for.body28
%32 = phi i32 [ %26, %for.body28 ], [ %37, %ub.exit157 ]
%33 = phi i32 [ %27, %for.body28 ], [ %38, %ub.exit157 ]
%34 = phi i32 [ %28, %for.body28 ], [ %39, %ub.exit157 ]
%35 = phi i32 [ %29, %for.body28 ], [ %40, %ub.exit157 ]
%36 = phi i32 [ %30, %for.body28 ], [ %storemerge132, %ub.exit157 ]
%storemerge131 = phi i32 [ %retval.0.i148, %for.body28 ], [ %add.i156, %ub.exit157 ]
%count.4 = phi i32 [ %count.3, %for.body28 ], [ %count.5, %ub.exit157 ]
store i32 %storemerge131, ptr %arrayidx31, align 16, !tbaa !7
switch i32 %storemerge130, label %if.else.i150 [
i32 9, label %ub.exit152
i32 0, label %ub.exit152
]
if.else.i150: ; preds = %for.cond32
br label %ub.exit152
ub.exit152: ; preds = %for.cond32, %for.cond32, %if.else.i150
%retval.0.i149 = phi i32 [ %add.i151, %if.else.i150 ], [ 9, %for.cond32 ], [ 9, %for.cond32 ]
%cmp36.not = icmp sgt i32 %storemerge131, %retval.0.i149
br i1 %cmp36.not, label %for.cond23, label %for.body37, !llvm.loop !15
for.body37: ; preds = %ub.exit152
%retval.0.i153 = call i32 @llvm.usub.sat.i32(i32 %storemerge131, i32 1)
%add.i156 = add nsw i32 %storemerge131, 1
br label %for.cond41
for.cond41: ; preds = %ub.exit162, %for.body37
%37 = phi i32 [ %32, %for.body37 ], [ %41, %ub.exit162 ]
%38 = phi i32 [ %33, %for.body37 ], [ %42, %ub.exit162 ]
%39 = phi i32 [ %34, %for.body37 ], [ %43, %ub.exit162 ]
%40 = phi i32 [ %35, %for.body37 ], [ %storemerge133, %ub.exit162 ]
%storemerge132 = phi i32 [ %retval.0.i153, %for.body37 ], [ %add.i161, %ub.exit162 ]
%count.5 = phi i32 [ %count.4, %for.body37 ], [ %count.6, %ub.exit162 ]
store i32 %storemerge132, ptr %arrayidx40, align 4, !tbaa !7
switch i32 %storemerge131, label %if.else.i155 [
i32 9, label %ub.exit157
i32 0, label %ub.exit157
]
if.else.i155: ; preds = %for.cond41
br label %ub.exit157
ub.exit157: ; preds = %for.cond41, %for.cond41, %if.else.i155
%retval.0.i154 = phi i32 [ %add.i156, %if.else.i155 ], [ 9, %for.cond41 ], [ 9, %for.cond41 ]
%cmp45.not = icmp sgt i32 %storemerge132, %retval.0.i154
br i1 %cmp45.not, label %for.cond32, label %for.body46, !llvm.loop !16
for.body46: ; preds = %ub.exit157
%retval.0.i158 = call i32 @llvm.usub.sat.i32(i32 %storemerge132, i32 1)
%add.i161 = add nsw i32 %storemerge132, 1
br label %for.cond50
for.cond50: ; preds = %ub.exit167, %for.body46
%41 = phi i32 [ %37, %for.body46 ], [ %44, %ub.exit167 ]
%42 = phi i32 [ %38, %for.body46 ], [ %45, %ub.exit167 ]
%43 = phi i32 [ %39, %for.body46 ], [ %storemerge134, %ub.exit167 ]
%storemerge133 = phi i32 [ %retval.0.i158, %for.body46 ], [ %add.i166, %ub.exit167 ]
%count.6 = phi i32 [ %count.5, %for.body46 ], [ %count.7, %ub.exit167 ]
store i32 %storemerge133, ptr %arrayidx49, align 8, !tbaa !7
switch i32 %storemerge132, label %if.else.i160 [
i32 9, label %ub.exit162
i32 0, label %ub.exit162
]
if.else.i160: ; preds = %for.cond50
br label %ub.exit162
ub.exit162: ; preds = %for.cond50, %for.cond50, %if.else.i160
%retval.0.i159 = phi i32 [ %add.i161, %if.else.i160 ], [ 9, %for.cond50 ], [ 9, %for.cond50 ]
%cmp54.not = icmp sgt i32 %storemerge133, %retval.0.i159
br i1 %cmp54.not, label %for.cond41, label %for.body55, !llvm.loop !17
for.body55: ; preds = %ub.exit162
%retval.0.i163 = call i32 @llvm.usub.sat.i32(i32 %storemerge133, i32 1)
%add.i166 = add nsw i32 %storemerge133, 1
br label %for.cond59
for.cond59: ; preds = %ub.exit172, %for.body55
%44 = phi i32 [ %41, %for.body55 ], [ %46, %ub.exit172 ]
%45 = phi i32 [ %42, %for.body55 ], [ %storemerge135, %ub.exit172 ]
%storemerge134 = phi i32 [ %retval.0.i163, %for.body55 ], [ %add.i171, %ub.exit172 ]
%count.7 = phi i32 [ %count.6, %for.body55 ], [ %count.8, %ub.exit172 ]
store i32 %storemerge134, ptr %arrayidx58, align 4, !tbaa !7
switch i32 %storemerge133, label %if.else.i165 [
i32 9, label %ub.exit167
i32 0, label %ub.exit167
]
if.else.i165: ; preds = %for.cond59
br label %ub.exit167
ub.exit167: ; preds = %for.cond59, %for.cond59, %if.else.i165
%retval.0.i164 = phi i32 [ %add.i166, %if.else.i165 ], [ 9, %for.cond59 ], [ 9, %for.cond59 ]
%cmp63.not = icmp sgt i32 %storemerge134, %retval.0.i164
br i1 %cmp63.not, label %for.cond50, label %for.body64, !llvm.loop !18
for.body64: ; preds = %ub.exit167
%retval.0.i168 = call i32 @llvm.usub.sat.i32(i32 %storemerge134, i32 1)
%add.i171 = add nsw i32 %storemerge134, 1
br label %for.cond68
for.cond68.backedge: ; preds = %for.cond77.us, %for.cond77
%.be = phi i32 [ %storemerge136, %for.cond77 ], [ %storemerge136.us, %for.cond77.us ]
%count.8.be = phi i32 [ %count.9, %for.cond77 ], [ %count.9.us, %for.cond77.us ]
br label %for.cond68
for.cond68: ; preds = %for.cond68.backedge, %for.body64
%46 = phi i32 [ %44, %for.body64 ], [ %.be, %for.cond68.backedge ]
%storemerge135 = phi i32 [ %retval.0.i168, %for.body64 ], [ %add.i176, %for.cond68.backedge ]
%count.8 = phi i32 [ %count.7, %for.body64 ], [ %count.8.be, %for.cond68.backedge ]
store i32 %storemerge135, ptr %arrayidx67, align 16, !tbaa !7
switch i32 %storemerge134, label %if.else.i170 [
i32 9, label %ub.exit172
i32 0, label %ub.exit172
]
if.else.i170: ; preds = %for.cond68
br label %ub.exit172
ub.exit172: ; preds = %for.cond68, %for.cond68, %if.else.i170
%retval.0.i169 = phi i32 [ %add.i171, %if.else.i170 ], [ 9, %for.cond68 ], [ 9, %for.cond68 ]
%cmp72.not = icmp sgt i32 %storemerge135, %retval.0.i169
br i1 %cmp72.not, label %for.cond59, label %for.body73, !llvm.loop !19
for.body73: ; preds = %ub.exit172
%retval.0.i173 = call i32 @llvm.usub.sat.i32(i32 %storemerge135, i32 1)
%add.i176 = add nsw i32 %storemerge135, 1
switch i32 %storemerge135, label %for.cond77 [
i32 9, label %for.cond77.us.preheader
i32 0, label %for.cond77.us.preheader
]
for.cond77.us.preheader: ; preds = %for.body73, %for.body73
br label %for.cond77.us
for.cond77.us: ; preds = %for.cond77.us.preheader, %judge.exit.us
%storemerge136.us = phi i32 [ %inc.us, %judge.exit.us ], [ %retval.0.i173, %for.cond77.us.preheader ]
%count.9.us = phi i32 [ %spec.select.us, %judge.exit.us ], [ %count.8, %for.cond77.us.preheader ]
store i32 %storemerge136.us, ptr %arrayidx76, align 4, !tbaa !7
%cmp81.not.us = icmp sgt i32 %storemerge136.us, 9
br i1 %cmp81.not.us, label %for.cond68.backedge, label %for.cond.i.us, !llvm.loop !20
for.cond.i.us: ; preds = %for.cond77.us, %for.cond.i.us
%indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us, %for.cond.i.us ], [ 0, %for.cond77.us ]
%arrayidx.i.us = getelementptr inbounds i32, ptr %i, i64 %indvars.iv.i.us
%47 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !7
%cmp.i.us = icmp eq i32 %47, 0
%indvars.iv.next.i.us = add i64 %indvars.iv.i.us, 1
br i1 %cmp.i.us, label %for.cond.i.us, label %for.cond4.preheader.i.us, !llvm.loop !11
for.cond4.preheader.i.us: ; preds = %for.cond.i.us
%indvars217 = trunc i64 %indvars.iv.i.us to i32
%umax.i.us = call i32 @llvm.umax.i32(i32 %indvars217, i32 9)
%wide.trip.count.i.us = zext i32 %umax.i.us to i64
%umax = call i64 @llvm.umax.i64(i64 %indvars.iv.i.us, i64 9)
br label %for.cond4.i.us
for.cond4.i.us: ; preds = %for.body6.i.us, %for.cond4.preheader.i.us
%indvars.iv33.i.us = phi i64 [ %indvars.iv.i.us, %for.cond4.preheader.i.us ], [ %indvars.iv.next34.i.us, %for.body6.i.us ]
%temp.0.i.us = phi i32 [ %47, %for.cond4.preheader.i.us ], [ %48, %for.body6.i.us ]
%exitcond.i.us = icmp eq i64 %indvars.iv33.i.us, %wide.trip.count.i.us
br i1 %exitcond.i.us, label %judge.exit.us, label %for.body6.i.us
for.body6.i.us: ; preds = %for.cond4.i.us
%indvars.iv.next34.i.us = add nuw i64 %indvars.iv33.i.us, 1
%arrayidx8.i.us = getelementptr inbounds i32, ptr %i, i64 %indvars.iv.next34.i.us
%48 = load i32, ptr %arrayidx8.i.us, align 4, !tbaa !7
%sub.i.us = add i32 %temp.0.i.us, -2
%49 = sub i32 %sub.i.us, %48
%or.cond.i.us = icmp ult i32 %49, -3
br i1 %or.cond.i.us, label %judge.exit.us, label %for.cond4.i.us, !llvm.loop !12
judge.exit.us: ; preds = %for.body6.i.us, %for.cond4.i.us
%indvars.iv33.i.us.lcssa = phi i64 [ %indvars.iv33.i.us, %for.body6.i.us ], [ %umax, %for.cond4.i.us ]
%cmp5.i.us = icmp ugt i64 %indvars.iv33.i.us.lcssa, 8
%add.us = zext i1 %cmp5.i.us to i32
%spec.select.us = add nsw i32 %count.9.us, %add.us
%cmp84.us = icmp eq i32 %spec.select.us, %1
%inc.us = add nsw i32 %storemerge136.us, 1
br i1 %cmp84.us, label %ANS, label %for.cond77.us, !llvm.loop !21
for.cond77: ; preds = %for.body73, %judge.exit
%storemerge136 = phi i32 [ %inc, %judge.exit ], [ %retval.0.i173, %for.body73 ]
%count.9 = phi i32 [ %spec.select, %judge.exit ], [ %count.8, %for.body73 ]
store i32 %storemerge136, ptr %arrayidx76, align 4, !tbaa !7
%cmp81.not = icmp sgt i32 %storemerge136, %add.i176
br i1 %cmp81.not, label %for.cond68.backedge, label %for.cond.i, !llvm.loop !20
for.cond.i: ; preds = %for.cond77, %for.cond.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond.i ], [ 0, %for.cond77 ]
%arrayidx.i = getelementptr inbounds i32, ptr %i, i64 %indvars.iv.i
%50 = load i32, ptr %arrayidx.i, align 4, !tbaa !7
%cmp.i = icmp eq i32 %50, 0
%indvars.iv.next.i = add i64 %indvars.iv.i, 1
br i1 %cmp.i, label %for.cond.i, label %for.cond4.preheader.i, !llvm.loop !11
for.cond4.preheader.i: ; preds = %for.cond.i
%indvars219 = trunc i64 %indvars.iv.i to i32
%umax.i = call i32 @llvm.umax.i32(i32 %indvars219, i32 9)
%wide.trip.count.i = zext i32 %umax.i to i64
%umax221 = call i64 @llvm.umax.i64(i64 %indvars.iv.i, i64 9)
br label %for.cond4.i
for.cond4.i: ; preds = %for.body6.i, %for.cond4.preheader.i
%indvars.iv33.i = phi i64 [ %indvars.iv.i, %for.cond4.preheader.i ], [ %indvars.iv.next34.i, %for.body6.i ]
%temp.0.i = phi i32 [ %50, %for.cond4.preheader.i ], [ %51, %for.body6.i ]
%exitcond.i = icmp eq i64 %indvars.iv33.i, %wide.trip.count.i
br i1 %exitcond.i, label %judge.exit, label %for.body6.i
for.body6.i: ; preds = %for.cond4.i
%indvars.iv.next34.i = add nuw i64 %indvars.iv33.i, 1
%arrayidx8.i = getelementptr inbounds i32, ptr %i, i64 %indvars.iv.next34.i
%51 = load i32, ptr %arrayidx8.i, align 4, !tbaa !7
%sub.i = add i32 %temp.0.i, -2
%52 = sub i32 %sub.i, %51
%or.cond.i = icmp ult i32 %52, -3
br i1 %or.cond.i, label %judge.exit, label %for.cond4.i, !llvm.loop !12
judge.exit: ; preds = %for.cond4.i, %for.body6.i
%indvars.iv33.i.lcssa = phi i64 [ %umax221, %for.cond4.i ], [ %indvars.iv33.i, %for.body6.i ]
%cmp5.i = icmp ugt i64 %indvars.iv33.i.lcssa, 8
%add = zext i1 %cmp5.i to i32
%spec.select = add nsw i32 %count.9, %add
%cmp84 = icmp eq i32 %spec.select, %1
%inc = add nsw i32 %storemerge136, 1
br i1 %cmp84, label %ANS, label %for.cond77, !llvm.loop !21
for.inc120: ; preds = %ub.exit
store i32 %add.i, ptr %i, align 16, !tbaa !7
%exitcond.not = icmp eq i32 %add.i, 10
br i1 %exitcond.not, label %ANS, label %for.body, !llvm.loop !22
ANS: ; preds = %for.inc120, %judge.exit.us, %judge.exit
%53 = phi i32 [ %storemerge136, %judge.exit ], [ %storemerge136.us, %judge.exit.us ], [ %10, %for.inc120 ]
%54 = phi i32 [ %storemerge135, %judge.exit ], [ %storemerge135, %judge.exit.us ], [ %11, %for.inc120 ]
%55 = phi i32 [ %storemerge134, %judge.exit ], [ %storemerge134, %judge.exit.us ], [ %12, %for.inc120 ]
%56 = phi i32 [ %storemerge133, %judge.exit ], [ %storemerge133, %judge.exit.us ], [ %13, %for.inc120 ]
%57 = phi i32 [ %storemerge132, %judge.exit ], [ %storemerge132, %judge.exit.us ], [ %14, %for.inc120 ]
%58 = phi i32 [ %storemerge131, %judge.exit ], [ %storemerge131, %judge.exit.us ], [ %15, %for.inc120 ]
%59 = phi i32 [ %storemerge130, %judge.exit ], [ %storemerge130, %judge.exit.us ], [ %16, %for.inc120 ]
%60 = phi i32 [ %storemerge129, %judge.exit ], [ %storemerge129, %judge.exit.us ], [ %17, %for.inc120 ]
%storemerge189 = phi i32 [ %storemerge191, %judge.exit ], [ %storemerge191, %judge.exit.us ], [ 10, %for.inc120 ]
%conv.i = zext i32 %storemerge189 to i64
%mul.1.i = mul nuw nsw i64 %conv.i, 10
%conv.1.i = zext i32 %18 to i64
%add.1.i = add nuw nsw i64 %mul.1.i, %conv.1.i
%mul.2.i = mul nuw nsw i64 %add.1.i, 10
%conv.2.i = sext i32 %60 to i64
%add.2.i = add nsw i64 %mul.2.i, %conv.2.i
%mul.3.i = mul nsw i64 %add.2.i, 10
%conv.3.i = sext i32 %59 to i64
%add.3.i = add nsw i64 %mul.3.i, %conv.3.i
%mul.4.i = mul nsw i64 %add.3.i, 10
%conv.4.i = sext i32 %58 to i64
%add.4.i = add nsw i64 %mul.4.i, %conv.4.i
%mul.5.i = mul nsw i64 %add.4.i, 10
%conv.5.i = sext i32 %57 to i64
%add.5.i = add nsw i64 %mul.5.i, %conv.5.i
%mul.6.i = mul nsw i64 %add.5.i, 10
%conv.6.i = sext i32 %56 to i64
%add.6.i = add nsw i64 %mul.6.i, %conv.6.i
%mul.7.i = mul nsw i64 %add.6.i, 10
%conv.7.i = sext i32 %55 to i64
%add.7.i = add nsw i64 %mul.7.i, %conv.7.i
%mul.8.i = mul nsw i64 %add.7.i, 10
%conv.8.i = sext i32 %54 to i64
%add.8.i = add nsw i64 %mul.8.i, %conv.8.i
%mul.9.i = mul nsw i64 %add.8.i, 10
%conv.9.i = sext i32 %53 to i64
%add.9.i = add nsw i64 %mul.9.i, %conv.9.i
%call126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add.9.i)
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %i) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.usub.sat.i32(i32, i32) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #8
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { 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 #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
|
#include <stdio.h>
#define MOD 998244353LL
long long f[200001];
long long power(long long x, long long n){
long long res;
if(n==0){
return 1;
}
if(n==1){
return x%MOD;
}
res=power(x, n/2);
res%=MOD;
res*=res;
res%=MOD;
if(n & 1LL){
res*=x;
res%=MOD;
}
return res%MOD;
}
long long fibo(){
int i;
for(i=3; i<=200000; ++i){
f[i]=f[i-2]+f[i-1];
f[i]%=MOD;
}
}
int main(void){
long long N, res;
scanf("%lld", &N);
if(N==1){
printf("%lld", power(2, MOD-2)%MOD);
return 0;
}
else if(N==2){
printf("%lld", power(4, MOD-2)%MOD);
return 0;
}
f[1]=f[2]=1;
fibo();
res=((f[N]%MOD)*(power(power(2, N)%MOD, MOD-2)%MOD))%MOD;
//(2*N-5)/2^N
printf("%lld", res);
return 0;
}
/*
x^MOD == x (mod MOD)
x^(MOD-1) == 1 (mod MOD)
x * x^(MOD-2) == 1 (mod MOD)
2*N-5 mod MOD * (2^N)^-1 mod MOD
*/ | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_22949/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_22949/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@f = dso_local local_unnamed_addr global [200001 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @power(i64 noundef %x, i64 noundef %n) local_unnamed_addr #0 {
entry:
switch i64 %n, label %if.end3 [
i64 0, label %cleanup
i64 1, label %if.then2
]
if.then2: ; preds = %entry
%rem = srem i64 %x, 998244353
br label %cleanup
if.end3: ; preds = %entry
%div = sdiv i64 %n, 2
%call = tail call i64 @power(i64 noundef %x, i64 noundef %div), !range !5
%mul = mul nsw i64 %call, %call
%rem5 = urem i64 %mul, 998244353
%and = and i64 %n, 1
%tobool.not = icmp eq i64 %and, 0
br i1 %tobool.not, label %cleanup, label %if.then6
if.then6: ; preds = %if.end3
%mul7 = mul nsw i64 %rem5, %x
%rem8 = srem i64 %mul7, 998244353
br label %cleanup
cleanup: ; preds = %if.end3, %if.then6, %entry, %if.then2
%retval.0 = phi i64 [ %rem, %if.then2 ], [ 1, %entry ], [ %rem8, %if.then6 ], [ %rem5, %if.end3 ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @fibo() local_unnamed_addr #2 {
entry:
%.pre = load i64, ptr getelementptr inbounds ([200001 x i64], ptr @f, i64 0, i64 1), align 8, !tbaa !6
%.pre17 = load i64, ptr getelementptr inbounds ([200001 x i64], ptr @f, i64 0, i64 2), align 16, !tbaa !6
br label %for.body
for.body: ; preds = %for.body, %entry
%0 = phi i64 [ %.pre17, %entry ], [ %rem.1, %for.body ]
%1 = phi i64 [ %.pre, %entry ], [ %rem, %for.body ]
%indvars.iv = phi i64 [ 3, %entry ], [ %indvars.iv.next.1, %for.body ]
%add = add nsw i64 %0, %1
%arrayidx5 = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %indvars.iv
%rem = srem i64 %add, 998244353
store i64 %rem, ptr %arrayidx5, align 8, !tbaa !6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%add.1 = add nsw i64 %rem, %0
%arrayidx5.1 = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %indvars.iv.next
%rem.1 = srem i64 %add.1, 998244353
store i64 %rem.1, ptr %arrayidx5.1, align 8, !tbaa !6
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 200001
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body
ret i64 undef
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !6
switch i64 %0, label %if.end8 [
i64 1, label %if.then
i64 2, label %if.then4
]
if.then: ; preds = %entry
%call1 = call i64 @power(i64 noundef 2, i64 noundef 998244351), !range !5
br label %cleanup
if.then4: ; preds = %entry
%call5 = call i64 @power(i64 noundef 4, i64 noundef 998244351), !range !5
br label %cleanup
if.end8: ; preds = %entry
store i64 1, ptr getelementptr inbounds ([200001 x i64], ptr @f, i64 0, i64 2), align 16, !tbaa !6
store i64 1, ptr getelementptr inbounds ([200001 x i64], ptr @f, i64 0, i64 1), align 8, !tbaa !6
br label %for.body.i
for.body.i: ; preds = %for.body.i, %if.end8
%1 = phi i64 [ 1, %if.end8 ], [ %rem.i.1, %for.body.i ]
%2 = phi i64 [ 1, %if.end8 ], [ %rem.i, %for.body.i ]
%indvars.iv.i = phi i64 [ 3, %if.end8 ], [ %indvars.iv.next.i.1, %for.body.i ]
%add.i = add nsw i64 %2, %1
%arrayidx5.i = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %indvars.iv.i
%rem.i = srem i64 %add.i, 998244353
store i64 %rem.i, ptr %arrayidx5.i, align 8, !tbaa !6
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%add.i.1 = add nsw i64 %1, %rem.i
%arrayidx5.i.1 = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %indvars.iv.next.i
%rem.i.1 = srem i64 %add.i.1, 998244353
store i64 %rem.i.1, ptr %arrayidx5.i.1, align 8, !tbaa !6
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%exitcond.not.i.1 = icmp eq i64 %indvars.iv.next.i.1, 200001
br i1 %exitcond.not.i.1, label %fibo.exit, label %for.body.i, !llvm.loop !10
fibo.exit: ; preds = %for.body.i
%arrayidx = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %0
%3 = load i64, ptr %arrayidx, align 8, !tbaa !6
%rem10 = srem i64 %3, 998244353
%call11 = call i64 @power(i64 noundef 2, i64 noundef %0), !range !5
%call13 = call i64 @power(i64 noundef %call11, i64 noundef 998244351), !range !5
%mul = mul nsw i64 %call13, %rem10
%rem15 = srem i64 %mul, 998244353
br label %cleanup
cleanup: ; preds = %fibo.exit, %if.then4, %if.then
%rem15.sink = phi i64 [ %rem15, %fibo.exit ], [ %call5, %if.then4 ], [ %call1, %if.then ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %rem15.sink)
call void @llvm.lifetime.end.p0(i64 8, 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 nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{i64 -998244352, i64 998244353}
!6 = !{!7, !7, i64 0}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5
#define PI 3.141592653589793238
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
void cin(ll *n){ scanf("%lld",&(*n)); }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
double POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }
void lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
void lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
int cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }
int cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a<b ? 1 : 0 ) ; }
// return smallest p which meets a[p]==val :1 >=:2 >:3
ll lower_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type); return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1; }
// return biggest p which meets a[p]==val :1 <=:2 <:3
ll upper_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }
// count i which meets ai==x
ll count(ll a[], int l, int r, ll x){ int p = lower_bound(a,l,r,x,1); return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }
ll *factors[2] , fac_cnt=0;
ll factor_pre(ll x){ factors[0] = realloc( factors[0] , sizeof(ll) ); factors[1] = realloc( factors[1] , sizeof(ll) ); factors[0][fac_cnt]=2; factors[1][fac_cnt++]=0; repp(i,3,x+1,2) rep(j,0,fac_cnt) if( !(i%factors[0][j]) ){break;} else if(factors[0][j]*factors[0][j]>i){ factors[0] = realloc( factors[0] , sizeof(ll)*( fac_cnt +1 ) ); factors[1] = realloc( factors[1] , sizeof(ll)*( fac_cnt +1 ) ); factors[0][fac_cnt]=i; factors[1][fac_cnt++]=0; break; } return 0; }
ll factor(ll n, ll is_update){ rep(i,0,fac_cnt){ ll cnt=0; rep(j,0,1){ while( ( cnt+= n %factors[0][i]==0 ? 1 : 0 ) && (n/=factors[0][i]) %factors[0][i]==0 ) continue;} factors[1][i]= is_update ? cnt : max2(factors[1][i],cnt); if( factors[1][i]*factors[1][i] > n ) break; } return n; }
ll jud_prime(ll n){ rep(i,0,fac_cnt){ if(n<factors[0][i]*factors[0][i] || n==factors[0][i]) break; else if(n%factors[0][i]==0) n/=n; } return n==1?0:1; }
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
int cmp_string( const void * a , const void * b ) { return strcmp( (char *)a , (char *)b ); } // qsort((void*)s,n,sizeof(s[0]),int_sort );
int cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
void sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }
void sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }
ll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }
ll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }
typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}
ll ans[100005];
int main(void){
// fgets(s,sizeof(s),stdin);
// char ;
ll q;
// ll ans=0;
cin(&q);
ll l,r;
factor_pre(1e5);
repp(i,1,1e5+1,2){
ans[i]=jud_prime(i)*jud_prime((i+1)/2);
}
rep(i,1,1e5+1){
ans[i]+=ans[i-1];
}
// rep(i,0,10) printf("%lld ",ans[i]);
// PN;
// rep(i,0,10) printf("%lld ",jud_prime(i+1) );
// PN;
rep(i,0,q){
cin(&l);
cin(&r);
printf("%lld\n",ans[r]-ans[l-1]);
}
// printf("%lld\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229532/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229532/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@fac_cnt = dso_local local_unnamed_addr global i64 0, align 8
@factors = dso_local local_unnamed_addr global [2 x ptr] zeroinitializer, align 16
@ans = dso_local local_unnamed_addr global [100005 x i64] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @cin(ptr noundef %n) local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %n)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #4 {
entry:
%cmp.not = icmp sgt i64 %a, %b
%cmp1.not = icmp sgt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smin.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #4 {
entry:
%cmp.not = icmp slt i64 %a, %b
%cmp1.not = icmp slt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smax.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @minn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #5 {
entry:
%cmp4 = icmp sgt i64 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi7 = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load8 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi7, <2 x i64> %wide.load8)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.06.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.05.ph = phi i64 [ 1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ 1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader9, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ %i.06.ph, %for.body.preheader9 ]
%b.05 = phi i64 [ %cond.i, %for.body ], [ %b.05.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.06
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smin.i64(i64 %b.05, i64 %6)
%inc = add nuw nsw i64 %i.06, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @maxn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #5 {
entry:
%cmp4 = icmp sgt i64 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi7 = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load8 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi7, <2 x i64> %wide.load8)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.06.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.05.ph = phi i64 [ -1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ -1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader9, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ %i.06.ph, %for.body.preheader9 ]
%b.05 = phi i64 [ %cond.i, %for.body ], [ %b.05.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.06
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %b.05, i64 %6)
%inc = add nuw nsw i64 %i.06, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @POW(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%c.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%c.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %c.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %c.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !16
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%c.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %c.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%c.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %c.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local double @POW_d(double noundef %a, double noundef %b) local_unnamed_addr #6 {
entry:
%cmp4 = fcmp ogt double %b, 0.000000e+00
br i1 %cmp4, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%c.0.lcssa = phi double [ 1.000000e+00, %entry ], [ %mul, %for.body ]
ret double %c.0.lcssa
for.body: ; preds = %entry, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%c.05 = phi double [ %mul, %for.body ], [ 1.000000e+00, %entry ]
%mul = fmul double %c.05, %a
%inc = add nuw nsw i64 %i.06, 1
%conv = sitofp i64 %inc to double
%cmp = fcmp olt double %conv, %b
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !19
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_MOD1(i64 noundef %n) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%n.nonneg = sub i64 0, %n
%0 = urem i64 %n.nonneg, 1000000007
%1 = add nsw i64 %0, %n
%mul = sub i64 1000000007, %1
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, 1000000007
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_p(i64 noundef %n, i64 noundef %p) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%div7 = sdiv i64 %n, %p
%add = sub i64 1, %div7
%mul = mul nsw i64 %add, %p
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, %p
ret i64 %rem
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @change_into_num(ptr nocapture noundef readonly %s, i64 noundef %len, i64 noundef %p) local_unnamed_addr #8 {
entry:
%tobool.not11 = icmp eq i64 %p, 0
br i1 %tobool.not11, label %cond.end, label %cond.false.preheader
cond.false.preheader: ; preds = %entry
%0 = add i64 %p, -2
br label %cond.false
cond.false: ; preds = %cond.false.preheader, %POW.exit
%indvar = phi i64 [ 0, %cond.false.preheader ], [ %indvar.next, %POW.exit ]
%p.tr13 = phi i64 [ %p, %cond.false.preheader ], [ %sub, %POW.exit ]
%accumulator.tr12 = phi i64 [ 0, %cond.false.preheader ], [ %add, %POW.exit ]
%1 = xor i64 %indvar, -1
%2 = add i64 %1, %p
%sub = add nsw i64 %p.tr13, -1
%cmp3.i = icmp sgt i64 %p.tr13, 1
br i1 %cmp3.i, label %for.body.i.preheader, label %POW.exit
for.body.i.preheader: ; preds = %cond.false
%3 = sub i64 %0, %indvar
%xtraiter = and i64 %2, 7
%4 = icmp ult i64 %3, 7
br i1 %4, label %POW.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %2, -8
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%c.04.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul.i.7, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.7, %for.body.i ]
%mul.i.7 = mul i64 %c.04.i, 100000000
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %POW.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !18
POW.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%mul.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%c.04.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %POW.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil
%c.04.i.epil = phi i64 [ %mul.i.epil, %for.body.i.epil ], [ %c.04.i.unr, %POW.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %POW.exit.loopexit.unr-lcssa ]
%mul.i.epil = mul nsw i64 %c.04.i.epil, 10
%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 %POW.exit, label %for.body.i.epil, !llvm.loop !20
POW.exit: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil, %cond.false
%c.0.lcssa.i = phi i64 [ 1, %cond.false ], [ %mul.i.lcssa.ph, %POW.exit.loopexit.unr-lcssa ], [ %mul.i.epil, %for.body.i.epil ]
%sub1 = sub nsw i64 %len, %p.tr13
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %sub1
%5 = load i8, ptr %arrayidx, align 1, !tbaa !21
%conv = sext i8 %5 to i64
%sub2 = add nsw i64 %conv, -48
%mul = mul nsw i64 %sub2, %c.0.lcssa.i
%add = add nsw i64 %mul, %accumulator.tr12
%tobool.not = icmp eq i64 %sub, 0
%indvar.next = add i64 %indvar, 1
br i1 %tobool.not, label %cond.end, label %cond.false
cond.end: ; preds = %POW.exit, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %POW.exit ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @lr_lower(ptr nocapture noundef %l, ptr nocapture noundef %r, i64 noundef %am, i64 noundef %val, i32 noundef %type) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %type, 3
%0 = load i32, ptr %l, align 4, !tbaa !22
%1 = load i32, ptr %r, align 4, !tbaa !22
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%cmp1 = icmp slt i64 %am, %val
%l.r = select i1 %cmp1, ptr %l, ptr %r
%cmp6.not = icmp sgt i64 %am, %val
%r.l = select i1 %cmp6.not, ptr %r, ptr %l
%l.sink = select i1 %cmp, ptr %l.r, ptr %r.l
store i32 %div, ptr %l.sink, align 4, !tbaa !22
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @lr_upper(ptr nocapture noundef %l, ptr nocapture noundef %r, i64 noundef %am, i64 noundef %val, i32 noundef %type) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %type, 3
%0 = load i32, ptr %l, align 4, !tbaa !22
%1 = load i32, ptr %r, align 4, !tbaa !22
%add3 = add nsw i32 %1, %0
%div4 = sdiv i32 %add3, 2
%cmp1.not = icmp sgt i64 %am, %val
%r.l = select i1 %cmp1.not, ptr %r, ptr %l
%cmp6 = icmp slt i64 %am, %val
%l.r = select i1 %cmp6, ptr %l, ptr %r
%l.sink = select i1 %cmp, ptr %r.l, ptr %l.r
store i32 %div4, ptr %l.sink, align 4, !tbaa !22
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @cmp_lower(i64 noundef %a, i64 noundef %b, i32 noundef %type) local_unnamed_addr #7 {
entry:
switch i32 %type, label %cond.false6 [
i32 1, label %cond.true
i32 2, label %cond.true3
]
cond.true: ; preds = %entry
%cmp1 = icmp eq i64 %a, %b
br label %cond.end10
cond.true3: ; preds = %entry
%cmp4.not = icmp sge i64 %a, %b
br label %cond.end10
cond.false6: ; preds = %entry
%cmp7 = icmp sgt i64 %a, %b
br label %cond.end10
cond.end10: ; preds = %cond.true3, %cond.false6, %cond.true
%cond11.in = phi i1 [ %cmp1, %cond.true ], [ %cmp4.not, %cond.true3 ], [ %cmp7, %cond.false6 ]
%cond11 = zext i1 %cond11.in to i32
ret i32 %cond11
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @cmp_upper(i64 noundef %a, i64 noundef %b, i32 noundef %type) local_unnamed_addr #7 {
entry:
switch i32 %type, label %cond.false6 [
i32 1, label %cond.true
i32 2, label %cond.true3
]
cond.true: ; preds = %entry
%cmp1 = icmp eq i64 %a, %b
br label %cond.end10
cond.true3: ; preds = %entry
%cmp4.not = icmp sle i64 %a, %b
br label %cond.end10
cond.false6: ; preds = %entry
%cmp7 = icmp slt i64 %a, %b
br label %cond.end10
cond.end10: ; preds = %cond.true3, %cond.false6, %cond.true
%cond11.in = phi i1 [ %cmp1, %cond.true ], [ %cmp4.not, %cond.true3 ], [ %cmp7, %cond.false6 ]
%cond11 = zext i1 %cond11.in to i32
ret i32 %cond11
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @lower_bound(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %val, i32 noundef %type) local_unnamed_addr #8 {
entry:
%sub34 = sub nsw i32 %r, %l
%cmp35 = icmp sgt i32 %sub34, 1
br i1 %cmp35, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp.i = icmp slt i32 %type, 3
br i1 %cmp.i, label %while.body.us, label %while.body
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%l.addr.0 = phi i32 [ %spec.select, %while.body.us ], [ %l, %while.body.lr.ph ]
%r.addr.0 = phi i32 [ %spec.select51, %while.body.us ], [ %r, %while.body.lr.ph ]
%add.us = add nsw i32 %l.addr.0, %r.addr.0
%div.us = sdiv i32 %add.us, 2
%idxprom.us = sext i32 %div.us to i64
%arrayidx.us = getelementptr inbounds i64, ptr %a, i64 %idxprom.us
%0 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%cmp1.i.us = icmp slt i64 %0, %val
%spec.select = select i1 %cmp1.i.us, i32 %div.us, i32 %l.addr.0
%spec.select51 = select i1 %cmp1.i.us, i32 %r.addr.0, i32 %div.us
%sub.us = sub nsw i32 %spec.select51, %spec.select
%cmp.us = icmp sgt i32 %sub.us, 1
br i1 %cmp.us, label %while.body.us, label %while.end, !llvm.loop !24
while.body: ; preds = %while.body.lr.ph, %while.body
%l.addr.2 = phi i32 [ %spec.select52, %while.body ], [ %l, %while.body.lr.ph ]
%r.addr.2 = phi i32 [ %spec.select53, %while.body ], [ %r, %while.body.lr.ph ]
%add = add nsw i32 %l.addr.2, %r.addr.2
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp6.not.i = icmp sgt i64 %1, %val
%spec.select52 = select i1 %cmp6.not.i, i32 %l.addr.2, i32 %div
%spec.select53 = select i1 %cmp6.not.i, i32 %div, i32 %r.addr.2
%sub = sub nsw i32 %spec.select53, %spec.select52
%cmp = icmp sgt i32 %sub, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !24
while.end: ; preds = %while.body, %while.body.us, %entry
%r.addr.0..lcssa = phi i32 [ %r, %entry ], [ %spec.select51, %while.body.us ], [ %spec.select53, %while.body ]
%l.addr.0..lcssa = phi i32 [ %l, %entry ], [ %spec.select, %while.body.us ], [ %spec.select52, %while.body ]
%idxprom1 = sext i32 %l.addr.0..lcssa to i64
%arrayidx2 = getelementptr inbounds i64, ptr %a, i64 %idxprom1
%2 = load i64, ptr %arrayidx2, align 8, !tbaa !5
switch i32 %type, label %cmp_lower.exit [
i32 1, label %cond.true.i
i32 2, label %cond.true3.i
]
cond.true.i: ; preds = %while.end
%cmp1.i17 = icmp eq i64 %2, %val
br i1 %cmp1.i17, label %cond.end9, label %cond.false.thread
cond.false.thread: ; preds = %cond.true.i
%idxprom345 = sext i32 %r.addr.0..lcssa to i64
%arrayidx446 = getelementptr inbounds i64, ptr %a, i64 %idxprom345
%3 = load i64, ptr %arrayidx446, align 8, !tbaa !5
%cmp1.i23 = icmp eq i64 %3, %val
br label %cmp_lower.exit26
cond.true3.i: ; preds = %while.end
%cmp4.not.i.not = icmp slt i64 %2, %val
br i1 %cmp4.not.i.not, label %cond.false.thread47, label %cond.end9
cond.false.thread47: ; preds = %cond.true3.i
%idxprom348 = sext i32 %r.addr.0..lcssa to i64
%arrayidx449 = getelementptr inbounds i64, ptr %a, i64 %idxprom348
%4 = load i64, ptr %arrayidx449, align 8, !tbaa !5
%cmp4.not.i19 = icmp sge i64 %4, %val
br label %cmp_lower.exit26
cmp_lower.exit: ; preds = %while.end
%cmp7.i = icmp sgt i64 %2, %val
br i1 %cmp7.i, label %cond.end9, label %cond.false
cond.false: ; preds = %cmp_lower.exit
%idxprom3 = sext i32 %r.addr.0..lcssa to i64
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %idxprom3
%5 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp7.i25 = icmp sgt i64 %5, %val
br label %cmp_lower.exit26
cmp_lower.exit26: ; preds = %cond.false.thread, %cond.false.thread47, %cond.false
%cond11.in.i20 = phi i1 [ %cmp1.i23, %cond.false.thread ], [ %cmp4.not.i19, %cond.false.thread47 ], [ %cmp7.i25, %cond.false ]
%6 = sext i32 %r.addr.0..lcssa to i64
%.pre = select i1 %cond11.in.i20, i64 %6, i64 -1
br label %cond.end9
cond.end9: ; preds = %cond.true3.i, %cond.true.i, %cmp_lower.exit, %cmp_lower.exit26
%conv.pre-phi = phi i64 [ %idxprom1, %cmp_lower.exit ], [ %.pre, %cmp_lower.exit26 ], [ %idxprom1, %cond.true.i ], [ %idxprom1, %cond.true3.i ]
ret i64 %conv.pre-phi
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @upper_bound(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %val, i32 noundef %type) local_unnamed_addr #8 {
entry:
%sub33 = sub nsw i32 %r, %l
%cmp34 = icmp sgt i32 %sub33, 1
br i1 %cmp34, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp.i = icmp slt i32 %type, 3
br i1 %cmp.i, label %while.body.us, label %while.body
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%l.addr.0 = phi i32 [ %spec.select, %while.body.us ], [ %l, %while.body.lr.ph ]
%r.addr.0 = phi i32 [ %spec.select50, %while.body.us ], [ %r, %while.body.lr.ph ]
%add.us = add nsw i32 %l.addr.0, %r.addr.0
%div.us = sdiv i32 %add.us, 2
%idxprom.us = sext i32 %div.us to i64
%arrayidx.us = getelementptr inbounds i64, ptr %a, i64 %idxprom.us
%0 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%cmp1.not.i.us = icmp sgt i64 %0, %val
%spec.select = select i1 %cmp1.not.i.us, i32 %l.addr.0, i32 %div.us
%spec.select50 = select i1 %cmp1.not.i.us, i32 %div.us, i32 %r.addr.0
%sub.us = sub nsw i32 %spec.select50, %spec.select
%cmp.us = icmp sgt i32 %sub.us, 1
br i1 %cmp.us, label %while.body.us, label %while.end, !llvm.loop !25
while.body: ; preds = %while.body.lr.ph, %while.body
%l.addr.2 = phi i32 [ %spec.select51, %while.body ], [ %l, %while.body.lr.ph ]
%r.addr.2 = phi i32 [ %spec.select52, %while.body ], [ %r, %while.body.lr.ph ]
%add = add nsw i32 %l.addr.2, %r.addr.2
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp6.i = icmp slt i64 %1, %val
%spec.select51 = select i1 %cmp6.i, i32 %div, i32 %l.addr.2
%spec.select52 = select i1 %cmp6.i, i32 %r.addr.2, i32 %div
%sub = sub nsw i32 %spec.select52, %spec.select51
%cmp = icmp sgt i32 %sub, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !25
while.end: ; preds = %while.body, %while.body.us, %entry
%r.addr.0..lcssa = phi i32 [ %r, %entry ], [ %spec.select50, %while.body.us ], [ %spec.select52, %while.body ]
%l.addr.0..lcssa = phi i32 [ %l, %entry ], [ %spec.select, %while.body.us ], [ %spec.select51, %while.body ]
%idxprom1 = sext i32 %r.addr.0..lcssa to i64
%arrayidx2 = getelementptr inbounds i64, ptr %a, i64 %idxprom1
%2 = load i64, ptr %arrayidx2, align 8, !tbaa !5
switch i32 %type, label %cmp_upper.exit [
i32 1, label %cond.true.i
i32 2, label %cond.true3.i
]
cond.true.i: ; preds = %while.end
%cmp1.i = icmp eq i64 %2, %val
br i1 %cmp1.i, label %cond.end9, label %cond.false.thread
cond.false.thread: ; preds = %cond.true.i
%idxprom344 = sext i32 %l.addr.0..lcssa to i64
%arrayidx445 = getelementptr inbounds i64, ptr %a, i64 %idxprom344
%3 = load i64, ptr %arrayidx445, align 8, !tbaa !5
%cmp1.i22 = icmp eq i64 %3, %val
br label %cmp_upper.exit25
cond.true3.i: ; preds = %while.end
%cmp4.not.i.not = icmp sgt i64 %2, %val
br i1 %cmp4.not.i.not, label %cond.false.thread46, label %cond.end9
cond.false.thread46: ; preds = %cond.true3.i
%idxprom347 = sext i32 %l.addr.0..lcssa to i64
%arrayidx448 = getelementptr inbounds i64, ptr %a, i64 %idxprom347
%4 = load i64, ptr %arrayidx448, align 8, !tbaa !5
%cmp4.not.i18 = icmp sle i64 %4, %val
br label %cmp_upper.exit25
cmp_upper.exit: ; preds = %while.end
%cmp7.i = icmp slt i64 %2, %val
br i1 %cmp7.i, label %cond.end9, label %cond.false
cond.false: ; preds = %cmp_upper.exit
%idxprom3 = sext i32 %l.addr.0..lcssa to i64
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %idxprom3
%5 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp7.i24 = icmp slt i64 %5, %val
br label %cmp_upper.exit25
cmp_upper.exit25: ; preds = %cond.false.thread, %cond.false.thread46, %cond.false
%cond11.in.i19 = phi i1 [ %cmp1.i22, %cond.false.thread ], [ %cmp4.not.i18, %cond.false.thread46 ], [ %cmp7.i24, %cond.false ]
%6 = sext i32 %l.addr.0..lcssa to i64
%.pre = select i1 %cond11.in.i19, i64 %6, i64 -1
br label %cond.end9
cond.end9: ; preds = %cond.true3.i, %cond.true.i, %cmp_upper.exit, %cmp_upper.exit25
%conv.pre-phi = phi i64 [ %idxprom1, %cmp_upper.exit ], [ %.pre, %cmp_upper.exit25 ], [ %idxprom1, %cond.true.i ], [ %idxprom1, %cond.true3.i ]
ret i64 %conv.pre-phi
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @count(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %x) local_unnamed_addr #8 {
entry:
%sub34.i = sub nsw i32 %r, %l
%cmp35.i = icmp sgt i32 %sub34.i, 1
br i1 %cmp35.i, label %while.body.us.i, label %while.end.i
while.body.us.i: ; preds = %entry, %while.body.us.i
%l.addr.0.i = phi i32 [ %spec.select.i, %while.body.us.i ], [ %l, %entry ]
%r.addr.0.i = phi i32 [ %spec.select51.i, %while.body.us.i ], [ %r, %entry ]
%add.us.i = add nsw i32 %r.addr.0.i, %l.addr.0.i
%div.us.i = sdiv i32 %add.us.i, 2
%idxprom.us.i = sext i32 %div.us.i to i64
%arrayidx.us.i = getelementptr inbounds i64, ptr %a, i64 %idxprom.us.i
%0 = load i64, ptr %arrayidx.us.i, align 8, !tbaa !5
%cmp1.i.us.i = icmp slt i64 %0, %x
%spec.select.i = select i1 %cmp1.i.us.i, i32 %div.us.i, i32 %l.addr.0.i
%spec.select51.i = select i1 %cmp1.i.us.i, i32 %r.addr.0.i, i32 %div.us.i
%sub.us.i = sub nsw i32 %spec.select51.i, %spec.select.i
%cmp.us.i = icmp sgt i32 %sub.us.i, 1
br i1 %cmp.us.i, label %while.body.us.i, label %while.end.i, !llvm.loop !24
while.end.i: ; preds = %while.body.us.i, %entry
%r.addr.0..lcssa.i = phi i32 [ %r, %entry ], [ %spec.select51.i, %while.body.us.i ]
%l.addr.0..lcssa.i = phi i32 [ %l, %entry ], [ %spec.select.i, %while.body.us.i ]
%idxprom1.i = sext i32 %l.addr.0..lcssa.i to i64
%arrayidx2.i = getelementptr inbounds i64, ptr %a, i64 %idxprom1.i
%1 = load i64, ptr %arrayidx2.i, align 8, !tbaa !5
%cmp1.i17.i = icmp eq i64 %1, %x
br i1 %cmp1.i17.i, label %lower_bound.exit, label %cond.false.thread.i
cond.false.thread.i: ; preds = %while.end.i
%idxprom345.i = sext i32 %r.addr.0..lcssa.i to i64
%arrayidx446.i = getelementptr inbounds i64, ptr %a, i64 %idxprom345.i
%2 = load i64, ptr %arrayidx446.i, align 8, !tbaa !5
%cmp1.i23.i = icmp eq i64 %2, %x
%.pre.i = select i1 %cmp1.i23.i, i64 %idxprom345.i, i64 -1
br label %lower_bound.exit
lower_bound.exit: ; preds = %while.end.i, %cond.false.thread.i
%conv.pre-phi.i = phi i64 [ %.pre.i, %cond.false.thread.i ], [ %idxprom1.i, %while.end.i ]
%conv = trunc i64 %conv.pre-phi.i to i32
%cmp = icmp eq i32 %conv, -1
br i1 %cmp, label %cond.end, label %cond.false
cond.false: ; preds = %lower_bound.exit
%sub33.i = sub nsw i32 %r, %conv
%cmp34.i = icmp sgt i32 %sub33.i, 1
br i1 %cmp34.i, label %while.body.us.i18, label %while.end.i9
while.body.us.i18: ; preds = %cond.false, %while.body.us.i18
%l.addr.0.i19 = phi i32 [ %spec.select.i25, %while.body.us.i18 ], [ %conv, %cond.false ]
%r.addr.0.i20 = phi i32 [ %spec.select50.i, %while.body.us.i18 ], [ %r, %cond.false ]
%add.us.i21 = add nsw i32 %r.addr.0.i20, %l.addr.0.i19
%div.us.i22 = sdiv i32 %add.us.i21, 2
%idxprom.us.i23 = sext i32 %div.us.i22 to i64
%arrayidx.us.i24 = getelementptr inbounds i64, ptr %a, i64 %idxprom.us.i23
%3 = load i64, ptr %arrayidx.us.i24, align 8, !tbaa !5
%cmp1.not.i.us.i = icmp sgt i64 %3, %x
%spec.select.i25 = select i1 %cmp1.not.i.us.i, i32 %l.addr.0.i19, i32 %div.us.i22
%spec.select50.i = select i1 %cmp1.not.i.us.i, i32 %div.us.i22, i32 %r.addr.0.i20
%sub.us.i26 = sub nsw i32 %spec.select50.i, %spec.select.i25
%cmp.us.i27 = icmp sgt i32 %sub.us.i26, 1
br i1 %cmp.us.i27, label %while.body.us.i18, label %while.end.i9, !llvm.loop !25
while.end.i9: ; preds = %while.body.us.i18, %cond.false
%r.addr.0..lcssa.i10 = phi i32 [ %r, %cond.false ], [ %spec.select50.i, %while.body.us.i18 ]
%l.addr.0..lcssa.i11 = phi i32 [ %conv, %cond.false ], [ %spec.select.i25, %while.body.us.i18 ]
%idxprom1.i12 = sext i32 %r.addr.0..lcssa.i10 to i64
%arrayidx2.i13 = getelementptr inbounds i64, ptr %a, i64 %idxprom1.i12
%4 = load i64, ptr %arrayidx2.i13, align 8, !tbaa !5
%cmp1.i.i = icmp eq i64 %4, %x
br i1 %cmp1.i.i, label %upper_bound.exit, label %cond.false.thread.i14
cond.false.thread.i14: ; preds = %while.end.i9
%idxprom344.i = sext i32 %l.addr.0..lcssa.i11 to i64
%arrayidx445.i = getelementptr inbounds i64, ptr %a, i64 %idxprom344.i
%5 = load i64, ptr %arrayidx445.i, align 8, !tbaa !5
%cmp1.i22.i = icmp eq i64 %5, %x
%.pre.i15 = select i1 %cmp1.i22.i, i64 %idxprom344.i, i64 -1
br label %upper_bound.exit
upper_bound.exit: ; preds = %while.end.i9, %cond.false.thread.i14
%conv.pre-phi.i16 = phi i64 [ %.pre.i15, %cond.false.thread.i14 ], [ %idxprom1.i12, %while.end.i9 ]
%reass.sub = sub nsw i64 %conv.pre-phi.i16, %conv.pre-phi.i
%add = add nsw i64 %reass.sub, 1
br label %cond.end
cond.end: ; preds = %lower_bound.exit, %upper_bound.exit
%cond = phi i64 [ %add, %upper_bound.exit ], [ 0, %lower_bound.exit ]
ret i64 %cond
}
; Function Attrs: nounwind uwtable
define dso_local i64 @factor_pre(i64 noundef %x) local_unnamed_addr #10 {
entry:
%0 = load ptr, ptr @factors, align 16, !tbaa !26
%call = tail call dereferenceable_or_null(8) ptr @realloc(ptr noundef %0, i64 noundef 8) #20
store ptr %call, ptr @factors, align 16, !tbaa !26
%1 = load ptr, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8, !tbaa !26
%call1 = tail call dereferenceable_or_null(8) ptr @realloc(ptr noundef %1, i64 noundef 8) #20
store ptr %call1, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8, !tbaa !26
%2 = load ptr, ptr @factors, align 16, !tbaa !26
%3 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%arrayidx = getelementptr inbounds i64, ptr %2, i64 %3
store i64 2, ptr %arrayidx, align 8, !tbaa !5
%4 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%inc = add nsw i64 %4, 1
store i64 %inc, ptr @fac_cnt, align 8, !tbaa !5
%arrayidx2 = getelementptr inbounds i64, ptr %call1, i64 %4
store i64 0, ptr %arrayidx2, align 8, !tbaa !5
%cmp.not39 = icmp sgt i64 %x, 2
%5 = icmp sgt i64 %4, -1
%or.cond = and i1 %cmp.not39, %5
br i1 %or.cond, label %for.cond3.preheader, label %for.cond.cleanup
for.cond3.preheader: ; preds = %entry, %cleanup
%6 = phi ptr [ %14, %cleanup ], [ %2, %entry ]
%7 = phi i64 [ %15, %cleanup ], [ %inc, %entry ]
%i.040 = phi i64 [ %add24, %cleanup ], [ 3, %entry ]
%cmp437 = icmp sgt i64 %7, 0
br i1 %cmp437, label %for.body6, label %cleanup
for.cond.cleanup: ; preds = %cleanup, %entry
ret i64 0
for.cond3: ; preds = %if.else
%inc22 = add nuw nsw i64 %j.038, 1
%exitcond.not = icmp eq i64 %inc22, %7
br i1 %exitcond.not, label %cleanup, label %for.body6, !llvm.loop !28
for.body6: ; preds = %for.cond3.preheader, %for.cond3
%j.038 = phi i64 [ %inc22, %for.cond3 ], [ 0, %for.cond3.preheader ]
%arrayidx7 = getelementptr inbounds i64, ptr %6, i64 %j.038
%8 = load i64, ptr %arrayidx7, align 8, !tbaa !5
%rem = srem i64 %i.040, %8
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cleanup, label %if.else
if.else: ; preds = %for.body6
%mul = mul nsw i64 %8, %8
%cmp10 = icmp ugt i64 %mul, %i.040
br i1 %cmp10, label %if.then11, label %for.cond3
if.then11: ; preds = %if.else
%add12 = shl i64 %7, 3
%mul13 = add i64 %add12, 8
%call14 = tail call ptr @realloc(ptr noundef nonnull %6, i64 noundef %mul13) #20
store ptr %call14, ptr @factors, align 16, !tbaa !26
%9 = load ptr, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8, !tbaa !26
%10 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%add15 = shl i64 %10, 3
%mul16 = add i64 %add15, 8
%call17 = tail call ptr @realloc(ptr noundef %9, i64 noundef %mul16) #20
store ptr %call17, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8, !tbaa !26
%11 = load ptr, ptr @factors, align 16, !tbaa !26
%12 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%arrayidx18 = getelementptr inbounds i64, ptr %11, i64 %12
store i64 %i.040, ptr %arrayidx18, align 8, !tbaa !5
%13 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%inc19 = add nsw i64 %13, 1
store i64 %inc19, ptr @fac_cnt, align 8, !tbaa !5
%arrayidx20 = getelementptr inbounds i64, ptr %call17, i64 %13
store i64 0, ptr %arrayidx20, align 8, !tbaa !5
br label %cleanup
cleanup: ; preds = %for.cond3, %for.body6, %for.cond3.preheader, %if.then11
%14 = phi ptr [ %6, %for.cond3.preheader ], [ %11, %if.then11 ], [ %6, %for.body6 ], [ %6, %for.cond3 ]
%15 = phi i64 [ %7, %for.cond3.preheader ], [ %inc19, %if.then11 ], [ %7, %for.body6 ], [ %7, %for.cond3 ]
%add24 = add nuw nsw i64 %i.040, 2
%cmp.not = icmp sgt i64 %add24, %x
br i1 %cmp.not, label %for.cond.cleanup, label %for.cond3.preheader, !llvm.loop !29
}
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #11
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @factor(i64 noundef %n, i64 noundef %is_update) local_unnamed_addr #12 {
entry:
%0 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp41 = icmp sgt i64 %0, 0
br i1 %cmp41, label %for.cond1.preheader.lr.ph, label %cleanup21
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load ptr, ptr @factors, align 16, !tbaa !26
%tobool11.not = icmp eq i64 %is_update, 0
%2 = load ptr, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8
br i1 %tobool11.not, label %for.cond1.preheader.us, label %for.cond1.preheader
for.cond1.preheader.us: ; preds = %for.cond1.preheader.lr.ph, %for.inc.us
%i.043.us = phi i64 [ %inc20.us, %for.inc.us ], [ 0, %for.cond1.preheader.lr.ph ]
%n.addr.042.us = phi i64 [ %n.addr.3.us, %for.inc.us ], [ %n, %for.cond1.preheader.lr.ph ]
%arrayidx.us = getelementptr inbounds i64, ptr %1, i64 %i.043.us
%3 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
br label %while.cond.us
while.cond.us: ; preds = %for.cond1.preheader.us, %land.rhs.us
%n.addr.2.us = phi i64 [ %div.us, %land.rhs.us ], [ %n.addr.042.us, %for.cond1.preheader.us ]
%cnt.1.us = phi i64 [ %add.us, %land.rhs.us ], [ 0, %for.cond1.preheader.us ]
%rem.us = srem i64 %n.addr.2.us, %3
%div.us = sdiv i64 %n.addr.2.us, %3
%cmp5.us = icmp eq i64 %rem.us, 0
%conv.us = zext i1 %cmp5.us to i64
%add.us = add nuw nsw i64 %cnt.1.us, %conv.us
%tobool.not.us = icmp eq i64 %add.us, 0
br i1 %tobool.not.us, label %for.inc.us, label %land.rhs.us
land.rhs.us: ; preds = %while.cond.us
%rem8.us = srem i64 %div.us, %3
%cmp9.us = icmp eq i64 %rem8.us, 0
br i1 %cmp9.us, label %while.cond.us, label %for.inc.us, !llvm.loop !31
for.inc.us: ; preds = %land.rhs.us, %while.cond.us
%n.addr.3.us = phi i64 [ %div.us, %land.rhs.us ], [ %n.addr.2.us, %while.cond.us ]
%arrayidx12.us = getelementptr inbounds i64, ptr %2, i64 %i.043.us
%4 = load i64, ptr %arrayidx12.us, align 8, !tbaa !5
%cond.i.us = tail call i64 @llvm.smax.i64(i64 %4, i64 %add.us)
store i64 %cond.i.us, ptr %arrayidx12.us, align 8, !tbaa !5
%mul.us = mul nsw i64 %cond.i.us, %cond.i.us
%cmp17.not.us = icmp sle i64 %mul.us, %n.addr.3.us
%inc20.us = add nuw nsw i64 %i.043.us, 1
%5 = load i64, ptr @fac_cnt, align 8
%cmp.us = icmp slt i64 %inc20.us, %5
%or.cond = select i1 %cmp17.not.us, i1 %cmp.us, i1 false
br i1 %or.cond, label %for.cond1.preheader.us, label %cleanup21, !llvm.loop !32
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc
%i.043 = phi i64 [ %inc20, %for.inc ], [ 0, %for.cond1.preheader.lr.ph ]
%n.addr.042 = phi i64 [ %n.addr.3, %for.inc ], [ %n, %for.cond1.preheader.lr.ph ]
%arrayidx = getelementptr inbounds i64, ptr %1, i64 %i.043
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
br label %while.cond
while.cond: ; preds = %for.cond1.preheader, %land.rhs
%n.addr.2 = phi i64 [ %div, %land.rhs ], [ %n.addr.042, %for.cond1.preheader ]
%cnt.1 = phi i64 [ %add, %land.rhs ], [ 0, %for.cond1.preheader ]
%rem = srem i64 %n.addr.2, %6
%div = sdiv i64 %n.addr.2, %6
%cmp5 = icmp eq i64 %rem, 0
%conv = zext i1 %cmp5 to i64
%add = add nuw nsw i64 %cnt.1, %conv
%tobool.not = icmp eq i64 %add, 0
br i1 %tobool.not, label %for.inc, label %land.rhs
land.rhs: ; preds = %while.cond
%rem8 = srem i64 %div, %6
%cmp9 = icmp eq i64 %rem8, 0
br i1 %cmp9, label %while.cond, label %for.inc, !llvm.loop !31
for.inc: ; preds = %land.rhs, %while.cond
%n.addr.3 = phi i64 [ %div, %land.rhs ], [ %n.addr.2, %while.cond ]
%arrayidx14 = getelementptr inbounds i64, ptr %2, i64 %i.043
store i64 %add, ptr %arrayidx14, align 8, !tbaa !5
%mul = mul nsw i64 %add, %add
%cmp17.not = icmp sle i64 %mul, %n.addr.3
%inc20 = add nuw nsw i64 %i.043, 1
%7 = load i64, ptr @fac_cnt, align 8
%cmp = icmp slt i64 %inc20, %7
%or.cond46 = select i1 %cmp17.not, i1 %cmp, i1 false
br i1 %or.cond46, label %for.cond1.preheader, label %cleanup21, !llvm.loop !32
cleanup21: ; preds = %for.inc, %for.inc.us, %entry
%n.addr.4 = phi i64 [ %n, %entry ], [ %n.addr.3.us, %for.inc.us ], [ %n.addr.3, %for.inc ]
ret i64 %n.addr.4
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @jud_prime(i64 noundef %n) local_unnamed_addr #13 {
entry:
%0 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp20 = icmp sgt i64 %0, 0
br i1 %cmp20, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %entry
%1 = load ptr, ptr @factors, align 16, !tbaa !26
br label %for.body
for.body: ; preds = %for.body.lr.ph, %if.else
%i.022 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %if.else ]
%n.addr.021 = phi i64 [ %n, %for.body.lr.ph ], [ %spec.select, %if.else ]
%arrayidx = getelementptr inbounds i64, ptr %1, i64 %i.022
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%mul = mul nsw i64 %2, %2
%cmp2 = icmp slt i64 %n.addr.021, %mul
%cmp4 = icmp eq i64 %n.addr.021, %2
%or.cond = or i1 %cmp4, %cmp2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %for.body
%rem = srem i64 %n.addr.021, %2
%cmp6 = icmp eq i64 %rem, 0
%spec.select = select i1 %cmp6, i64 1, i64 %n.addr.021
%inc = add nuw nsw i64 %i.022, 1
%exitcond.not = icmp eq i64 %inc, %0
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !33
cleanup: ; preds = %if.else, %for.body, %entry
%n.addr.0.lcssa = phi i64 [ %n, %entry ], [ %n.addr.021, %for.body ], [ %spec.select, %if.else ]
%cmp9 = icmp ne i64 %n.addr.0.lcssa, 1
%conv = zext i1 %cmp9 to i64
ret i64 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #14 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #14 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_string(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #15 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #21
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #16
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #14 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !21
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !21
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #22
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #17
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #22
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_string(i32 noundef %n, i32 noundef %size, ptr noundef %s) local_unnamed_addr #2 {
entry:
%0 = zext i32 %size to i64
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %s, i64 noundef %conv, i64 noundef %0, ptr noundef nonnull @cmp_string) #22
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_char(ptr noundef %s) local_unnamed_addr #2 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #21
tail call void @qsort(ptr noundef %s, i64 noundef %call, i64 noundef 1, ptr noundef nonnull @cmp_char) #22
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #16
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @unique_string(i64 noundef %n, i64 noundef %size, ptr nocapture noundef readonly %s) local_unnamed_addr #18 {
entry:
%cmp8 = icmp sgt i64 %n, 1
br i1 %cmp8, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %spec.select, %for.body ]
ret i64 %ans.0.lcssa
for.body: ; preds = %entry, %for.body
%i.010 = phi i64 [ %inc2, %for.body ], [ 1, %entry ]
%ans.09 = phi i64 [ %spec.select, %for.body ], [ 1, %entry ]
%0 = mul nsw i64 %i.010, %size
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %0
%sub = add nsw i64 %i.010, -1
%1 = mul nsw i64 %sub, %size
%arrayidx1 = getelementptr inbounds i8, ptr %s, i64 %1
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %arrayidx1) #21
%tobool.not = icmp ne i32 %call, 0
%inc = zext i1 %tobool.not to i64
%spec.select = add nuw nsw i64 %ans.09, %inc
%inc2 = add nuw nsw i64 %i.010, 1
%exitcond.not = icmp eq i64 %inc2, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !34
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @unique_num(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #8 {
entry:
%cmp9 = icmp sgt i64 %n, 1
br i1 %cmp9, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = add i64 %n, -1
%min.iters.check = icmp ult i64 %n, 5
br i1 %min.iters.check, label %for.body.preheader16, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -4
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1, i64 0>, %vector.ph ], [ %9, %vector.body ]
%vec.phi12 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds i64, ptr %a, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load13 = load <2 x i64>, ptr %2, align 8, !tbaa !5
%3 = getelementptr i64, ptr %1, i64 -1
%wide.load14 = load <2 x i64>, ptr %3, align 8, !tbaa !5
%4 = getelementptr i64, ptr %1, i64 1
%wide.load15 = load <2 x i64>, ptr %4, align 8, !tbaa !5
%5 = icmp ne <2 x i64> %wide.load, %wide.load14
%6 = icmp ne <2 x i64> %wide.load13, %wide.load15
%7 = zext <2 x i1> %5 to <2 x i64>
%8 = zext <2 x i1> %6 to <2 x i64>
%9 = add <2 x i64> %vec.phi, %7
%10 = add <2 x i64> %vec.phi12, %8
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !35
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %10, %9
%12 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader16
for.body.preheader16: ; preds = %for.body.preheader, %middle.block
%i.011.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%ans.010.ph = phi i64 [ 1, %for.body.preheader ], [ %12, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %12, %middle.block ], [ %spec.select, %for.body ]
ret i64 %ans.0.lcssa
for.body: ; preds = %for.body.preheader16, %for.body
%i.011 = phi i64 [ %inc3, %for.body ], [ %i.011.ph, %for.body.preheader16 ]
%ans.010 = phi i64 [ %spec.select, %for.body ], [ %ans.010.ph, %for.body.preheader16 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.011
%13 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx1 = getelementptr i64, ptr %arrayidx, i64 -1
%14 = load i64, ptr %arrayidx1, align 8, !tbaa !5
%cmp2.not = icmp ne i64 %13, %14
%inc = zext i1 %cmp2.not to i64
%spec.select = add nuw nsw i64 %ans.010, %inc
%inc3 = add nuw nsw i64 %i.011, 1
%exitcond.not = icmp eq i64 %inc3, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !36
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp1(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #14 {
entry:
%0 = load i64, ptr %p, align 8, !tbaa !37
%1 = load i64, ptr %q, align 8, !tbaa !37
%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 @cmp2(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #14 {
entry:
%0 = load i64, ptr %q, align 8, !tbaa !37
%1 = load i64, ptr %p, align 8, !tbaa !37
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp1) #22
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp2) #22
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%q = alloca i64, align 8
%l = alloca i64, align 8
%r = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %q) #22
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l) #22
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #22
%call = call i64 @factor_pre(i64 noundef 100000)
%0 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp20.i = icmp sgt i64 %0, 0
%1 = load ptr, ptr @factors, align 16
br i1 %cmp20.i, label %for.body.us, label %for.body
for.body.us: ; preds = %entry, %jud_prime.exit59.loopexit.us
%i.068.us = phi i64 [ %add4.us, %jud_prime.exit59.loopexit.us ], [ 1, %entry ]
br label %for.body.i.us
for.body.i.us: ; preds = %if.else.i.us, %for.body.us
%i.022.i.us = phi i64 [ 0, %for.body.us ], [ %inc.i.us, %if.else.i.us ]
%n.addr.021.i.us = phi i64 [ %i.068.us, %for.body.us ], [ %spec.select.i.us, %if.else.i.us ]
%arrayidx.i.us = getelementptr inbounds i64, ptr %1, i64 %i.022.i.us
%2 = load i64, ptr %arrayidx.i.us, align 8, !tbaa !5
%mul.i.us = mul nsw i64 %2, %2
%cmp2.i.us = icmp slt i64 %n.addr.021.i.us, %mul.i.us
%cmp4.i.us = icmp eq i64 %n.addr.021.i.us, %2
%or.cond.i.us = or i1 %cmp4.i.us, %cmp2.i.us
br i1 %or.cond.i.us, label %jud_prime.exit.us, label %if.else.i.us
if.else.i.us: ; preds = %for.body.i.us
%rem.i.us = srem i64 %n.addr.021.i.us, %2
%cmp6.i.us = icmp eq i64 %rem.i.us, 0
%spec.select.i.us = select i1 %cmp6.i.us, i64 1, i64 %n.addr.021.i.us
%inc.i.us = add nuw nsw i64 %i.022.i.us, 1
%exitcond.not.i.us = icmp eq i64 %inc.i.us, %0
br i1 %exitcond.not.i.us, label %jud_prime.exit.us, label %for.body.i.us, !llvm.loop !33
jud_prime.exit.us: ; preds = %if.else.i.us, %for.body.i.us
%n.addr.0.lcssa.i.us = phi i64 [ %n.addr.021.i.us, %for.body.i.us ], [ %spec.select.i.us, %if.else.i.us ]
%add.us = add nuw nsw i64 %i.068.us, 1
%div39.us = lshr i64 %add.us, 1
br label %for.body.i45.us
for.body.i45.us: ; preds = %if.else.i53.us, %jud_prime.exit.us
%i.022.i46.us = phi i64 [ 0, %jud_prime.exit.us ], [ %inc.i57.us, %if.else.i53.us ]
%n.addr.021.i47.us = phi i64 [ %div39.us, %jud_prime.exit.us ], [ %spec.select.i56.us, %if.else.i53.us ]
%arrayidx.i48.us = getelementptr inbounds i64, ptr %1, i64 %i.022.i46.us
%3 = load i64, ptr %arrayidx.i48.us, align 8, !tbaa !5
%mul.i49.us = mul nsw i64 %3, %3
%cmp2.i50.us = icmp slt i64 %n.addr.021.i47.us, %mul.i49.us
%cmp4.i51.us = icmp eq i64 %n.addr.021.i47.us, %3
%or.cond.i52.us = or i1 %cmp4.i51.us, %cmp2.i50.us
br i1 %or.cond.i52.us, label %jud_prime.exit59.loopexit.us, label %if.else.i53.us
if.else.i53.us: ; preds = %for.body.i45.us
%rem.i54.us = srem i64 %n.addr.021.i47.us, %3
%cmp6.i55.us = icmp eq i64 %rem.i54.us, 0
%spec.select.i56.us = select i1 %cmp6.i55.us, i64 1, i64 %n.addr.021.i47.us
%inc.i57.us = add nuw nsw i64 %i.022.i46.us, 1
%exitcond.not.i58.us = icmp eq i64 %inc.i57.us, %0
br i1 %exitcond.not.i58.us, label %jud_prime.exit59.loopexit.us, label %for.body.i45.us, !llvm.loop !33
jud_prime.exit59.loopexit.us: ; preds = %if.else.i53.us, %for.body.i45.us
%n.addr.0.lcssa.i41.ph.us = phi i64 [ %spec.select.i56.us, %if.else.i53.us ], [ %n.addr.021.i47.us, %for.body.i45.us ]
%conv.i67.in.us = icmp ne i64 %n.addr.0.lcssa.i.us, 1
%cmp9.i42.us = icmp ne i64 %n.addr.0.lcssa.i41.ph.us, 1
%mulbool.us = and i1 %conv.i67.in.us, %cmp9.i42.us
%mul.us = zext i1 %mulbool.us to i64
%arrayidx.us = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %i.068.us
store i64 %mul.us, ptr %arrayidx.us, align 8, !tbaa !5
%add4.us = add nuw nsw i64 %i.068.us, 2
%cmp.us = icmp ult i64 %i.068.us, 99999
br i1 %cmp.us, label %for.body.us, label %for.cond6.preheader, !llvm.loop !39
for.cond6.preheader: ; preds = %for.body, %jud_prime.exit59.loopexit.us
%.pre = load i64, ptr @ans, align 16, !tbaa !5
br label %for.body11
for.body: ; preds = %entry, %for.body
%i.068 = phi i64 [ %add4.3, %for.body ], [ 1, %entry ]
%cmp9.i42 = icmp ne i64 %i.068, 1
%mul = zext i1 %cmp9.i42 to i64
%arrayidx = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %i.068
store i64 %mul, ptr %arrayidx, align 8, !tbaa !5
%add4 = add nuw nsw i64 %i.068, 2
%arrayidx.1 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %add4
store i64 1, ptr %arrayidx.1, align 8, !tbaa !5
%add4.1 = add nuw nsw i64 %i.068, 4
%arrayidx.2 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %add4.1
store i64 1, ptr %arrayidx.2, align 8, !tbaa !5
%add4.2 = add nuw nsw i64 %i.068, 6
%arrayidx.3 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %add4.2
store i64 1, ptr %arrayidx.3, align 8, !tbaa !5
%add4.3 = add nuw nsw i64 %i.068, 8
%cmp.3 = icmp ult i64 %i.068, 99993
br i1 %cmp.3, label %for.body, label %for.cond6.preheader, !llvm.loop !39
for.cond18.preheader: ; preds = %for.body11
%4 = load i64, ptr %q, align 8, !tbaa !5
%cmp1970 = icmp sgt i64 %4, 0
br i1 %cmp1970, label %for.body22, label %for.cond.cleanup21
for.body11: ; preds = %for.body11, %for.cond6.preheader
%5 = phi i64 [ %.pre, %for.cond6.preheader ], [ %add14.3, %for.body11 ]
%i5.069 = phi i64 [ 1, %for.cond6.preheader ], [ %inc.3, %for.body11 ]
%arrayidx13 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %i5.069
%6 = load i64, ptr %arrayidx13, align 8, !tbaa !5
%add14 = add nsw i64 %6, %5
store i64 %add14, ptr %arrayidx13, align 8, !tbaa !5
%inc = add nuw nsw i64 %i5.069, 1
%arrayidx13.1 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %inc
%7 = load i64, ptr %arrayidx13.1, align 8, !tbaa !5
%add14.1 = add nsw i64 %7, %add14
store i64 %add14.1, ptr %arrayidx13.1, align 8, !tbaa !5
%inc.1 = add nuw nsw i64 %i5.069, 2
%arrayidx13.2 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %inc.1
%8 = load i64, ptr %arrayidx13.2, align 8, !tbaa !5
%add14.2 = add nsw i64 %8, %add14.1
store i64 %add14.2, ptr %arrayidx13.2, align 8, !tbaa !5
%inc.2 = add nuw nsw i64 %i5.069, 3
%arrayidx13.3 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %inc.2
%9 = load i64, ptr %arrayidx13.3, align 8, !tbaa !5
%add14.3 = add nsw i64 %9, %add14.2
store i64 %add14.3, ptr %arrayidx13.3, align 8, !tbaa !5
%inc.3 = add nuw nsw i64 %i5.069, 4
%exitcond.not.3 = icmp eq i64 %inc.3, 100001
br i1 %exitcond.not.3, label %for.cond18.preheader, label %for.body11, !llvm.loop !40
for.cond.cleanup21: ; preds = %for.body22, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #22
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l) #22
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %q) #22
ret i32 0
for.body22: ; preds = %for.cond18.preheader, %for.body22
%i17.071 = phi i64 [ %inc29, %for.body22 ], [ 0, %for.cond18.preheader ]
%call.i60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l)
%call.i61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r)
%10 = load i64, ptr %r, align 8, !tbaa !5
%arrayidx23 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %10
%11 = load i64, ptr %arrayidx23, align 8, !tbaa !5
%12 = load i64, ptr %l, align 8, !tbaa !5
%sub24 = add nsw i64 %12, -1
%arrayidx25 = getelementptr inbounds [100005 x i64], ptr @ans, i64 0, i64 %sub24
%13 = load i64, ptr %arrayidx25, align 8, !tbaa !5
%sub26 = sub nsw i64 %11, %13
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub26)
%inc29 = add nuw nsw i64 %i17.071, 1
%14 = load i64, ptr %q, align 8, !tbaa !5
%cmp19 = icmp slt i64 %inc29, %14
br i1 %cmp19, label %for.body22, label %for.cond.cleanup21, !llvm.loop !41
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #19
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #19
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #19
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #19
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #19
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #19
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #19
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 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 nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree 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 #7 = { 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 #8 = { 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 #9 = { 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 #10 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) 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 #12 = { 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 #13 = { 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 #14 = { 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 #15 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #16 = { 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 #17 = { 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 #18 = { 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 #19 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #20 = { nounwind allocsize(1) }
attributes #21 = { nounwind willreturn memory(read) }
attributes #22 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !17}
!21 = !{!7, !7, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"int", !7, i64 0}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = !{!27, !27, i64 0}
!27 = !{!"any pointer", !7, i64 0}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10, !30}
!30 = !{!"llvm.loop.unswitch.partial.disable"}
!31 = distinct !{!31, !10}
!32 = distinct !{!32, !10}
!33 = distinct !{!33, !10}
!34 = distinct !{!34, !10}
!35 = distinct !{!35, !10, !11, !12}
!36 = distinct !{!36, !10, !12, !11}
!37 = !{!38, !6, i64 0}
!38 = !{!"", !6, i64 0, !6, i64 8}
!39 = distinct !{!39, !10}
!40 = distinct !{!40, !10}
!41 = distinct !{!41, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef long long int int64;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
void run(void){
const int n=100000;
int *a=(int *)malloc(sizeof(int)*(n+1));
int i,j;
for(i=0;i<=n;i++) a[i]=1;
a[0]=a[1]=0;
for(i=2;i*i<=n;i++){
if(a[i]){
for(j=i*i;j<=n;j+=i){
a[j]=0;
}
}
}
int *b=(int *)malloc(sizeof(int)*(n+1));
for(i=0;i<=n;i++) b[i]=0;
for(i=3;i<=n;i+=2){
if(a[i] && a[(i+1)/2]){
b[i]=1;
}
}
for(i=1;i<=n;i++){
b[i]+=b[i-1];
}
int q;
scanf("%d",&q);
for(i=0;i<q;i++){
int l,r;
scanf("%d%d",&l,&r);
printf("%d\n",b[r]-b[l-1]);
}
return;
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229576/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229576/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
%call = tail call noalias dereferenceable_or_null(400004) ptr @malloc(i64 noundef 400004) #5
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.4, %vector.body ]
%0 = getelementptr inbounds i32, ptr %call, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 4, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 4, !tbaa !5
%2 = getelementptr i32, ptr %call, i64 %index
%3 = getelementptr i32, ptr %2, i64 8
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 4, !tbaa !5
%4 = getelementptr i32, ptr %2, i64 12
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %call, i64 %index
%6 = getelementptr i32, ptr %5, i64 16
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 4, !tbaa !5
%7 = getelementptr i32, ptr %5, i64 20
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 4, !tbaa !5
%8 = getelementptr i32, ptr %call, i64 %index
%9 = getelementptr i32, ptr %8, i64 24
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 4, !tbaa !5
%10 = getelementptr i32, ptr %8, i64 28
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %10, align 4, !tbaa !5
%11 = getelementptr i32, ptr %call, i64 %index
%12 = getelementptr i32, ptr %11, i64 32
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %12, align 4, !tbaa !5
%13 = getelementptr i32, ptr %11, i64 36
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %13, align 4, !tbaa !5
%index.next.4 = add nuw nsw i64 %index, 40
%14 = icmp eq i64 %index.next.4, 100000
br i1 %14, label %for.body, label %vector.body, !llvm.loop !9
for.body: ; preds = %vector.body
%arrayidx = getelementptr inbounds i32, ptr %call, i64 100000
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%arrayidx1 = getelementptr inbounds i32, ptr %call, i64 1
store i32 0, ptr %arrayidx1, align 4, !tbaa !5
store i32 0, ptr %call, align 4, !tbaa !5
br label %for.body5
for.body5: ; preds = %for.body, %for.inc16
%indvars.iv119 = phi i64 [ 2, %for.body ], [ %indvars.iv.next120, %for.inc16 ]
%mul112 = phi i32 [ 4, %for.body ], [ %mul, %for.inc16 ]
%arrayidx7 = getelementptr inbounds i32, ptr %call, i64 %indvars.iv119
%15 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%tobool.not = icmp ne i32 %15, 0
%cmp10109 = icmp ult i32 %mul112, 100001
%or.cond = and i1 %tobool.not, %cmp10109
br i1 %or.cond, label %for.body11.preheader, label %for.inc16
for.body11.preheader: ; preds = %for.body5
%16 = zext i32 %mul112 to i64
br label %for.body11
for.body11: ; preds = %for.body11.preheader, %for.body11
%indvars.iv121 = phi i64 [ %16, %for.body11.preheader ], [ %indvars.iv.next122, %for.body11 ]
%arrayidx13 = getelementptr inbounds i32, ptr %call, i64 %indvars.iv121
store i32 0, ptr %arrayidx13, align 4, !tbaa !5
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, %indvars.iv119
%cmp10 = icmp ult i64 %indvars.iv.next122, 100001
br i1 %cmp10, label %for.body11, label %for.inc16, !llvm.loop !13
for.inc16: ; preds = %for.body11, %for.body5
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%17 = trunc i64 %indvars.iv.next120 to i32
%mul = mul nsw i32 %17, %17
%exitcond125.not = icmp eq i64 %indvars.iv.next120, 317
br i1 %exitcond125.not, label %for.end18, label %for.body5, !llvm.loop !14
for.end18: ; preds = %for.inc16
%calloc = tail call dereferenceable_or_null(400004) ptr @calloc(i64 1, i64 400004)
br label %for.body30
for.body30: ; preds = %for.inc42.1, %for.end18
%indvars.iv129 = phi i64 [ 3, %for.end18 ], [ %indvars.iv.next130.1, %for.inc42.1 ]
%arrayidx32 = getelementptr inbounds i32, ptr %call, i64 %indvars.iv129
%18 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%tobool33.not = icmp eq i32 %18, 0
br i1 %tobool33.not, label %for.inc42, label %land.lhs.true
land.lhs.true: ; preds = %for.body30
%19 = add nuw nsw i64 %indvars.iv129, 1
%20 = lshr i64 %19, 1
%arrayidx36 = getelementptr inbounds i32, ptr %call, i64 %20
%21 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%tobool37.not = icmp eq i32 %21, 0
br i1 %tobool37.not, label %for.inc42, label %if.then38
if.then38: ; preds = %land.lhs.true
%arrayidx40 = getelementptr inbounds i32, ptr %calloc, i64 %indvars.iv129
store i32 1, ptr %arrayidx40, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body30, %land.lhs.true, %if.then38
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 2
%cmp29 = icmp ult i64 %indvars.iv129, 99999
br i1 %cmp29, label %for.body30.1, label %for.body47.preheader, !llvm.loop !15
for.body30.1: ; preds = %for.inc42
%arrayidx32.1 = getelementptr inbounds i32, ptr %call, i64 %indvars.iv.next130
%22 = load i32, ptr %arrayidx32.1, align 4, !tbaa !5
%tobool33.not.1 = icmp eq i32 %22, 0
br i1 %tobool33.not.1, label %for.inc42.1, label %land.lhs.true.1
land.lhs.true.1: ; preds = %for.body30.1
%23 = add nuw nsw i64 %indvars.iv129, 3
%24 = lshr i64 %23, 1
%arrayidx36.1 = getelementptr inbounds i32, ptr %call, i64 %24
%25 = load i32, ptr %arrayidx36.1, align 4, !tbaa !5
%tobool37.not.1 = icmp eq i32 %25, 0
br i1 %tobool37.not.1, label %for.inc42.1, label %if.then38.1
if.then38.1: ; preds = %land.lhs.true.1
%arrayidx40.1 = getelementptr inbounds i32, ptr %calloc, i64 %indvars.iv.next130
store i32 1, ptr %arrayidx40.1, align 4, !tbaa !5
br label %for.inc42.1
for.inc42.1: ; preds = %if.then38.1, %land.lhs.true.1, %for.body30.1
%indvars.iv.next130.1 = add nuw nsw i64 %indvars.iv129, 4
br label %for.body30
for.body47.preheader: ; preds = %for.inc42
%invariant.gep = getelementptr i32, ptr %calloc, i64 1
%invariant.gep139 = getelementptr i32, ptr %calloc, i64 2
%invariant.gep141 = getelementptr i32, ptr %calloc, i64 3
%invariant.gep143 = getelementptr i32, ptr %calloc, i64 4
br label %for.body47
for.body47: ; preds = %for.body47, %for.body47.preheader
%26 = phi i32 [ 0, %for.body47.preheader ], [ %add52.4, %for.body47 ]
%indvars.iv134 = phi i64 [ 1, %for.body47.preheader ], [ %indvars.iv.next135.4, %for.body47 ]
%arrayidx51 = getelementptr inbounds i32, ptr %calloc, i64 %indvars.iv134
%27 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%add52 = add nsw i32 %27, %26
store i32 %add52, ptr %arrayidx51, align 4, !tbaa !5
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv134
%28 = load i32, ptr %gep, align 4, !tbaa !5
%add52.1 = add nsw i32 %28, %add52
store i32 %add52.1, ptr %gep, align 4, !tbaa !5
%gep140 = getelementptr i32, ptr %invariant.gep139, i64 %indvars.iv134
%29 = load i32, ptr %gep140, align 4, !tbaa !5
%add52.2 = add nsw i32 %29, %add52.1
store i32 %add52.2, ptr %gep140, align 4, !tbaa !5
%gep142 = getelementptr i32, ptr %invariant.gep141, i64 %indvars.iv134
%30 = load i32, ptr %gep142, align 4, !tbaa !5
%add52.3 = add nsw i32 %30, %add52.2
store i32 %add52.3, ptr %gep142, align 4, !tbaa !5
%gep144 = getelementptr i32, ptr %invariant.gep143, i64 %indvars.iv134
%31 = load i32, ptr %gep144, align 4, !tbaa !5
%add52.4 = add nsw i32 %31, %add52.3
store i32 %add52.4, ptr %gep144, align 4, !tbaa !5
%indvars.iv.next135.4 = add nuw nsw i64 %indvars.iv134, 5
%exitcond138.not.4 = icmp eq i64 %indvars.iv.next135.4, 100001
br i1 %exitcond138.not.4, label %for.end55, label %for.body47, !llvm.loop !16
for.end55: ; preds = %for.body47
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
%call56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%32 = load i32, ptr %q, align 4, !tbaa !5
%cmp58116 = icmp sgt i32 %32, 0
br i1 %cmp58116, label %for.body59, label %for.end70
for.body59: ; preds = %for.end55, %for.body59
%i.5117 = phi i32 [ %inc69, %for.body59 ], [ 0, %for.end55 ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l, ptr noundef nonnull %r)
%33 = load i32, ptr %r, align 4, !tbaa !5
%idxprom61 = sext i32 %33 to i64
%arrayidx62 = getelementptr inbounds i32, ptr %calloc, i64 %idxprom61
%34 = load i32, ptr %arrayidx62, align 4, !tbaa !5
%35 = load i32, ptr %l, align 4, !tbaa !5
%sub63 = add nsw i32 %35, -1
%idxprom64 = sext i32 %sub63 to i64
%arrayidx65 = getelementptr inbounds i32, ptr %calloc, i64 %idxprom64
%36 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%sub66 = sub nsw i32 %34, %36
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub66)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #6
%inc69 = add nuw nsw i32 %i.5117, 1
%37 = load i32, ptr %q, align 4, !tbaa !5
%cmp58 = icmp slt i32 %inc69, %37
br i1 %cmp58, label %for.body59, label %for.end70, !llvm.loop !17
for.end70: ; preds = %for.body59, %for.end55
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-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 allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #5 = { nounwind allocsize(0) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#include<stdlib.h>
typedef struct directedGraph{
int *vertex;
int *next;
int *start;
int v,e;
int pointer;
} graph;
graph* newGraph(const int v,const int e){
graph *g=(graph *)malloc(sizeof(graph));
g->vertex=(int *)calloc(e,sizeof(int));
g->next=(int *)calloc(e,sizeof(int));
g->start=(int *)calloc(v,sizeof(int));
for(int i=0;i<v;i++) g->start[i]=-1;
g->v=v;
g->e=e;
g->pointer=0;
return g;
}
void freeGraph(graph *g){
free(g->vertex);
free(g->next);
free(g->start);
free(g);
return;
}
void addEdge(graph *g,const int from,const int to){
const int p=g->pointer;
g->vertex[p]=to;
g->next[p]=g->start[from];
g->start[from]=p;
g->pointer++;
return;
}
typedef struct node{
int t;
int c;
} node;
node calc(node a,node b){
return a.t>b.t?a:b;
}
#define POS(i,j) ((i)*n+(j))
void run(void){
int n,m;
scanf("%d%d",&n,&m);
graph *g=newGraph(n,2*m);
while(m--){
int a,b;
scanf("%d%d",&a,&b);
a--;b--;
addEdge(g,a,b);
addEdge(g,b,a);
}
int q;
scanf("%d",&q);
node *dp=(node *)calloc(n*11,sizeof(node));
int i,j;
for(i=1;i<=q;i++){
int v,d,c;
scanf("%d%d%d",&v,&d,&c);
v--;
dp[POS(d,v)]=(node){i,c};
}
for(i=10;i>0;i--){
for(j=0;j<n;j++){
if(dp[POS(i,j)].c==0) continue;
for(int p=g->start[j];p!=-1;p=g->next[p]){
int u=g->vertex[p];
dp[POS(i-1,u)]=calc(dp[POS(i-1,u)],dp[POS(i,j)]);
}
}
}
for(i=0;i<n;i++){
node t={0,0};
for(j=0;j<=10;j++){
t=calc(t,dp[POS(j,i)]);
}
printf("%d\n",t.c);
}
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229619/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229619/source.c"
target datalayout = "e-m:e-p270: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.directedGraph = type { ptr, ptr, ptr, i32, i32, i32 }
%struct.node = type { i32, i32 }
@.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 [7 x i8] c"%d%d%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @newGraph(i32 noundef %v, i32 noundef %e) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #11
%conv = sext i32 %e to i64
%call1 = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #12
store ptr %call1, ptr %call, align 8, !tbaa !5
%call3 = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #12
%next = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 1
store ptr %call3, ptr %next, align 8, !tbaa !11
%conv4 = sext i32 %v to i64
%call5 = tail call noalias ptr @calloc(i64 noundef %conv4, i64 noundef 4) #12
%start = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 2
store ptr %call5, ptr %start, align 8, !tbaa !12
%cmp23 = icmp sgt i32 %v, 0
br i1 %cmp23, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = zext i32 %v to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr align 4 %call5, i8 -1, i64 %1, i1 false), !tbaa !13
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %entry
%v8 = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 3
store i32 %v, ptr %v8, align 8, !tbaa !14
%e9 = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 4
store i32 %e, ptr %e9, align 4, !tbaa !15
%pointer = getelementptr inbounds %struct.directedGraph, ptr %call, i64 0, i32 5
store i32 0, ptr %pointer, align 8, !tbaa !16
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nounwind willreturn uwtable
define dso_local void @freeGraph(ptr nocapture noundef %g) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr %g, align 8, !tbaa !5
tail call void @free(ptr noundef %0) #13
%next = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 1
%1 = load ptr, ptr %next, align 8, !tbaa !11
tail call void @free(ptr noundef %1) #13
%start = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 2
%2 = load ptr, ptr %start, align 8, !tbaa !12
tail call void @free(ptr noundef %2) #13
tail call void @free(ptr noundef %g) #13
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @addEdge(ptr nocapture noundef %g, i32 noundef %from, i32 noundef %to) local_unnamed_addr #6 {
entry:
%pointer = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 5
%0 = load i32, ptr %pointer, align 8, !tbaa !16
%1 = load ptr, ptr %g, align 8, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds i32, ptr %1, i64 %idxprom
store i32 %to, ptr %arrayidx, align 4, !tbaa !13
%start = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 2
%2 = load ptr, ptr %start, align 8, !tbaa !12
%idxprom1 = sext i32 %from to i64
%arrayidx2 = getelementptr inbounds i32, ptr %2, i64 %idxprom1
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !13
%next = getelementptr inbounds %struct.directedGraph, ptr %g, i64 0, i32 1
%4 = load ptr, ptr %next, align 8, !tbaa !11
%arrayidx4 = getelementptr inbounds i32, ptr %4, i64 %idxprom
store i32 %3, ptr %arrayidx4, align 4, !tbaa !13
store i32 %0, ptr %arrayidx2, align 4, !tbaa !13
%5 = load i32, ptr %pointer, align 8, !tbaa !16
%inc = add nsw i32 %5, 1
store i32 %inc, ptr %pointer, align 8, !tbaa !16
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @calc(i64 %a.coerce, i64 %b.coerce) local_unnamed_addr #7 {
entry:
%a.sroa.0.0.extract.trunc = trunc i64 %a.coerce to i32
%b.sroa.0.0.extract.trunc = trunc i64 %b.coerce to i32
%cmp = icmp sgt i32 %a.sroa.0.0.extract.trunc, %b.sroa.0.0.extract.trunc
%a.coerce.b.coerce = select i1 %cmp, i64 %a.coerce, i64 %b.coerce
ret i64 %a.coerce.b.coerce
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #8 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%q = alloca i32, align 4
%v = alloca i32, align 4
%d = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #13
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #13
%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 !13
%1 = load i32, ptr %m, align 4, !tbaa !13
%mul = shl nsw i32 %1, 1
%conv.i = sext i32 %mul to i64
%call1.i = call noalias ptr @calloc(i64 noundef %conv.i, i64 noundef 4) #12
%call3.i = call noalias ptr @calloc(i64 noundef %conv.i, i64 noundef 4) #12
%conv4.i = sext i32 %0 to i64
%call5.i = call noalias ptr @calloc(i64 noundef %conv4.i, i64 noundef 4) #12
%cmp23.i = icmp sgt i32 %0, 0
br i1 %cmp23.i, label %for.body.preheader.i, label %newGraph.exit
for.body.preheader.i: ; preds = %entry
%2 = zext i32 %0 to i64
%3 = shl nuw nsw i64 %2, 2
call void @llvm.memset.p0.i64(ptr align 4 %call5.i, i8 -1, i64 %3, i1 false), !tbaa !13
br label %newGraph.exit
newGraph.exit: ; preds = %entry, %for.body.preheader.i
%dec130 = add nsw i32 %1, -1
store i32 %dec130, ptr %m, align 4, !tbaa !13
%tobool.not131 = icmp eq i32 %1, 0
br i1 %tobool.not131, label %while.end, label %while.body
while.body: ; preds = %newGraph.exit, %while.body
%4 = phi i32 [ %inc.i125, %while.body ], [ 0, %newGraph.exit ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #13
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #13
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%5 = load i32, ptr %a, align 4, !tbaa !13
%dec3 = add nsw i32 %5, -1
%6 = load i32, ptr %b, align 4, !tbaa !13
%dec4 = add nsw i32 %6, -1
%idxprom.i = zext i32 %4 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i
store i32 %dec4, ptr %arrayidx.i, align 4, !tbaa !13
%idxprom1.i = sext i32 %dec3 to i64
%arrayidx2.i = getelementptr inbounds i32, ptr %call5.i, i64 %idxprom1.i
%7 = load i32, ptr %arrayidx2.i, align 4, !tbaa !13
%arrayidx4.i = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom.i
store i32 %7, ptr %arrayidx4.i, align 4, !tbaa !13
store i32 %4, ptr %arrayidx2.i, align 4, !tbaa !13
%inc.i = or i32 %4, 1
%idxprom.i118 = zext i32 %inc.i to i64
%arrayidx.i119 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom.i118
store i32 %dec3, ptr %arrayidx.i119, align 4, !tbaa !13
%idxprom1.i121 = sext i32 %dec4 to i64
%arrayidx2.i122 = getelementptr inbounds i32, ptr %call5.i, i64 %idxprom1.i121
%8 = load i32, ptr %arrayidx2.i122, align 4, !tbaa !13
%arrayidx4.i124 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom.i118
store i32 %8, ptr %arrayidx4.i124, align 4, !tbaa !13
store i32 %inc.i, ptr %arrayidx2.i122, align 4, !tbaa !13
%inc.i125 = add nuw nsw i32 %4, 2
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #13
%9 = load i32, ptr %m, align 4, !tbaa !13
%dec = add nsw i32 %9, -1
store i32 %dec, ptr %m, align 4, !tbaa !13
%tobool.not = icmp eq i32 %9, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %while.body, %newGraph.exit
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #13
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %q)
%10 = load i32, ptr %n, align 4, !tbaa !13
%mul6 = mul nsw i32 %10, 11
%conv = sext i32 %mul6 to i64
%call7 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 8) #12
%11 = load i32, ptr %q, align 4, !tbaa !13
%cmp.not132 = icmp slt i32 %11, 1
br i1 %cmp.not132, label %for.cond13.preheader, label %for.body
for.cond13.preheader: ; preds = %for.body, %while.end
%12 = phi i32 [ %10, %while.end ], [ %93, %for.body ]
%cmp18137 = icmp sgt i32 %12, 0
br i1 %cmp18137, label %for.cond17.preheader.us.preheader, label %for.end82
for.cond17.preheader.us.preheader: ; preds = %for.cond13.preheader
%13 = zext i32 %12 to i64
%14 = mul nuw nsw i64 %13, 10
%15 = mul nuw nsw i64 %13, 9
%wide.trip.count = zext i32 %12 to i64
%16 = getelementptr %struct.node, ptr %call7, i64 %15
br label %for.body20.us
for.body20.us: ; preds = %for.cond17.preheader.us.preheader, %for.inc54.us
%indvars.iv = phi i64 [ 0, %for.cond17.preheader.us.preheader ], [ %indvars.iv.next, %for.inc54.us ]
%17 = add nuw nsw i64 %14, %indvars.iv
%c25.us = getelementptr inbounds %struct.node, ptr %call7, i64 %17, i32 1
%18 = load i32, ptr %c25.us, align 4, !tbaa !19
%cmp26.us = icmp eq i32 %18, 0
br i1 %cmp26.us, label %for.inc54.us, label %if.end.us
if.end.us: ; preds = %for.body20.us
%arrayidx29.us = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv
%p.0134.us = load i32, ptr %arrayidx29.us, align 4, !tbaa !13
%cmp31.not135.us = icmp eq i32 %p.0134.us, -1
br i1 %cmp31.not135.us, label %for.inc54.us, label %for.body33.lr.ph.us
for.body33.us: ; preds = %for.body33.lr.ph.us, %for.body33.us
%p.0136.us = phi i32 [ %p.0134.us, %for.body33.lr.ph.us ], [ %p.0.us, %for.body33.us ]
%idxprom34.us = sext i32 %p.0136.us to i64
%arrayidx35.us = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us
%19 = load i32, ptr %arrayidx35.us, align 4, !tbaa !13
%20 = sext i32 %19 to i64
%arrayidx39.us = getelementptr %struct.node, ptr %16, i64 %20
%21 = load i64, ptr %arrayidx39.us, align 4
%22 = load i64, ptr %arrayidx48.us, align 4
%a.sroa.0.0.extract.trunc.i.us = trunc i64 %21 to i32
%b.sroa.0.0.extract.trunc.i.us = trunc i64 %22 to i32
%cmp.i.us = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us, %b.sroa.0.0.extract.trunc.i.us
%a.coerce.b.coerce.i.us = select i1 %cmp.i.us, i64 %21, i64 %22
store i64 %a.coerce.b.coerce.i.us, ptr %arrayidx39.us, align 4, !tbaa.struct !21
%arrayidx52.us = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us
%p.0.us = load i32, ptr %arrayidx52.us, align 4, !tbaa !13
%cmp31.not.us = icmp eq i32 %p.0.us, -1
br i1 %cmp31.not.us, label %for.inc54.us, label %for.body33.us, !llvm.loop !22
for.inc54.us: ; preds = %for.body33.us, %if.end.us, %for.body20.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond17.for.inc57_crit_edge.us, label %for.body20.us, !llvm.loop !23
for.body33.lr.ph.us: ; preds = %if.end.us
%arrayidx48.us = getelementptr inbounds %struct.node, ptr %call7, i64 %17
br label %for.body33.us
for.cond17.for.inc57_crit_edge.us: ; preds = %for.inc54.us
%23 = shl nuw nsw i64 %13, 3
%24 = getelementptr %struct.node, ptr %call7, i64 %23
br label %for.body20.us.1
for.body20.us.1: ; preds = %for.inc54.us.1, %for.cond17.for.inc57_crit_edge.us
%indvars.iv.1 = phi i64 [ 0, %for.cond17.for.inc57_crit_edge.us ], [ %indvars.iv.next.1, %for.inc54.us.1 ]
%25 = add nuw nsw i64 %15, %indvars.iv.1
%c25.us.1 = getelementptr inbounds %struct.node, ptr %call7, i64 %25, i32 1
%26 = load i32, ptr %c25.us.1, align 4, !tbaa !19
%cmp26.us.1 = icmp eq i32 %26, 0
br i1 %cmp26.us.1, label %for.inc54.us.1, label %if.end.us.1
if.end.us.1: ; preds = %for.body20.us.1
%arrayidx29.us.1 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.1
%p.0134.us.1 = load i32, ptr %arrayidx29.us.1, align 4, !tbaa !13
%cmp31.not135.us.1 = icmp eq i32 %p.0134.us.1, -1
br i1 %cmp31.not135.us.1, label %for.inc54.us.1, label %for.body33.lr.ph.us.1
for.body33.lr.ph.us.1: ; preds = %if.end.us.1
%arrayidx48.us.1 = getelementptr inbounds %struct.node, ptr %call7, i64 %25
br label %for.body33.us.1
for.body33.us.1: ; preds = %for.body33.us.1, %for.body33.lr.ph.us.1
%p.0136.us.1 = phi i32 [ %p.0134.us.1, %for.body33.lr.ph.us.1 ], [ %p.0.us.1, %for.body33.us.1 ]
%idxprom34.us.1 = sext i32 %p.0136.us.1 to i64
%arrayidx35.us.1 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.1
%27 = load i32, ptr %arrayidx35.us.1, align 4, !tbaa !13
%28 = sext i32 %27 to i64
%arrayidx39.us.1 = getelementptr %struct.node, ptr %24, i64 %28
%29 = load i64, ptr %arrayidx39.us.1, align 4
%30 = load i64, ptr %arrayidx48.us.1, align 4
%a.sroa.0.0.extract.trunc.i.us.1 = trunc i64 %29 to i32
%b.sroa.0.0.extract.trunc.i.us.1 = trunc i64 %30 to i32
%cmp.i.us.1 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.1, %b.sroa.0.0.extract.trunc.i.us.1
%a.coerce.b.coerce.i.us.1 = select i1 %cmp.i.us.1, i64 %29, i64 %30
store i64 %a.coerce.b.coerce.i.us.1, ptr %arrayidx39.us.1, align 4, !tbaa.struct !21
%arrayidx52.us.1 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.1
%p.0.us.1 = load i32, ptr %arrayidx52.us.1, align 4, !tbaa !13
%cmp31.not.us.1 = icmp eq i32 %p.0.us.1, -1
br i1 %cmp31.not.us.1, label %for.inc54.us.1, label %for.body33.us.1, !llvm.loop !22
for.inc54.us.1: ; preds = %for.body33.us.1, %if.end.us.1, %for.body20.us.1
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
%exitcond.1.not = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.1.not, label %for.cond17.for.inc57_crit_edge.us.1, label %for.body20.us.1, !llvm.loop !23
for.cond17.for.inc57_crit_edge.us.1: ; preds = %for.inc54.us.1
%31 = mul nuw nsw i64 %13, 7
%32 = getelementptr %struct.node, ptr %call7, i64 %31
br label %for.body20.us.2
for.body20.us.2: ; preds = %for.inc54.us.2, %for.cond17.for.inc57_crit_edge.us.1
%indvars.iv.2 = phi i64 [ 0, %for.cond17.for.inc57_crit_edge.us.1 ], [ %indvars.iv.next.2, %for.inc54.us.2 ]
%33 = add nuw nsw i64 %23, %indvars.iv.2
%c25.us.2 = getelementptr inbounds %struct.node, ptr %call7, i64 %33, i32 1
%34 = load i32, ptr %c25.us.2, align 4, !tbaa !19
%cmp26.us.2 = icmp eq i32 %34, 0
br i1 %cmp26.us.2, label %for.inc54.us.2, label %if.end.us.2
if.end.us.2: ; preds = %for.body20.us.2
%arrayidx29.us.2 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.2
%p.0134.us.2 = load i32, ptr %arrayidx29.us.2, align 4, !tbaa !13
%cmp31.not135.us.2 = icmp eq i32 %p.0134.us.2, -1
br i1 %cmp31.not135.us.2, label %for.inc54.us.2, label %for.body33.lr.ph.us.2
for.body33.lr.ph.us.2: ; preds = %if.end.us.2
%arrayidx48.us.2 = getelementptr inbounds %struct.node, ptr %call7, i64 %33
br label %for.body33.us.2
for.body33.us.2: ; preds = %for.body33.us.2, %for.body33.lr.ph.us.2
%p.0136.us.2 = phi i32 [ %p.0134.us.2, %for.body33.lr.ph.us.2 ], [ %p.0.us.2, %for.body33.us.2 ]
%idxprom34.us.2 = sext i32 %p.0136.us.2 to i64
%arrayidx35.us.2 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.2
%35 = load i32, ptr %arrayidx35.us.2, align 4, !tbaa !13
%36 = sext i32 %35 to i64
%arrayidx39.us.2 = getelementptr %struct.node, ptr %32, i64 %36
%37 = load i64, ptr %arrayidx39.us.2, align 4
%38 = load i64, ptr %arrayidx48.us.2, align 4
%a.sroa.0.0.extract.trunc.i.us.2 = trunc i64 %37 to i32
%b.sroa.0.0.extract.trunc.i.us.2 = trunc i64 %38 to i32
%cmp.i.us.2 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.2, %b.sroa.0.0.extract.trunc.i.us.2
%a.coerce.b.coerce.i.us.2 = select i1 %cmp.i.us.2, i64 %37, i64 %38
store i64 %a.coerce.b.coerce.i.us.2, ptr %arrayidx39.us.2, align 4, !tbaa.struct !21
%arrayidx52.us.2 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.2
%p.0.us.2 = load i32, ptr %arrayidx52.us.2, align 4, !tbaa !13
%cmp31.not.us.2 = icmp eq i32 %p.0.us.2, -1
br i1 %cmp31.not.us.2, label %for.inc54.us.2, label %for.body33.us.2, !llvm.loop !22
for.inc54.us.2: ; preds = %for.body33.us.2, %if.end.us.2, %for.body20.us.2
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
%exitcond.2.not = icmp eq i64 %indvars.iv.next.2, %wide.trip.count
br i1 %exitcond.2.not, label %for.cond17.for.inc57_crit_edge.us.2, label %for.body20.us.2, !llvm.loop !23
for.cond17.for.inc57_crit_edge.us.2: ; preds = %for.inc54.us.2
%39 = mul nuw nsw i64 %13, 6
%40 = getelementptr %struct.node, ptr %call7, i64 %39
br label %for.body20.us.3
for.body20.us.3: ; preds = %for.inc54.us.3, %for.cond17.for.inc57_crit_edge.us.2
%indvars.iv.3 = phi i64 [ 0, %for.cond17.for.inc57_crit_edge.us.2 ], [ %indvars.iv.next.3, %for.inc54.us.3 ]
%41 = add nuw nsw i64 %31, %indvars.iv.3
%c25.us.3 = getelementptr inbounds %struct.node, ptr %call7, i64 %41, i32 1
%42 = load i32, ptr %c25.us.3, align 4, !tbaa !19
%cmp26.us.3 = icmp eq i32 %42, 0
br i1 %cmp26.us.3, label %for.inc54.us.3, label %if.end.us.3
if.end.us.3: ; preds = %for.body20.us.3
%arrayidx29.us.3 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.3
%p.0134.us.3 = load i32, ptr %arrayidx29.us.3, align 4, !tbaa !13
%cmp31.not135.us.3 = icmp eq i32 %p.0134.us.3, -1
br i1 %cmp31.not135.us.3, label %for.inc54.us.3, label %for.body33.lr.ph.us.3
for.body33.lr.ph.us.3: ; preds = %if.end.us.3
%arrayidx48.us.3 = getelementptr inbounds %struct.node, ptr %call7, i64 %41
br label %for.body33.us.3
for.body33.us.3: ; preds = %for.body33.us.3, %for.body33.lr.ph.us.3
%p.0136.us.3 = phi i32 [ %p.0134.us.3, %for.body33.lr.ph.us.3 ], [ %p.0.us.3, %for.body33.us.3 ]
%idxprom34.us.3 = sext i32 %p.0136.us.3 to i64
%arrayidx35.us.3 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.3
%43 = load i32, ptr %arrayidx35.us.3, align 4, !tbaa !13
%44 = sext i32 %43 to i64
%arrayidx39.us.3 = getelementptr %struct.node, ptr %40, i64 %44
%45 = load i64, ptr %arrayidx39.us.3, align 4
%46 = load i64, ptr %arrayidx48.us.3, align 4
%a.sroa.0.0.extract.trunc.i.us.3 = trunc i64 %45 to i32
%b.sroa.0.0.extract.trunc.i.us.3 = trunc i64 %46 to i32
%cmp.i.us.3 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.3, %b.sroa.0.0.extract.trunc.i.us.3
%a.coerce.b.coerce.i.us.3 = select i1 %cmp.i.us.3, i64 %45, i64 %46
store i64 %a.coerce.b.coerce.i.us.3, ptr %arrayidx39.us.3, align 4, !tbaa.struct !21
%arrayidx52.us.3 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.3
%p.0.us.3 = load i32, ptr %arrayidx52.us.3, align 4, !tbaa !13
%cmp31.not.us.3 = icmp eq i32 %p.0.us.3, -1
br i1 %cmp31.not.us.3, label %for.inc54.us.3, label %for.body33.us.3, !llvm.loop !22
for.inc54.us.3: ; preds = %for.body33.us.3, %if.end.us.3, %for.body20.us.3
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv.3, 1
%exitcond.3.not = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.3.not, label %for.cond17.for.inc57_crit_edge.us.3, label %for.body20.us.3, !llvm.loop !23
for.cond17.for.inc57_crit_edge.us.3: ; preds = %for.inc54.us.3
%47 = mul nuw nsw i64 %13, 5
%48 = getelementptr %struct.node, ptr %call7, i64 %47
br label %for.body20.us.4
for.body20.us.4: ; preds = %for.inc54.us.4, %for.cond17.for.inc57_crit_edge.us.3
%indvars.iv.4 = phi i64 [ 0, %for.cond17.for.inc57_crit_edge.us.3 ], [ %indvars.iv.next.4, %for.inc54.us.4 ]
%49 = add nuw nsw i64 %39, %indvars.iv.4
%c25.us.4 = getelementptr inbounds %struct.node, ptr %call7, i64 %49, i32 1
%50 = load i32, ptr %c25.us.4, align 4, !tbaa !19
%cmp26.us.4 = icmp eq i32 %50, 0
br i1 %cmp26.us.4, label %for.inc54.us.4, label %if.end.us.4
if.end.us.4: ; preds = %for.body20.us.4
%arrayidx29.us.4 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.4
%p.0134.us.4 = load i32, ptr %arrayidx29.us.4, align 4, !tbaa !13
%cmp31.not135.us.4 = icmp eq i32 %p.0134.us.4, -1
br i1 %cmp31.not135.us.4, label %for.inc54.us.4, label %for.body33.lr.ph.us.4
for.body33.lr.ph.us.4: ; preds = %if.end.us.4
%arrayidx48.us.4 = getelementptr inbounds %struct.node, ptr %call7, i64 %49
br label %for.body33.us.4
for.body33.us.4: ; preds = %for.body33.us.4, %for.body33.lr.ph.us.4
%p.0136.us.4 = phi i32 [ %p.0134.us.4, %for.body33.lr.ph.us.4 ], [ %p.0.us.4, %for.body33.us.4 ]
%idxprom34.us.4 = sext i32 %p.0136.us.4 to i64
%arrayidx35.us.4 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.4
%51 = load i32, ptr %arrayidx35.us.4, align 4, !tbaa !13
%52 = sext i32 %51 to i64
%arrayidx39.us.4 = getelementptr %struct.node, ptr %48, i64 %52
%53 = load i64, ptr %arrayidx39.us.4, align 4
%54 = load i64, ptr %arrayidx48.us.4, align 4
%a.sroa.0.0.extract.trunc.i.us.4 = trunc i64 %53 to i32
%b.sroa.0.0.extract.trunc.i.us.4 = trunc i64 %54 to i32
%cmp.i.us.4 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.4, %b.sroa.0.0.extract.trunc.i.us.4
%a.coerce.b.coerce.i.us.4 = select i1 %cmp.i.us.4, i64 %53, i64 %54
store i64 %a.coerce.b.coerce.i.us.4, ptr %arrayidx39.us.4, align 4, !tbaa.struct !21
%arrayidx52.us.4 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.4
%p.0.us.4 = load i32, ptr %arrayidx52.us.4, align 4, !tbaa !13
%cmp31.not.us.4 = icmp eq i32 %p.0.us.4, -1
br i1 %cmp31.not.us.4, label %for.inc54.us.4, label %for.body33.us.4, !llvm.loop !22
for.inc54.us.4: ; preds = %for.body33.us.4, %if.end.us.4, %for.body20.us.4
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv.4, 1
%exitcond.4.not = icmp eq i64 %indvars.iv.next.4, %wide.trip.count
br i1 %exitcond.4.not, label %for.cond17.for.inc57_crit_edge.us.4, label %for.body20.us.4, !llvm.loop !23
for.cond17.for.inc57_crit_edge.us.4: ; preds = %for.inc54.us.4
%55 = shl nuw nsw i64 %13, 2
%56 = getelementptr %struct.node, ptr %call7, i64 %55
br label %for.body20.us.5
for.body20.us.5: ; preds = %for.inc54.us.5, %for.cond17.for.inc57_crit_edge.us.4
%indvars.iv.5 = phi i64 [ 0, %for.cond17.for.inc57_crit_edge.us.4 ], [ %indvars.iv.next.5, %for.inc54.us.5 ]
%57 = add nuw nsw i64 %47, %indvars.iv.5
%c25.us.5 = getelementptr inbounds %struct.node, ptr %call7, i64 %57, i32 1
%58 = load i32, ptr %c25.us.5, align 4, !tbaa !19
%cmp26.us.5 = icmp eq i32 %58, 0
br i1 %cmp26.us.5, label %for.inc54.us.5, label %if.end.us.5
if.end.us.5: ; preds = %for.body20.us.5
%arrayidx29.us.5 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.5
%p.0134.us.5 = load i32, ptr %arrayidx29.us.5, align 4, !tbaa !13
%cmp31.not135.us.5 = icmp eq i32 %p.0134.us.5, -1
br i1 %cmp31.not135.us.5, label %for.inc54.us.5, label %for.body33.lr.ph.us.5
for.body33.lr.ph.us.5: ; preds = %if.end.us.5
%arrayidx48.us.5 = getelementptr inbounds %struct.node, ptr %call7, i64 %57
br label %for.body33.us.5
for.body33.us.5: ; preds = %for.body33.us.5, %for.body33.lr.ph.us.5
%p.0136.us.5 = phi i32 [ %p.0134.us.5, %for.body33.lr.ph.us.5 ], [ %p.0.us.5, %for.body33.us.5 ]
%idxprom34.us.5 = sext i32 %p.0136.us.5 to i64
%arrayidx35.us.5 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.5
%59 = load i32, ptr %arrayidx35.us.5, align 4, !tbaa !13
%60 = sext i32 %59 to i64
%arrayidx39.us.5 = getelementptr %struct.node, ptr %56, i64 %60
%61 = load i64, ptr %arrayidx39.us.5, align 4
%62 = load i64, ptr %arrayidx48.us.5, align 4
%a.sroa.0.0.extract.trunc.i.us.5 = trunc i64 %61 to i32
%b.sroa.0.0.extract.trunc.i.us.5 = trunc i64 %62 to i32
%cmp.i.us.5 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.5, %b.sroa.0.0.extract.trunc.i.us.5
%a.coerce.b.coerce.i.us.5 = select i1 %cmp.i.us.5, i64 %61, i64 %62
store i64 %a.coerce.b.coerce.i.us.5, ptr %arrayidx39.us.5, align 4, !tbaa.struct !21
%arrayidx52.us.5 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.5
%p.0.us.5 = load i32, ptr %arrayidx52.us.5, align 4, !tbaa !13
%cmp31.not.us.5 = icmp eq i32 %p.0.us.5, -1
br i1 %cmp31.not.us.5, label %for.inc54.us.5, label %for.body33.us.5, !llvm.loop !22
for.inc54.us.5: ; preds = %for.body33.us.5, %if.end.us.5, %for.body20.us.5
%indvars.iv.next.5 = add nuw nsw i64 %indvars.iv.5, 1
%exitcond.5.not = icmp eq i64 %indvars.iv.next.5, %wide.trip.count
br i1 %exitcond.5.not, label %for.cond17.for.inc57_crit_edge.us.5, label %for.body20.us.5, !llvm.loop !23
for.cond17.for.inc57_crit_edge.us.5: ; preds = %for.inc54.us.5
%63 = mul nuw nsw i64 %13, 3
%64 = getelementptr %struct.node, ptr %call7, i64 %63
br label %for.body20.us.6
for.body20.us.6: ; preds = %for.inc54.us.6, %for.cond17.for.inc57_crit_edge.us.5
%indvars.iv.6 = phi i64 [ 0, %for.cond17.for.inc57_crit_edge.us.5 ], [ %indvars.iv.next.6, %for.inc54.us.6 ]
%65 = add nuw nsw i64 %55, %indvars.iv.6
%c25.us.6 = getelementptr inbounds %struct.node, ptr %call7, i64 %65, i32 1
%66 = load i32, ptr %c25.us.6, align 4, !tbaa !19
%cmp26.us.6 = icmp eq i32 %66, 0
br i1 %cmp26.us.6, label %for.inc54.us.6, label %if.end.us.6
if.end.us.6: ; preds = %for.body20.us.6
%arrayidx29.us.6 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.6
%p.0134.us.6 = load i32, ptr %arrayidx29.us.6, align 4, !tbaa !13
%cmp31.not135.us.6 = icmp eq i32 %p.0134.us.6, -1
br i1 %cmp31.not135.us.6, label %for.inc54.us.6, label %for.body33.lr.ph.us.6
for.body33.lr.ph.us.6: ; preds = %if.end.us.6
%arrayidx48.us.6 = getelementptr inbounds %struct.node, ptr %call7, i64 %65
br label %for.body33.us.6
for.body33.us.6: ; preds = %for.body33.us.6, %for.body33.lr.ph.us.6
%p.0136.us.6 = phi i32 [ %p.0134.us.6, %for.body33.lr.ph.us.6 ], [ %p.0.us.6, %for.body33.us.6 ]
%idxprom34.us.6 = sext i32 %p.0136.us.6 to i64
%arrayidx35.us.6 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.6
%67 = load i32, ptr %arrayidx35.us.6, align 4, !tbaa !13
%68 = sext i32 %67 to i64
%arrayidx39.us.6 = getelementptr %struct.node, ptr %64, i64 %68
%69 = load i64, ptr %arrayidx39.us.6, align 4
%70 = load i64, ptr %arrayidx48.us.6, align 4
%a.sroa.0.0.extract.trunc.i.us.6 = trunc i64 %69 to i32
%b.sroa.0.0.extract.trunc.i.us.6 = trunc i64 %70 to i32
%cmp.i.us.6 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.6, %b.sroa.0.0.extract.trunc.i.us.6
%a.coerce.b.coerce.i.us.6 = select i1 %cmp.i.us.6, i64 %69, i64 %70
store i64 %a.coerce.b.coerce.i.us.6, ptr %arrayidx39.us.6, align 4, !tbaa.struct !21
%arrayidx52.us.6 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.6
%p.0.us.6 = load i32, ptr %arrayidx52.us.6, align 4, !tbaa !13
%cmp31.not.us.6 = icmp eq i32 %p.0.us.6, -1
br i1 %cmp31.not.us.6, label %for.inc54.us.6, label %for.body33.us.6, !llvm.loop !22
for.inc54.us.6: ; preds = %for.body33.us.6, %if.end.us.6, %for.body20.us.6
%indvars.iv.next.6 = add nuw nsw i64 %indvars.iv.6, 1
%exitcond.6.not = icmp eq i64 %indvars.iv.next.6, %wide.trip.count
br i1 %exitcond.6.not, label %for.cond17.for.inc57_crit_edge.us.6, label %for.body20.us.6, !llvm.loop !23
for.cond17.for.inc57_crit_edge.us.6: ; preds = %for.inc54.us.6
%71 = shl nuw nsw i64 %13, 1
%72 = getelementptr %struct.node, ptr %call7, i64 %71
br label %for.body20.us.7
for.body20.us.7: ; preds = %for.inc54.us.7, %for.cond17.for.inc57_crit_edge.us.6
%indvars.iv.7 = phi i64 [ 0, %for.cond17.for.inc57_crit_edge.us.6 ], [ %indvars.iv.next.7, %for.inc54.us.7 ]
%73 = add nuw nsw i64 %63, %indvars.iv.7
%c25.us.7 = getelementptr inbounds %struct.node, ptr %call7, i64 %73, i32 1
%74 = load i32, ptr %c25.us.7, align 4, !tbaa !19
%cmp26.us.7 = icmp eq i32 %74, 0
br i1 %cmp26.us.7, label %for.inc54.us.7, label %if.end.us.7
if.end.us.7: ; preds = %for.body20.us.7
%arrayidx29.us.7 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.7
%p.0134.us.7 = load i32, ptr %arrayidx29.us.7, align 4, !tbaa !13
%cmp31.not135.us.7 = icmp eq i32 %p.0134.us.7, -1
br i1 %cmp31.not135.us.7, label %for.inc54.us.7, label %for.body33.lr.ph.us.7
for.body33.lr.ph.us.7: ; preds = %if.end.us.7
%arrayidx48.us.7 = getelementptr inbounds %struct.node, ptr %call7, i64 %73
br label %for.body33.us.7
for.body33.us.7: ; preds = %for.body33.us.7, %for.body33.lr.ph.us.7
%p.0136.us.7 = phi i32 [ %p.0134.us.7, %for.body33.lr.ph.us.7 ], [ %p.0.us.7, %for.body33.us.7 ]
%idxprom34.us.7 = sext i32 %p.0136.us.7 to i64
%arrayidx35.us.7 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.7
%75 = load i32, ptr %arrayidx35.us.7, align 4, !tbaa !13
%76 = sext i32 %75 to i64
%arrayidx39.us.7 = getelementptr %struct.node, ptr %72, i64 %76
%77 = load i64, ptr %arrayidx39.us.7, align 4
%78 = load i64, ptr %arrayidx48.us.7, align 4
%a.sroa.0.0.extract.trunc.i.us.7 = trunc i64 %77 to i32
%b.sroa.0.0.extract.trunc.i.us.7 = trunc i64 %78 to i32
%cmp.i.us.7 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.7, %b.sroa.0.0.extract.trunc.i.us.7
%a.coerce.b.coerce.i.us.7 = select i1 %cmp.i.us.7, i64 %77, i64 %78
store i64 %a.coerce.b.coerce.i.us.7, ptr %arrayidx39.us.7, align 4, !tbaa.struct !21
%arrayidx52.us.7 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.7
%p.0.us.7 = load i32, ptr %arrayidx52.us.7, align 4, !tbaa !13
%cmp31.not.us.7 = icmp eq i32 %p.0.us.7, -1
br i1 %cmp31.not.us.7, label %for.inc54.us.7, label %for.body33.us.7, !llvm.loop !22
for.inc54.us.7: ; preds = %for.body33.us.7, %if.end.us.7, %for.body20.us.7
%indvars.iv.next.7 = add nuw nsw i64 %indvars.iv.7, 1
%exitcond.7.not = icmp eq i64 %indvars.iv.next.7, %wide.trip.count
br i1 %exitcond.7.not, label %for.cond17.for.inc57_crit_edge.us.7, label %for.body20.us.7, !llvm.loop !23
for.cond17.for.inc57_crit_edge.us.7: ; preds = %for.inc54.us.7
%invariant.gep = getelementptr %struct.node, ptr %call7, i64 %13
br label %for.body20.us.8
for.body20.us.8: ; preds = %for.inc54.us.8, %for.cond17.for.inc57_crit_edge.us.7
%indvars.iv.8 = phi i64 [ 0, %for.cond17.for.inc57_crit_edge.us.7 ], [ %indvars.iv.next.8, %for.inc54.us.8 ]
%79 = add nuw nsw i64 %71, %indvars.iv.8
%c25.us.8 = getelementptr inbounds %struct.node, ptr %call7, i64 %79, i32 1
%80 = load i32, ptr %c25.us.8, align 4, !tbaa !19
%cmp26.us.8 = icmp eq i32 %80, 0
br i1 %cmp26.us.8, label %for.inc54.us.8, label %if.end.us.8
if.end.us.8: ; preds = %for.body20.us.8
%arrayidx29.us.8 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.8
%p.0134.us.8 = load i32, ptr %arrayidx29.us.8, align 4, !tbaa !13
%cmp31.not135.us.8 = icmp eq i32 %p.0134.us.8, -1
br i1 %cmp31.not135.us.8, label %for.inc54.us.8, label %for.body33.lr.ph.us.8
for.body33.lr.ph.us.8: ; preds = %if.end.us.8
%arrayidx48.us.8 = getelementptr inbounds %struct.node, ptr %call7, i64 %79
br label %for.body33.us.8
for.body33.us.8: ; preds = %for.body33.us.8, %for.body33.lr.ph.us.8
%p.0136.us.8 = phi i32 [ %p.0134.us.8, %for.body33.lr.ph.us.8 ], [ %p.0.us.8, %for.body33.us.8 ]
%idxprom34.us.8 = sext i32 %p.0136.us.8 to i64
%arrayidx35.us.8 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.8
%81 = load i32, ptr %arrayidx35.us.8, align 4, !tbaa !13
%82 = sext i32 %81 to i64
%gep = getelementptr %struct.node, ptr %invariant.gep, i64 %82
%83 = load i64, ptr %gep, align 4
%84 = load i64, ptr %arrayidx48.us.8, align 4
%a.sroa.0.0.extract.trunc.i.us.8 = trunc i64 %83 to i32
%b.sroa.0.0.extract.trunc.i.us.8 = trunc i64 %84 to i32
%cmp.i.us.8 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.8, %b.sroa.0.0.extract.trunc.i.us.8
%a.coerce.b.coerce.i.us.8 = select i1 %cmp.i.us.8, i64 %83, i64 %84
store i64 %a.coerce.b.coerce.i.us.8, ptr %gep, align 4, !tbaa.struct !21
%arrayidx52.us.8 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.8
%p.0.us.8 = load i32, ptr %arrayidx52.us.8, align 4, !tbaa !13
%cmp31.not.us.8 = icmp eq i32 %p.0.us.8, -1
br i1 %cmp31.not.us.8, label %for.inc54.us.8, label %for.body33.us.8, !llvm.loop !22
for.inc54.us.8: ; preds = %for.body33.us.8, %if.end.us.8, %for.body20.us.8
%indvars.iv.next.8 = add nuw nsw i64 %indvars.iv.8, 1
%exitcond.8.not = icmp eq i64 %indvars.iv.next.8, %wide.trip.count
br i1 %exitcond.8.not, label %for.body20.us.9, label %for.body20.us.8, !llvm.loop !23
for.body20.us.9: ; preds = %for.inc54.us.8, %for.inc54.us.9
%indvars.iv.9 = phi i64 [ %indvars.iv.next.9, %for.inc54.us.9 ], [ 0, %for.inc54.us.8 ]
%85 = add nuw nsw i64 %indvars.iv.9, %13
%c25.us.9 = getelementptr inbounds %struct.node, ptr %call7, i64 %85, i32 1
%86 = load i32, ptr %c25.us.9, align 4, !tbaa !19
%cmp26.us.9 = icmp eq i32 %86, 0
br i1 %cmp26.us.9, label %for.inc54.us.9, label %if.end.us.9
if.end.us.9: ; preds = %for.body20.us.9
%arrayidx29.us.9 = getelementptr inbounds i32, ptr %call5.i, i64 %indvars.iv.9
%p.0134.us.9 = load i32, ptr %arrayidx29.us.9, align 4, !tbaa !13
%cmp31.not135.us.9 = icmp eq i32 %p.0134.us.9, -1
br i1 %cmp31.not135.us.9, label %for.inc54.us.9, label %for.body33.lr.ph.us.9
for.body33.lr.ph.us.9: ; preds = %if.end.us.9
%arrayidx48.us.9 = getelementptr inbounds %struct.node, ptr %call7, i64 %85
br label %for.body33.us.9
for.body33.us.9: ; preds = %for.body33.us.9, %for.body33.lr.ph.us.9
%p.0136.us.9 = phi i32 [ %p.0134.us.9, %for.body33.lr.ph.us.9 ], [ %p.0.us.9, %for.body33.us.9 ]
%idxprom34.us.9 = sext i32 %p.0136.us.9 to i64
%arrayidx35.us.9 = getelementptr inbounds i32, ptr %call1.i, i64 %idxprom34.us.9
%87 = load i32, ptr %arrayidx35.us.9, align 4, !tbaa !13
%88 = sext i32 %87 to i64
%arrayidx39.us.9 = getelementptr inbounds %struct.node, ptr %call7, i64 %88
%89 = load i64, ptr %arrayidx39.us.9, align 4
%90 = load i64, ptr %arrayidx48.us.9, align 4
%a.sroa.0.0.extract.trunc.i.us.9 = trunc i64 %89 to i32
%b.sroa.0.0.extract.trunc.i.us.9 = trunc i64 %90 to i32
%cmp.i.us.9 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i.us.9, %b.sroa.0.0.extract.trunc.i.us.9
%a.coerce.b.coerce.i.us.9 = select i1 %cmp.i.us.9, i64 %89, i64 %90
store i64 %a.coerce.b.coerce.i.us.9, ptr %arrayidx39.us.9, align 4, !tbaa.struct !21
%arrayidx52.us.9 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom34.us.9
%p.0.us.9 = load i32, ptr %arrayidx52.us.9, align 4, !tbaa !13
%cmp31.not.us.9 = icmp eq i32 %p.0.us.9, -1
br i1 %cmp31.not.us.9, label %for.inc54.us.9, label %for.body33.us.9, !llvm.loop !22
for.inc54.us.9: ; preds = %for.body33.us.9, %if.end.us.9, %for.body20.us.9
%indvars.iv.next.9 = add nuw nsw i64 %indvars.iv.9, 1
%exitcond.9.not = icmp eq i64 %indvars.iv.next.9, %wide.trip.count
br i1 %exitcond.9.not, label %for.cond60.preheader, label %for.body20.us.9, !llvm.loop !23
for.body: ; preds = %while.end, %for.body
%i.0133 = phi i32 [ %inc, %for.body ], [ 1, %while.end ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #13
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #13
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #13
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %d, ptr noundef nonnull %c)
%91 = load i32, ptr %v, align 4, !tbaa !13
%dec10 = add nsw i32 %91, -1
%92 = load i32, ptr %d, align 4, !tbaa !13
%93 = load i32, ptr %n, align 4, !tbaa !13
%mul11 = mul nsw i32 %93, %92
%add = add nsw i32 %mul11, %dec10
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds %struct.node, ptr %call7, i64 %idxprom
%94 = load i32, ptr %c, align 4, !tbaa !13
store i32 %i.0133, ptr %arrayidx, align 4, !tbaa.struct !21
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 4
store i32 %94, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !24
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #13
%inc = add nuw nsw i32 %i.0133, 1
%95 = load i32, ptr %q, align 4, !tbaa !13
%cmp.not.not = icmp slt i32 %i.0133, %95
br i1 %cmp.not.not, label %for.body, label %for.cond13.preheader, !llvm.loop !25
for.cond60.preheader: ; preds = %for.inc54.us.9
br i1 %cmp18137, label %for.cond65.preheader, label %for.end82
for.cond65.preheader: ; preds = %for.cond60.preheader, %for.cond65.preheader
%indvars.iv160 = phi i64 [ %indvars.iv.next161, %for.cond65.preheader ], [ 0, %for.cond60.preheader ]
%96 = phi i32 [ %129, %for.cond65.preheader ], [ %12, %for.cond60.preheader ]
%97 = sext i32 %96 to i64
%arrayidx73 = getelementptr inbounds %struct.node, ptr %call7, i64 %indvars.iv160
%98 = load i64, ptr %arrayidx73, align 4
%99 = and i64 %98, 2147483648
%cmp.i128.not = icmp eq i64 %99, 0
%a.coerce.b.coerce.i129 = select i1 %cmp.i128.not, i64 %98, i64 0
%100 = getelementptr %struct.node, ptr %call7, i64 %indvars.iv160
%arrayidx73.1 = getelementptr %struct.node, ptr %100, i64 %97
%101 = load i64, ptr %arrayidx73.1, align 4
%a.sroa.0.0.extract.trunc.i126.1 = trunc i64 %a.coerce.b.coerce.i129 to i32
%b.sroa.0.0.extract.trunc.i127.1 = trunc i64 %101 to i32
%cmp.i128.1 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.1, %b.sroa.0.0.extract.trunc.i127.1
%a.coerce.b.coerce.i129.1 = select i1 %cmp.i128.1, i64 %a.coerce.b.coerce.i129, i64 %101
%102 = shl nsw i64 %97, 1
%103 = getelementptr %struct.node, ptr %call7, i64 %102
%arrayidx73.2 = getelementptr %struct.node, ptr %103, i64 %indvars.iv160
%104 = load i64, ptr %arrayidx73.2, align 4
%a.sroa.0.0.extract.trunc.i126.2 = trunc i64 %a.coerce.b.coerce.i129.1 to i32
%b.sroa.0.0.extract.trunc.i127.2 = trunc i64 %104 to i32
%cmp.i128.2 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.2, %b.sroa.0.0.extract.trunc.i127.2
%a.coerce.b.coerce.i129.2 = select i1 %cmp.i128.2, i64 %a.coerce.b.coerce.i129.1, i64 %104
%105 = mul nsw i64 %97, 3
%106 = getelementptr %struct.node, ptr %call7, i64 %105
%arrayidx73.3 = getelementptr %struct.node, ptr %106, i64 %indvars.iv160
%107 = load i64, ptr %arrayidx73.3, align 4
%a.sroa.0.0.extract.trunc.i126.3 = trunc i64 %a.coerce.b.coerce.i129.2 to i32
%b.sroa.0.0.extract.trunc.i127.3 = trunc i64 %107 to i32
%cmp.i128.3 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.3, %b.sroa.0.0.extract.trunc.i127.3
%a.coerce.b.coerce.i129.3 = select i1 %cmp.i128.3, i64 %a.coerce.b.coerce.i129.2, i64 %107
%108 = shl nsw i64 %97, 2
%109 = getelementptr %struct.node, ptr %call7, i64 %108
%arrayidx73.4 = getelementptr %struct.node, ptr %109, i64 %indvars.iv160
%110 = load i64, ptr %arrayidx73.4, align 4
%a.sroa.0.0.extract.trunc.i126.4 = trunc i64 %a.coerce.b.coerce.i129.3 to i32
%b.sroa.0.0.extract.trunc.i127.4 = trunc i64 %110 to i32
%cmp.i128.4 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.4, %b.sroa.0.0.extract.trunc.i127.4
%a.coerce.b.coerce.i129.4 = select i1 %cmp.i128.4, i64 %a.coerce.b.coerce.i129.3, i64 %110
%111 = mul nsw i64 %97, 5
%112 = getelementptr %struct.node, ptr %call7, i64 %111
%arrayidx73.5 = getelementptr %struct.node, ptr %112, i64 %indvars.iv160
%113 = load i64, ptr %arrayidx73.5, align 4
%a.sroa.0.0.extract.trunc.i126.5 = trunc i64 %a.coerce.b.coerce.i129.4 to i32
%b.sroa.0.0.extract.trunc.i127.5 = trunc i64 %113 to i32
%cmp.i128.5 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.5, %b.sroa.0.0.extract.trunc.i127.5
%a.coerce.b.coerce.i129.5 = select i1 %cmp.i128.5, i64 %a.coerce.b.coerce.i129.4, i64 %113
%114 = mul nsw i64 %97, 6
%115 = getelementptr %struct.node, ptr %call7, i64 %114
%arrayidx73.6 = getelementptr %struct.node, ptr %115, i64 %indvars.iv160
%116 = load i64, ptr %arrayidx73.6, align 4
%a.sroa.0.0.extract.trunc.i126.6 = trunc i64 %a.coerce.b.coerce.i129.5 to i32
%b.sroa.0.0.extract.trunc.i127.6 = trunc i64 %116 to i32
%cmp.i128.6 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.6, %b.sroa.0.0.extract.trunc.i127.6
%a.coerce.b.coerce.i129.6 = select i1 %cmp.i128.6, i64 %a.coerce.b.coerce.i129.5, i64 %116
%117 = mul nsw i64 %97, 7
%118 = getelementptr %struct.node, ptr %call7, i64 %117
%arrayidx73.7 = getelementptr %struct.node, ptr %118, i64 %indvars.iv160
%119 = load i64, ptr %arrayidx73.7, align 4
%a.sroa.0.0.extract.trunc.i126.7 = trunc i64 %a.coerce.b.coerce.i129.6 to i32
%b.sroa.0.0.extract.trunc.i127.7 = trunc i64 %119 to i32
%cmp.i128.7 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.7, %b.sroa.0.0.extract.trunc.i127.7
%a.coerce.b.coerce.i129.7 = select i1 %cmp.i128.7, i64 %a.coerce.b.coerce.i129.6, i64 %119
%120 = shl nsw i64 %97, 3
%121 = getelementptr %struct.node, ptr %call7, i64 %120
%arrayidx73.8 = getelementptr %struct.node, ptr %121, i64 %indvars.iv160
%122 = load i64, ptr %arrayidx73.8, align 4
%a.sroa.0.0.extract.trunc.i126.8 = trunc i64 %a.coerce.b.coerce.i129.7 to i32
%b.sroa.0.0.extract.trunc.i127.8 = trunc i64 %122 to i32
%cmp.i128.8 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.8, %b.sroa.0.0.extract.trunc.i127.8
%a.coerce.b.coerce.i129.8 = select i1 %cmp.i128.8, i64 %a.coerce.b.coerce.i129.7, i64 %122
%123 = mul nsw i64 %97, 9
%124 = getelementptr %struct.node, ptr %call7, i64 %123
%arrayidx73.9 = getelementptr %struct.node, ptr %124, i64 %indvars.iv160
%125 = load i64, ptr %arrayidx73.9, align 4
%a.sroa.0.0.extract.trunc.i126.9 = trunc i64 %a.coerce.b.coerce.i129.8 to i32
%b.sroa.0.0.extract.trunc.i127.9 = trunc i64 %125 to i32
%cmp.i128.9 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.9, %b.sroa.0.0.extract.trunc.i127.9
%a.coerce.b.coerce.i129.9 = select i1 %cmp.i128.9, i64 %a.coerce.b.coerce.i129.8, i64 %125
%126 = mul nsw i64 %97, 10
%127 = getelementptr %struct.node, ptr %call7, i64 %126
%arrayidx73.10 = getelementptr %struct.node, ptr %127, i64 %indvars.iv160
%128 = load i64, ptr %arrayidx73.10, align 4
%a.sroa.0.0.extract.trunc.i126.10 = trunc i64 %a.coerce.b.coerce.i129.9 to i32
%b.sroa.0.0.extract.trunc.i127.10 = trunc i64 %128 to i32
%cmp.i128.10 = icmp sgt i32 %a.sroa.0.0.extract.trunc.i126.10, %b.sroa.0.0.extract.trunc.i127.10
%a.coerce.b.coerce.i129.10 = select i1 %cmp.i128.10, i64 %a.coerce.b.coerce.i129.9, i64 %128
%t64.sroa.5.0.extract.shift.10 = lshr i64 %a.coerce.b.coerce.i129.10, 32
%t64.sroa.5.0.extract.trunc = trunc i64 %t64.sroa.5.0.extract.shift.10 to i32
%call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %t64.sroa.5.0.extract.trunc)
%indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
%129 = load i32, ptr %n, align 4, !tbaa !13
%130 = sext i32 %129 to i64
%cmp61 = icmp slt i64 %indvars.iv.next161, %130
br i1 %cmp61, label %for.cond65.preheader, label %for.end82, !llvm.loop !26
for.end82: ; preds = %for.cond65.preheader, %for.cond13.preheader, %for.cond60.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #13
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #10
attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind allocsize(0,1) }
attributes #13 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"directedGraph", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 16}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !10, i64 28}
!16 = !{!6, !10, i64 32}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !10, i64 4}
!20 = !{!"node", !10, i64 0, !10, i64 4}
!21 = !{i64 0, i64 4, !13, i64 4, i64 4, !13}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}
!24 = !{i64 0, i64 4, !13}
!25 = distinct !{!25, !18}
!26 = distinct !{!26, !18}
|
#include <stdio.h>
int main(void){
int n, m, max;
int a[1001];
while(1){
scanf("%d %d", &n, &m);
if(n == 0 && m == 0) break;
for(int i=0; i<n; i++){
scanf("%d", &a[i]);
}
max = -1;
for(int i=0; i<n-1; i++){
for(int j=i+1; j<n; j++){
if(max < a[i]+a[j] && a[i]+a[j] <= m){
max = a[i]+a[j];
}
}
}
if(max == -1) printf("NONE\n");
else printf("%d\n", max);
}//endwhile
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229662/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229662/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [5 x i8] c"NONE\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [1001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %a) #4
%call68 = 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
%cmp69 = icmp eq i32 %0, 0
%1 = load i32, ptr %m, align 4
%cmp170 = icmp eq i32 %1, 0
%or.cond71 = select i1 %cmp69, i1 %cmp170, i1 false
br i1 %or.cond71, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %if.end43
%2 = phi i32 [ %9, %if.end43 ], [ %0, %entry ]
%cmp258 = icmp sgt i32 %2, 0
br i1 %cmp258, label %for.body, label %if.then40
for.cond5.preheader: ; preds = %for.body
%cmp664 = icmp sgt i32 %5, 1
br i1 %cmp664, label %for.body8.lr.ph, label %if.then40
for.body8.lr.ph: ; preds = %for.cond5.preheader
%sub = add nsw i32 %5, -1
%3 = load i32, ptr %m, align 4
%4 = zext i32 %5 to i64
%wide.trip.count82 = zext i32 %sub to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.body8
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp2, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond5.loopexit: ; preds = %for.body12, %for.body8
%max.1.lcssa = phi i32 [ %max.065, %for.body8 ], [ %max.2, %for.body12 ]
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%exitcond83.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count82
br i1 %exitcond83.not, label %for.cond.cleanup7, label %for.body8, !llvm.loop !11
for.cond.cleanup7: ; preds = %for.cond5.loopexit
%cmp39 = icmp eq i32 %max.1.lcssa, -1
br i1 %cmp39, label %if.then40, label %if.else
for.body8: ; preds = %for.body8.lr.ph, %for.cond5.loopexit
%indvars.iv79 = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next80, %for.cond5.loopexit ]
%indvars.iv74 = phi i64 [ 1, %for.body8.lr.ph ], [ %indvars.iv.next75, %for.cond5.loopexit ]
%max.065 = phi i32 [ -1, %for.body8.lr.ph ], [ %max.1.lcssa, %for.cond5.loopexit ]
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%cmp1060 = icmp ult i64 %indvars.iv.next80, %4
br i1 %cmp1060, label %for.body12.lr.ph, label %for.cond5.loopexit
for.body12.lr.ph: ; preds = %for.body8
%arrayidx14 = getelementptr inbounds [1001 x i32], ptr %a, i64 0, i64 %indvars.iv79
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
br label %for.body12
for.body12: ; preds = %for.body12.lr.ph, %for.body12
%indvars.iv76 = phi i64 [ %indvars.iv74, %for.body12.lr.ph ], [ %indvars.iv.next77, %for.body12 ]
%max.161 = phi i32 [ %max.065, %for.body12.lr.ph ], [ %max.2, %for.body12 ]
%arrayidx16 = getelementptr inbounds [1001 x i32], ptr %a, i64 0, i64 %indvars.iv76
%8 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%add17 = add nsw i32 %8, %7
%cmp18 = icmp sge i32 %max.161, %add17
%cmp25.not = icmp sgt i32 %add17, %3
%or.cond57 = select i1 %cmp18, i1 true, i1 %cmp25.not
%max.2 = select i1 %or.cond57, i32 %max.161, i32 %add17
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
br i1 %exitcond.not, label %for.cond5.loopexit, label %for.body12, !llvm.loop !12
if.then40: ; preds = %for.cond.preheader, %for.cond5.preheader, %for.cond.cleanup7
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end43
if.else: ; preds = %for.cond.cleanup7
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %max.1.lcssa)
br label %if.end43
if.end43: ; preds = %if.else, %if.then40
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %m, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %if.end43, %entry
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main()
{
int i;
int m, n;
int total_payment;
int money;
int payment;
while (1) {
total_payment = 0;
scanf("%d %d", &n, &m);
if (m == 0 && n == 0) break;
payment = m / n;
for (i = 0; i < n; i++) {
scanf("%d", &money);
if (money >= payment) {
total_payment += payment;
} else {
total_payment += money;
}
}
printf("%d\n", total_payment);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229705/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229705/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%money = 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 %money) #4
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp17 = icmp eq i32 %0, 0
%1 = load i32, ptr %n, align 4
%cmp118 = icmp eq i32 %1, 0
%or.cond19 = select i1 %cmp17, i1 %cmp118, i1 false
br i1 %or.cond19, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%2 = phi i32 [ %7, %for.end ], [ %1, %entry ]
%3 = phi i32 [ %6, %for.end ], [ %0, %entry ]
%div = sdiv i32 %3, %2
%cmp213 = icmp sgt i32 %2, 0
br i1 %cmp213, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%i.015 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%total_payment.014 = phi i32 [ %total_payment.1, %for.body ], [ 0, %if.end ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %money)
%4 = load i32, ptr %money, align 4, !tbaa !5
%.div = call i32 @llvm.smin.i32(i32 %4, i32 %div)
%total_payment.1 = add nsw i32 %.div, %total_payment.014
%inc = add nuw nsw i32 %i.015, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc, %5
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %if.end
%total_payment.0.lcssa = phi i32 [ 0, %if.end ], [ %total_payment.1, %for.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %total_payment.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%6 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %n, align 4
%cmp1 = icmp eq i32 %7, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %money) #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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
int i, x, n;
scanf("%d", &n);
for ( i = 1; i <= n; i++){
x = i;
if (x % 3 ==0){
printf(" %d", i);
} else {
do {
if (x % 10 == 3){
printf(" %d", i);
break;
} else {
x = x / 10;
}
} while (x);
}
}
printf("\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229749/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229749/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not17 = icmp slt i32 %0, 1
br i1 %cmp.not17, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.018 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.018, 3
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.inc.sink.split, label %do.body
do.body: ; preds = %for.body, %if.else7
%x.0 = phi i32 [ %div, %if.else7 ], [ %i.018, %for.body ]
%rem3 = srem i32 %x.0, 10
%div = sdiv i32 %x.0, 10
%cmp4 = icmp eq i32 %rem3, 3
br i1 %cmp4, label %for.inc.sink.split, label %if.else7
if.else7: ; preds = %do.body
%x.0.off = add i32 %x.0, 9
%tobool.not = icmp ult i32 %x.0.off, 19
br i1 %tobool.not, label %for.inc, label %do.body, !llvm.loop !9
for.inc.sink.split: ; preds = %do.body, %for.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.018)
br label %for.inc
for.inc: ; preds = %if.else7, %for.inc.sink.split
%inc = add nuw nsw i32 %i.018, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.018, %1
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
void call(int n) {
int i,d,flag;
//scanf("%d",&n);
for(i=1;i<=n;i++){
if(i%3==0){
printf(" %d",i);
}else
{
d=1;
flag=0;
while(flag==0)
{
if((i%(10*d)-i%d)/d==3)
{
printf(" %d",i);
flag=1;
}else{
d=d*10;
flag=(i/d==0)?1:0;
}
}
}
}
}
int main() {
int n;
scanf("%d",&n);
call(n);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229792/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229792/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @call(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not25 = icmp slt i32 %n, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.026 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.026, 3
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.inc.sink.split, label %while.body
while.body: ; preds = %for.body, %if.end
%d.024 = phi i32 [ %mul, %if.end ], [ 1, %for.body ]
%mul = mul nsw i32 %d.024, 10
%rem3 = srem i32 %i.026, %mul
%div10 = sdiv i32 %i.026, %mul
%rem4 = srem i32 %i.026, %d.024
%sub = sub nsw i32 %rem3, %rem4
%div = sdiv i32 %sub, %d.024
%cmp5 = icmp eq i32 %div, 3
br i1 %cmp5, label %for.inc.sink.split, label %if.end
if.end: ; preds = %while.body
%cmp11.not = icmp eq i32 %div10, 0
br i1 %cmp11.not, label %for.inc, label %while.body, !llvm.loop !5
for.inc.sink.split: ; preds = %while.body, %for.body
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.026)
br label %for.inc
for.inc: ; preds = %if.end, %for.inc.sink.split
%inc = add nuw i32 %i.026, 1
%exitcond.not = icmp eq i32 %i.026, %n
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !7
for.end: ; preds = %for.inc, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !8
%cmp.not25.i = icmp slt i32 %0, 1
br i1 %cmp.not25.i, label %call.exit, label %for.body.i
for.body.i: ; preds = %entry, %for.inc.i
%i.026.i = phi i32 [ %inc.i, %for.inc.i ], [ 1, %entry ]
%rem.i = urem i32 %i.026.i, 3
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %for.inc.sink.split.i, label %while.body.i
while.body.i: ; preds = %for.body.i, %if.end.i
%d.024.i = phi i32 [ %mul.i, %if.end.i ], [ 1, %for.body.i ]
%mul.i = mul nuw nsw i32 %d.024.i, 10
%rem3.i = srem i32 %i.026.i, %mul.i
%div10.i = sdiv i32 %i.026.i, %mul.i
%rem4.i.urem = urem i32 %i.026.i, %d.024.i
%sub.i = sub nsw i32 %rem3.i, %rem4.i.urem
%div.i = sdiv i32 %sub.i, %d.024.i
%cmp5.i = icmp eq i32 %div.i, 3
br i1 %cmp5.i, label %for.inc.sink.split.i, label %if.end.i
if.end.i: ; preds = %while.body.i
%cmp11.not.i = icmp eq i32 %div10.i, 0
br i1 %cmp11.not.i, label %for.inc.i, label %while.body.i, !llvm.loop !5
for.inc.sink.split.i: ; preds = %while.body.i, %for.body.i
%call7.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.026.i)
br label %for.inc.i
for.inc.i: ; preds = %if.end.i, %for.inc.sink.split.i
%inc.i = add nuw i32 %i.026.i, 1
%exitcond.not.i = icmp eq i32 %i.026.i, %0
br i1 %exitcond.not.i, label %call.exit, label %for.body.i, !llvm.loop !7
call.exit: ; preds = %for.inc.i, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int N,i,x;
int main()
{
scanf("%d",&N);
for(i=1;i<=N;i++)
{
x=i;
if(x%3==0)printf(" %d",i);
else
{
for(;x&&x%10!=3;)
x/=10;
if(x%10==3)
printf(" %d",i);
}
}
puts("");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229835/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229835/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@x = dso_local local_unnamed_addr global i32 0, align 4
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
store i32 1, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp.not21 = icmp slt i32 %0, 1
br i1 %cmp.not21, label %for.end12, label %for.body
for.body: ; preds = %entry, %for.inc
%x.promoted = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
store i32 %x.promoted, ptr @x, align 4, !tbaa !5
%rem = srem i32 %x.promoted, 3
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.inc.sink.split, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body
%tobool.not16 = icmp eq i32 %x.promoted, 0
%rem417 = srem i32 %x.promoted, 10
%cmp5.not18 = icmp eq i32 %rem417, 3
%or.cond19 = or i1 %tobool.not16, %cmp5.not18
br i1 %or.cond19, label %for.end, label %for.body6
for.body6: ; preds = %for.cond3.preheader, %for.body6
%div1520 = phi i32 [ %div, %for.body6 ], [ %x.promoted, %for.cond3.preheader ]
%div = sdiv i32 %div1520, 10
%div1520.off = add i32 %div1520, 9
%tobool.not = icmp ult i32 %div1520.off, 19
%rem4 = srem i32 %div, 10
%cmp5.not = icmp eq i32 %rem4, 3
%or.cond = or i1 %tobool.not, %cmp5.not
br i1 %or.cond, label %for.cond3.for.end_crit_edge, label %for.body6, !llvm.loop !9
for.cond3.for.end_crit_edge: ; preds = %for.body6
store i32 %div, ptr @x, align 4, !tbaa !5
br i1 %cmp5.not, label %for.inc.sink.split, label %for.inc
for.end: ; preds = %for.cond3.preheader
br i1 %cmp5.not18, label %for.inc.sink.split, label %for.inc
for.inc.sink.split: ; preds = %for.end, %for.cond3.for.end_crit_edge, %for.body
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.promoted)
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %for.cond3.for.end_crit_edge, %for.end
%1 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @N, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %1, %2
br i1 %cmp.not.not, label %for.body, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc, %entry
%putchar = tail call i32 @putchar(i32 10)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
int main(){
int i=1, n,x;
scanf("%d", &n);
while (1){
x = i;
if (x % 3 == 0){
printf(" %d", i);
}
else{
while (1){
if (x % 10 == 3){
printf(" %d", i);
break;
}
x /= 10;
if (!x)break;
}
}
if (++i > n) break;
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229879/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229879/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
br label %while.cond
while.cond: ; preds = %if.end10, %entry
%i.0 = phi i32 [ 1, %entry ], [ %inc, %if.end10 ]
%rem = urem i32 %i.0, 3
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %if.end10.sink.split, label %while.cond2
while.cond2: ; preds = %while.cond, %if.end
%x.0 = phi i32 [ %div, %if.end ], [ %i.0, %while.cond ]
%rem4 = srem i32 %x.0, 10
%div = sdiv i32 %x.0, 10
%cmp5 = icmp eq i32 %rem4, 3
br i1 %cmp5, label %if.end10.sink.split, label %if.end
if.end: ; preds = %while.cond2
%x.0.off = add i32 %x.0, 9
%tobool.not = icmp ult i32 %x.0.off, 19
br i1 %tobool.not, label %if.end10, label %while.cond2
if.end10.sink.split: ; preds = %while.cond2, %while.cond
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0)
br label %if.end10
if.end10: ; preds = %if.end, %if.end10.sink.split
%inc = add nuw nsw i32 %i.0, 1
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11.not = icmp slt i32 %i.0, %0
br i1 %cmp11.not, label %while.cond, label %while.end14
while.end14: ; preds = %if.end10
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int i;
int x;
int n;
scanf("%d", &n);
i = 1;
do {
if(i % 3 == 0) {
printf(" %d", i);
continue;
}
x = i;
do {
if(x % 10 == 3) {
printf(" %d", i);
break;
}
x /= 10;
}
while(x);
}
while(++i <= n);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229921/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229921/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
br label %do.body
do.body: ; preds = %do.cond8, %entry
%i.0 = phi i32 [ 1, %entry ], [ %inc, %do.cond8 ]
%rem = urem i32 %i.0, 3
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %do.cond8.sink.split, label %do.body2
do.body2: ; preds = %do.body, %if.end7
%x.0 = phi i32 [ %div, %if.end7 ], [ %i.0, %do.body ]
%rem3 = srem i32 %x.0, 10
%div = sdiv i32 %x.0, 10
%cmp4 = icmp eq i32 %rem3, 3
br i1 %cmp4, label %do.cond8.sink.split, label %if.end7
if.end7: ; preds = %do.body2
%x.0.off = add i32 %x.0, 9
%tobool.not = icmp ult i32 %x.0.off, 19
br i1 %tobool.not, label %do.cond8, label %do.body2, !llvm.loop !5
do.cond8.sink.split: ; preds = %do.body2, %do.body
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0)
br label %do.cond8
do.cond8: ; preds = %if.end7, %do.cond8.sink.split
%inc = add nuw nsw i32 %i.0, 1
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp9.not.not = icmp slt i32 %i.0, %0
br i1 %cmp9.not.not, label %do.body, label %do.end10, !llvm.loop !11
do.end10: ; preds = %do.cond8
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
void call(int n);
int include3(int n);
int main(void){
int num;
scanf("%d",&num);
call(num);
return 0;
}
void call(int n){
int i;
for(i=1;i<=n;i++){
if(i%3==0||include3(i)){
printf(" %d",i);
}
}
printf("\n");
}
int include3(int n){
if(n%10==3){
return 1;
}else{
if(n<10) return 0;
return include3(n/10);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_229965/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_229965/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp.not10.i = icmp slt i32 %0, 1
br i1 %cmp.not10.i, label %call.exit, label %for.body.i
for.body.i: ; preds = %entry, %for.inc.i
%i.011.i = phi i32 [ %inc.i, %for.inc.i ], [ 1, %entry ]
%rem.i = urem i32 %i.011.i, 3
%cmp1.i = icmp eq i32 %rem.i, 0
%rem5.i.i = urem i32 %i.011.i, 10
%cmp6.i.i = icmp eq i32 %rem5.i.i, 3
%or.cond.i = or i1 %cmp1.i, %cmp6.i.i
br i1 %or.cond.i, label %if.then.i, label %if.else.i.i
if.else.i.i: ; preds = %for.body.i, %if.end.i.i
%n.tr7.i.i = phi i32 [ %div.i.i, %if.end.i.i ], [ %i.011.i, %for.body.i ]
%cmp1.i.i = icmp ult i32 %n.tr7.i.i, 10
br i1 %cmp1.i.i, label %for.inc.i, label %if.end.i.i
if.end.i.i: ; preds = %if.else.i.i
%div.i.i = udiv i32 %n.tr7.i.i, 10
%rem.i.i = urem i32 %div.i.i, 10
%cmp.i.i = icmp eq i32 %rem.i.i, 3
br i1 %cmp.i.i, label %if.then.i, label %if.else.i.i
if.then.i: ; preds = %if.end.i.i, %for.body.i
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.011.i)
br label %for.inc.i
for.inc.i: ; preds = %if.else.i.i, %if.then.i
%inc.i = add nuw i32 %i.011.i, 1
%exitcond.not.i = icmp eq i32 %i.011.i, %0
br i1 %exitcond.not.i, label %call.exit, label %for.body.i, !llvm.loop !9
call.exit: ; preds = %for.inc.i, %entry
%putchar.i = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @call(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not10 = icmp slt i32 %n, 1
br i1 %cmp.not10, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.011 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.011, 3
%cmp1 = icmp eq i32 %rem, 0
%rem5.i = urem i32 %i.011, 10
%cmp6.i = icmp eq i32 %rem5.i, 3
%or.cond = or i1 %cmp1, %cmp6.i
br i1 %or.cond, label %if.then, label %if.else.i
if.else.i: ; preds = %for.body, %if.end.i
%n.tr7.i = phi i32 [ %div.i, %if.end.i ], [ %i.011, %for.body ]
%cmp1.i = icmp ult i32 %n.tr7.i, 10
br i1 %cmp1.i, label %for.inc, label %if.end.i
if.end.i: ; preds = %if.else.i
%div.i = udiv i32 %n.tr7.i, 10
%rem.i = urem i32 %div.i, 10
%cmp.i = icmp eq i32 %rem.i, 3
br i1 %cmp.i, label %if.then, label %if.else.i
if.then: ; preds = %if.end.i, %for.body
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.011)
br label %for.inc
for.inc: ; preds = %if.else.i, %if.then
%inc = add nuw i32 %i.011, 1
%exitcond.not = icmp eq i32 %i.011, %n
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @include3(i32 noundef %n) local_unnamed_addr #3 {
entry:
%rem5 = srem i32 %n, 10
%cmp6 = icmp eq i32 %rem5, 3
br i1 %cmp6, label %return, label %if.else
if.else: ; preds = %entry, %if.end
%n.tr7 = phi i32 [ %div, %if.end ], [ %n, %entry ]
%cmp1 = icmp slt i32 %n.tr7, 10
br i1 %cmp1, label %return, label %if.end
if.end: ; preds = %if.else
%div = udiv i32 %n.tr7, 10
%rem = urem i32 %div, 10
%cmp = icmp eq i32 %rem, 3
br i1 %cmp, label %return, label %if.else
return: ; preds = %if.end, %if.else, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.else ], [ 1, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int n,i,j,tmp;
scanf("%d",&n);
for(i=0;i<n;i++){
tmp=i+1;
for(j=0;j<4;j++){
if((i+1)%3==0){
printf(" %d",i+1);
break;
}else if(tmp%10==3){
printf(" %d",i+1);
break;
}
tmp=tmp/10;
}if(i==n-1){
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230006/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230006/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.end20
for.body: ; preds = %entry, %for.inc18
%i.032 = phi i32 [ %add, %for.inc18 ], [ 0, %entry ]
%add = add nuw nsw i32 %i.032, 1
%rem = urem i32 %add, 3
%cmp5 = icmp eq i32 %rem, 0
%rem8.urem = urem i32 %add, 10
%div.udiv = udiv i32 %add, 10
%cmp9 = icmp eq i32 %rem8.urem, 3
%or.cond = or i1 %cmp5, %cmp9
%rem8.1 = urem i32 %div.udiv, 10
%cmp9.1 = icmp eq i32 %rem8.1, 3
%or.cond33 = or i1 %or.cond, %cmp9.1
br i1 %or.cond33, label %for.end.sink.split, label %if.end13.1
if.end13.1: ; preds = %for.body
%div.1 = udiv i32 %add, 100
%rem8.2 = urem i32 %div.1, 10
%cmp9.2 = icmp eq i32 %rem8.2, 3
br i1 %cmp9.2, label %for.end.sink.split, label %if.end13.2
if.end13.2: ; preds = %if.end13.1
%div.2 = udiv i32 %add, 1000
%rem8.3 = urem i32 %div.2, 10
%cmp9.3 = icmp eq i32 %rem8.3, 3
br i1 %cmp9.3, label %for.end.sink.split, label %for.end
for.end.sink.split: ; preds = %if.end13.1, %if.end13.2, %for.body
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %for.end
for.end: ; preds = %for.end.sink.split, %if.end13.2
%1 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%cmp14 = icmp eq i32 %i.032, %sub
br i1 %cmp14, label %if.then15, label %for.inc18
if.then15: ; preds = %for.end
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc18
for.inc18: ; preds = %for.end, %if.then15
%2 = phi i32 [ %1, %for.end ], [ %.pre, %if.then15 ]
%cmp = icmp slt i32 %add, %2
br i1 %cmp, label %for.body, label %for.end20, !llvm.loop !9
for.end20: ; preds = %for.inc18, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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"}
|
#include <stdio.h>
int main()
{
int a,i;
scanf("%d",&a);
for(i=1;i<=a;i++){
if(i%3==0)printf(" %d",i);
else if(i%10==3 || i/10%10==3 || i/100%10==3 || i/1000%10==3 )printf(" %d",i);
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230057/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230057/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not27 = icmp slt i32 %0, 1
br i1 %cmp.not27, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.028 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.028, 3
%cmp1 = icmp eq i32 %rem, 0
%rem3 = urem i32 %i.028, 10
%div = udiv i32 %i.028, 10
%cmp4 = icmp eq i32 %rem3, 3
%or.cond = or i1 %cmp1, %cmp4
%rem5 = urem i32 %div, 10
%cmp6 = icmp eq i32 %rem5, 3
%or.cond30 = or i1 %or.cond, %cmp6
br i1 %or.cond30, label %for.inc.sink.split, label %lor.lhs.false7
lor.lhs.false7: ; preds = %for.body
%div8 = udiv i32 %i.028, 100
%rem9 = urem i32 %div8, 10
%cmp10 = icmp eq i32 %rem9, 3
br i1 %cmp10, label %for.inc.sink.split, label %lor.lhs.false11
lor.lhs.false11: ; preds = %lor.lhs.false7
%div12 = udiv i32 %i.028, 1000
%rem13 = urem i32 %div12, 10
%cmp14 = icmp eq i32 %rem13, 3
br i1 %cmp14, label %for.inc.sink.split, label %for.inc
for.inc.sink.split: ; preds = %lor.lhs.false7, %lor.lhs.false11, %for.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.028)
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %lor.lhs.false11
%inc = add nuw nsw i32 %i.028, 1
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.028, %1
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%putchar = call i32 @putchar(i32 10)
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 @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"}
|
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main(void) {
int num;
scanf("%d", &num);
int i, tmp;
int cnt = 0;
for (i = 0; i < num; i++) {
cnt++;
//3??§?????????????????°???134??????3???????????§????????°?????????
tmp = cnt;
//???????????????
char threeJudge[1000];
char *judge;
sprintf(threeJudge, "%d", cnt);
//????????¨??????3????????????????????????
if ((judge=strstr(threeJudge,"3"))!=NULL) {
printf(" %d", cnt);
//3??§??????????????????
}else if (tmp % 3 == 0) {
printf(" %d", cnt);
}
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230107/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230107/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%threeJudge = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end9
%i.019 = phi i32 [ %inc10, %if.end9 ], [ 0, %entry ]
%inc10 = add nuw nsw i32 %i.019, 1
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %threeJudge) #5
%call1 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %threeJudge, ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %inc10) #5
%strchr = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %threeJudge, i32 51)
%cmp4.not = icmp ne ptr %strchr, null
%rem = urem i32 %inc10, 3
%cmp6 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp4.not, %cmp6
br i1 %or.cond, label %if.end9.sink.split, label %if.end9
if.end9.sink.split: ; preds = %for.body
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %inc10)
br label %if.end9
if.end9: ; preds = %for.body, %if.end9.sink.split
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %threeJudge) #5
%1 = load i32, ptr %num, align 4, !tbaa !5
%cmp = icmp slt i32 %inc10, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end9, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr, i32) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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 i=1;
int n;
int x;
int z;
int f;
int k;
int o;
int p;
scanf("%d",&n);
for (i=1; i<=n; i++){
x=i;
if(x%3==0){printf(" %d",x);}
else while(1){
z=i;
if(i/10==3||i/100==3||i/1000==3){printf(" %d",i); break;}
if(i%10==3||i%100==3||i%1000==3){printf(" %d",i); break;}
f=z/10;
if(f==3||f%10==3){printf(" %d",z); break;}
k=f/10;
if(k==3||k%10==3){printf(" %d",z); break;}
o=k/10;
if(o==3||k%10==3){printf(" %d",z); break;}
p=o/10;
if(p==3||k%10==3){printf(" %d",z); break;}
break;
}
}printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230158/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230158/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not87 = icmp slt i32 %0, 1
br i1 %cmp.not87, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.088 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.088, 3
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.inc.sink.split, label %while.body
while.body: ; preds = %for.body
%i.0.off = add nsw i32 %i.088, -30
%cmp3 = icmp ult i32 %i.0.off, 10
%i.0.off79 = add nsw i32 %i.088, -300
%cmp5 = icmp ult i32 %i.0.off79, 100
%or.cond = select i1 %cmp3, i1 true, i1 %cmp5
%i.0.off80 = add nsw i32 %i.088, -3000
%cmp8 = icmp ult i32 %i.0.off80, 1000
%or.cond84 = select i1 %or.cond, i1 true, i1 %cmp8
br i1 %or.cond84, label %for.inc.sink.split, label %if.end
if.end: ; preds = %while.body
%div = udiv i32 %i.088, 10
%rem11 = urem i32 %i.088, 10
%cmp12 = icmp eq i32 %rem11, 3
%rem14 = urem i32 %i.088, 100
%div30 = udiv i32 %i.088, 100
%cmp15 = icmp eq i32 %rem14, 3
%or.cond85 = or i1 %cmp12, %cmp15
%rem17 = urem i32 %i.088, 1000
%cmp18 = icmp eq i32 %rem17, 3
%or.cond86 = or i1 %cmp18, %or.cond85
%rem25 = urem i32 %div, 10
%cmp26 = icmp eq i32 %rem25, 3
%or.cond89 = or i1 %or.cond86, %cmp26
br i1 %or.cond89, label %for.inc.sink.split, label %lor.lhs.false32
lor.lhs.false32: ; preds = %if.end
%rem33 = urem i32 %div30, 10
%cmp34 = icmp eq i32 %rem33, 3
%i.0.off83 = add nsw i32 %i.088, -30000
%cmp47 = icmp ult i32 %i.0.off83, 10000
%or.cond90 = select i1 %cmp34, i1 true, i1 %cmp47
br i1 %or.cond90, label %for.inc.sink.split, label %for.inc
for.inc.sink.split: ; preds = %lor.lhs.false32, %if.end, %while.body, %for.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.088)
br label %for.inc
for.inc: ; preds = %lor.lhs.false32, %for.inc.sink.split
%inc = add nuw nsw i32 %i.088, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.088, %1
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
void call(int n)
{
int i = 1;
int x;
do {
x = i;
if (x % 3 == 0) {
printf(" %d", i);
}
else {
do {
if (x % 10 == 3) {
printf(" %d", i);
x = 0;
}
else x /= 10;
} while (x);
}
} while (++i <= n);
putchar('\n');
}
int main()
{
int n;
scanf("%d", &n);
call(n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230200/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230200/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local void @call(i32 noundef %n) local_unnamed_addr #0 {
entry:
%smax = tail call i32 @llvm.smax.i32(i32 %n, i32 1)
br label %do.body
do.body: ; preds = %do.cond8, %entry
%i.0 = phi i32 [ 1, %entry ], [ %inc, %do.cond8 ]
%rem = urem i32 %i.0, 3
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %do.cond8.sink.split, label %do.body1
do.body1: ; preds = %do.body, %do.cond
%x.0 = phi i32 [ %div, %do.cond ], [ %i.0, %do.body ]
%rem2 = srem i32 %x.0, 10
%div = sdiv i32 %x.0, 10
%cmp3 = icmp eq i32 %rem2, 3
br i1 %cmp3, label %do.cond8.sink.split, label %do.cond
do.cond: ; preds = %do.body1
%x.0.off = add i32 %x.0, 9
%tobool.not = icmp ult i32 %x.0.off, 19
br i1 %tobool.not, label %do.cond8, label %do.body1, !llvm.loop !5
do.cond8.sink.split: ; preds = %do.body1, %do.body
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.0)
br label %do.cond8
do.cond8: ; preds = %do.cond, %do.cond8.sink.split
%inc = add nuw i32 %i.0, 1
%exitcond.not = icmp eq i32 %i.0, %smax
br i1 %exitcond.not, label %do.end10, label %do.body, !llvm.loop !7
do.end10: ; preds = %do.cond8
%0 = load ptr, ptr @stdout, align 8, !tbaa !8
%call.i = tail call i32 @putc(i32 noundef 10, ptr noundef %0)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !12
%smax.i = call i32 @llvm.smax.i32(i32 %0, i32 1)
br label %do.body.i
do.body.i: ; preds = %do.cond8.i, %entry
%i.0.i = phi i32 [ 1, %entry ], [ %inc.i, %do.cond8.i ]
%rem.i = urem i32 %i.0.i, 3
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %do.cond8.sink.split.i, label %do.body1.i
do.body1.i: ; preds = %do.body.i, %do.cond.i
%x.0.i = phi i32 [ %div.i, %do.cond.i ], [ %i.0.i, %do.body.i ]
%rem2.i = srem i32 %x.0.i, 10
%div.i = sdiv i32 %x.0.i, 10
%cmp3.i = icmp eq i32 %rem2.i, 3
br i1 %cmp3.i, label %do.cond8.sink.split.i, label %do.cond.i
do.cond.i: ; preds = %do.body1.i
%x.0.off.i = add i32 %x.0.i, 9
%tobool.not.i = icmp ult i32 %x.0.off.i, 19
br i1 %tobool.not.i, label %do.cond8.i, label %do.body1.i, !llvm.loop !5
do.cond8.sink.split.i: ; preds = %do.body1.i, %do.body.i
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.0.i)
br label %do.cond8.i
do.cond8.i: ; preds = %do.cond.i, %do.cond8.sink.split.i
%inc.i = add nuw i32 %i.0.i, 1
%exitcond.not.i = icmp eq i32 %i.0.i, %smax.i
br i1 %exitcond.not.i, label %call.exit, label %do.body.i, !llvm.loop !7
call.exit: ; preds = %do.cond8.i
%1 = load ptr, ptr @stdout, align 8, !tbaa !8
%call.i.i = call i32 @putc(i32 noundef 10, ptr noundef %1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !10, i64 0}
|
//
// main.c
// ITP1_5_D
//
// Created by k16031kk on 2018/05/22.
// Copyright © 2018年 AIT. All rights reserved.
//
#include <stdio.h>
void call(int n, int i) {
while(n>=3) {
if(n%10==3) {
printf(" %d", i);
break;
} else {
n/=10;
}
}
}
int main(int argc, const char * argv[]) {
// insert code here...
int n,x;
scanf("%d", &n);
for(int i=1; i<=n; i++) {
x=i;
//count++;
if(x%3==0) {
printf(" %d", x);
} else {
call(x, i);
}
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230251/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230251/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @call(i32 noundef %n, i32 noundef %i) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 2
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %entry, %if.else
%n.addr.05 = phi i32 [ %div, %if.else ], [ %n, %entry ]
%rem = urem i32 %n.addr.05, 10
%div = udiv i32 %n.addr.05, 10
%cmp1 = icmp eq i32 %rem, 3
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i)
br label %while.end
if.else: ; preds = %while.body
%cmp = icmp ugt i32 %n.addr.05, 29
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !5
while.end: ; preds = %if.else, %entry, %if.then
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp.not9 = icmp slt i32 %0, 1
br i1 %cmp.not9, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.inc, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %entry, %for.inc
%i.010 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.010, 3
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.inc.sink.split, label %if.else
if.else: ; preds = %for.body
%cmp4.i = icmp ugt i32 %i.010, 2
br i1 %cmp4.i, label %while.body.i, label %for.inc
while.body.i: ; preds = %if.else, %if.else.i
%n.addr.05.i = phi i32 [ %div.i, %if.else.i ], [ %i.010, %if.else ]
%rem.i = urem i32 %n.addr.05.i, 10
%div.i = udiv i32 %n.addr.05.i, 10
%cmp1.i = icmp eq i32 %rem.i, 3
br i1 %cmp1.i, label %for.inc.sink.split, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp.i = icmp ugt i32 %n.addr.05.i, 29
br i1 %cmp.i, label %while.body.i, label %for.inc, !llvm.loop !5
for.inc.sink.split: ; preds = %while.body.i, %for.body
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.010)
br label %for.inc
for.inc: ; preds = %if.else.i, %for.inc.sink.split, %if.else
%inc = add nuw nsw i32 %i.010, 1
%1 = load i32, ptr %n, align 4, !tbaa !7
%cmp.not.not = icmp slt i32 %i.010, %1
br i1 %cmp.not.not, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @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 = { nofree nounwind "no-trapping-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 }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
/*
void call(int n){
int i=1;
int x;
CHECK_NUM:
x=i;
if(x%3==0){
printf(" %d",i);
goto END_CHECK_NUM;
}
INCLUDE3:
if(x%10==3){
printf(" %d",i);
goto END_CHECK_NUM;
}
x/=10;
if(x!=0) goto INCLUDE3;
END_CHECK_NUM:
if(++i<=n) goto CHECK_NUM;
printf("\n");
}
*/
int main(){
int n;
int i;
int x;
scanf("%d",&n);
for(i=1;i<=n;i++){
x=i;
if(x%3==0){
printf(" %d",i);
}
else{
while(x!=0){
if(x%10==3){
printf(" %d",i);
x=0;
}
x/=10;
}
}
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230295/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230295/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not18 = icmp slt i32 %0, 1
br i1 %cmp.not18, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.019 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.019, 3
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.inc.sink.split, label %while.body
while.body: ; preds = %for.body, %if.end
%x.017 = phi i32 [ %div, %if.end ], [ %i.019, %for.body ]
%rem4 = srem i32 %x.017, 10
%div = sdiv i32 %x.017, 10
%cmp5 = icmp eq i32 %rem4, 3
br i1 %cmp5, label %for.inc.sink.split, label %if.end
if.end: ; preds = %while.body
%x.1.off = add i32 %x.017, 9
%cmp3.not = icmp ult i32 %x.1.off, 19
br i1 %cmp3.not, label %for.inc, label %while.body, !llvm.loop !9
for.inc.sink.split: ; preds = %while.body, %for.body
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.019)
br label %for.inc
for.inc: ; preds = %if.end, %for.inc.sink.split
%inc = add nuw nsw i32 %i.019, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.019, %1
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main (int argc, char * argv[])
{
int n,x;
scanf("%d",&n);
for(int i=1;i<=n;i++){
x = i;
if(x % 3 ==0){
printf(" %d",i);
}else {
while(x){
if(x%10==3){
printf(" %d",i);
break;
}
x /=10;
}
}
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230345/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230345/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not17 = icmp slt i32 %0, 1
br i1 %cmp.not17, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.inc, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %entry, %for.inc
%i.018 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.018, 3
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.inc.sink.split, label %while.body
while.body: ; preds = %for.body, %if.end
%x.016 = phi i32 [ %div, %if.end ], [ %i.018, %for.body ]
%rem3 = srem i32 %x.016, 10
%div = sdiv i32 %x.016, 10
%cmp4 = icmp eq i32 %rem3, 3
br i1 %cmp4, label %for.inc.sink.split, label %if.end
if.end: ; preds = %while.body
%x.016.off = add i32 %x.016, 9
%tobool.not = icmp ult i32 %x.016.off, 19
br i1 %tobool.not, label %for.inc, label %while.body, !llvm.loop !9
for.inc.sink.split: ; preds = %while.body, %for.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.018)
br label %for.inc
for.inc: ; preds = %if.end, %for.inc.sink.split
%inc = add nuw nsw i32 %i.018, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.018, %1
br i1 %cmp.not.not, 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <string.h>
//prototype
int main(void);
//main
int main(void){
long n, i;
char str_n[10000];
scanf("%ld", &n);
for (i = 3; i <= n; i++) {
sprintf(str_n, "%d", i); //convert to string
if(i % 3 == 0 || strstr(str_n, "3") != NULL){
printf(" %ld", i);
}
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230396/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230396/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c" %ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%str_n = alloca [10000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %str_n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not12 = icmp slt i64 %0, 3
br i1 %cmp.not12, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%i.013 = phi i64 [ %inc, %for.inc ], [ 3, %entry ]
%call1 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %str_n, ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %i.013) #5
%rem = urem i64 %i.013, 3
%cmp2 = icmp eq i64 %rem, 0
br i1 %cmp2, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body
%strchr = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %str_n, i32 51)
%cmp5.not = icmp eq ptr %strchr, null
br i1 %cmp5.not, label %for.inc, label %if.then
if.then: ; preds = %lor.lhs.false, %for.body
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %i.013)
br label %for.inc
for.inc: ; preds = %lor.lhs.false, %if.then
%inc = add nuw nsw i64 %i.013, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.013, %1
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %str_n) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr, i32) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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<math.h>
#include<time.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
if(i%10==3 || i%100/10==3 || i%1000/100==3 || i/1000==3 || i%3==0)
printf(" %d",i);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230439/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230439/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not24 = icmp slt i32 %0, 1
br i1 %cmp.not24, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%1 = phi i32 [ %2, %for.inc ], [ %0, %entry ]
%i.025 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = urem i32 %i.025, 10
%cmp1 = icmp eq i32 %rem, 3
br i1 %cmp1, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body
%rem2 = urem i32 %i.025, 100
%rem2.off = add nsw i32 %rem2, -30
%cmp3 = icmp ult i32 %rem2.off, 10
br i1 %cmp3, label %if.then, label %lor.lhs.false4
lor.lhs.false4: ; preds = %lor.lhs.false
%rem5 = urem i32 %i.025, 1000
%rem5.off = add nsw i32 %rem5, -300
%cmp7 = icmp ult i32 %rem5.off, 100
%i.0.off = add nsw i32 %i.025, -3000
%cmp10 = icmp ult i32 %i.0.off, 1000
%or.cond = select i1 %cmp7, i1 true, i1 %cmp10
%rem12 = urem i32 %i.025, 3
%cmp13 = icmp eq i32 %rem12, 0
%or.cond23 = or i1 %cmp13, %or.cond
br i1 %or.cond23, label %if.then, label %for.inc
if.then: ; preds = %lor.lhs.false4, %lor.lhs.false, %for.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.025)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %lor.lhs.false4, %if.then
%2 = phi i32 [ %1, %lor.lhs.false4 ], [ %.pre, %if.then ]
%inc = add nuw nsw i32 %i.025, 1
%cmp.not.not = icmp slt i32 %i.025, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main()
{
int n,m,a,i[100005],sum[100005],res = 0;
scanf("%d%d",&n,&m);
i[n+1] = m;
i[0] = 0;
for(a = 1;a <= n;a ++)
{
scanf("%d",&i[a]);
}
res = 0;
for(a = 0;a <= n+1;a ++)
if(a % 2 == 0)
{
res -= i[a];
sum[a] = res;
}
else
{
res += i[a];
sum[a] = res;
}
int total = n + 1; if(n % 2 == 1) total --;
res = sum[total];
if(n % 2 == 0) total --;
else total ++;
// printf("%d %d\n",a,res);
for(a = 0;a <= n;a ++)
if(a % 2 == 0)
{
if(i[a+1] - i[a] > 1)
{
if(i[a+1] - 1 + sum[a] - sum[total] + sum[a] > res)
res = i[a+1] - 1 + sum[a] - sum[total] + sum[a];
// printf("%d %d\n",a,res);
}
}
else
{
if(i[a+1] - i[a] > 1)
{
if(sum[a] - i[a] - 1 - sum[total] + sum[a] > res)
res = sum[a] - i[a] - 1 - sum[total] + sum[a];
// printf("%d %d\n",a,res);
}
}
printf("%d",res);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23054/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23054/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%i = alloca [100005 x i32], align 16
%sum = alloca [100005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %i) #4
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %sum) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %1, 1
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds [100005 x i32], ptr %i, i64 0, i64 %idxprom
store i32 %0, ptr %arrayidx, align 4, !tbaa !5
store i32 0, ptr %i, align 16, !tbaa !5
%cmp.not167 = icmp slt i32 %1, 1
br i1 %cmp.not167, label %for.cond5.preheader, label %for.body
for.cond5.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %1, %entry ], [ %4, %for.body ]
%cmp7.not169 = icmp slt i32 %.lcssa, -1
br i1 %cmp7.not169, label %for.end21, label %for.body8.preheader
for.body8.preheader: ; preds = %for.cond5.preheader
%2 = add i32 %.lcssa, 2
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%3 = icmp eq i32 %2, 1
br i1 %3, label %for.end21.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx3 = getelementptr inbounds [100005 x i32], ptr %i, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %5
br i1 %cmp.not.not, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv179 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next180.1, %for.body8 ]
%res.0171 = phi i32 [ 0, %for.body8.preheader.new ], [ %add16.sink.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.1, %for.body8 ]
%arrayidx11 = getelementptr inbounds [100005 x i32], ptr %i, i64 0, i64 %indvars.iv179
%6 = load i32, ptr %arrayidx11, align 8, !tbaa !5
%add16.sink = sub i32 %res.0171, %6
%7 = getelementptr inbounds [100005 x i32], ptr %sum, i64 0, i64 %indvars.iv179
store i32 %add16.sink, ptr %7, align 8
%indvars.iv.next180 = or i64 %indvars.iv179, 1
%arrayidx11.1 = getelementptr inbounds [100005 x i32], ptr %i, i64 0, i64 %indvars.iv.next180
%8 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%add16.sink.1 = add i32 %add16.sink, %8
%9 = getelementptr inbounds [100005 x i32], ptr %sum, i64 0, i64 %indvars.iv.next180
store i32 %add16.sink.1, ptr %9, align 4
%indvars.iv.next180.1 = add nuw nsw i64 %indvars.iv179, 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.end21.loopexit.unr-lcssa, label %for.body8, !llvm.loop !11
for.end21.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%indvars.iv179.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next180.1, %for.body8 ]
%res.0171.unr = phi i32 [ 0, %for.body8.preheader ], [ %add16.sink.1, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end21, label %for.body8.epil
for.body8.epil: ; preds = %for.end21.loopexit.unr-lcssa
%rem189.epil = and i64 %indvars.iv179.unr, 1
%cmp9.epil = icmp eq i64 %rem189.epil, 0
%arrayidx11.epil = getelementptr inbounds [100005 x i32], ptr %i, i64 0, i64 %indvars.iv179.unr
%10 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%11 = sub i32 0, %10
%add16.sink.p.epil = select i1 %cmp9.epil, i32 %11, i32 %10
%add16.sink.epil = add i32 %res.0171.unr, %add16.sink.p.epil
%12 = getelementptr inbounds [100005 x i32], ptr %sum, i64 0, i64 %indvars.iv179.unr
store i32 %add16.sink.epil, ptr %12, align 4
br label %for.end21
for.end21: ; preds = %for.body8.epil, %for.end21.loopexit.unr-lcssa, %for.cond5.preheader
%13 = and i32 %.lcssa, -2147483647
%cmp24 = icmp ne i32 %13, 1
%add6 = zext i1 %cmp24 to i32
%spec.select = add nsw i32 %.lcssa, %add6
%idxprom27 = sext i32 %spec.select to i64
%arrayidx28 = getelementptr inbounds [100005 x i32], ptr %sum, i64 0, i64 %idxprom27
%14 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp37.not173 = icmp slt i32 %.lcssa, 0
br i1 %cmp37.not173, label %for.end120, label %for.body38.lr.ph
for.body38.lr.ph: ; preds = %for.end21
%15 = and i32 %.lcssa, 1
%cmp30 = icmp eq i32 %15, 0
%total.1.v = select i1 %cmp30, i32 -1, i32 1
%total.1 = add nsw i32 %spec.select, %total.1.v
%idxprom95 = sext i32 %total.1 to i64
%arrayidx96 = getelementptr inbounds [100005 x i32], ptr %sum, i64 0, i64 %idxprom95
%16 = add nuw i32 %.lcssa, 1
%wide.trip.count187 = zext i32 %16 to i64
br label %for.body38
for.body38: ; preds = %for.body38.lr.ph, %for.inc118
%indvars.iv182 = phi i64 [ 0, %for.body38.lr.ph ], [ %17, %for.inc118 ]
%res.2175 = phi i32 [ %14, %for.body38.lr.ph ], [ %res.3, %for.inc118 ]
%rem39190 = and i64 %indvars.iv182, 1
%cmp40 = icmp eq i64 %rem39190, 0
%17 = add nuw nsw i64 %indvars.iv182, 1
%arrayidx44 = getelementptr inbounds [100005 x i32], ptr %i, i64 0, i64 %17
%18 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%arrayidx46 = getelementptr inbounds [100005 x i32], ptr %i, i64 0, i64 %indvars.iv182
%19 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%sub47 = sub nsw i32 %18, %19
%cmp48 = icmp sgt i32 %sub47, 1
br i1 %cmp40, label %if.then41, label %if.else80
if.then41: ; preds = %for.body38
br i1 %cmp48, label %if.then49, label %for.inc118
if.then49: ; preds = %if.then41
%arrayidx55 = getelementptr inbounds [100005 x i32], ptr %sum, i64 0, i64 %indvars.iv182
%20 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%21 = load i32, ptr %arrayidx96, align 4, !tbaa !5
%factor166 = shl i32 %20, 1
%22 = xor i32 %21, -1
%sub59 = add i32 %18, %22
%add62 = add i32 %sub59, %factor166
%spec.select163 = call i32 @llvm.smax.i32(i32 %add62, i32 %res.2175)
br label %for.inc118
if.else80: ; preds = %for.body38
br i1 %cmp48, label %if.then88, label %for.inc118
if.then88: ; preds = %if.else80
%arrayidx90 = getelementptr inbounds [100005 x i32], ptr %sum, i64 0, i64 %indvars.iv182
%23 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%24 = xor i32 %19, -1
%25 = load i32, ptr %arrayidx96, align 4, !tbaa !5
%factor = shl i32 %23, 1
%sub97 = sub i32 %24, %25
%add100 = add i32 %sub97, %factor
%spec.select164 = call i32 @llvm.smax.i32(i32 %add100, i32 %res.2175)
br label %for.inc118
for.inc118: ; preds = %if.then88, %if.then49, %if.then41, %if.else80
%res.3 = phi i32 [ %spec.select164, %if.then88 ], [ %spec.select163, %if.then49 ], [ %res.2175, %if.then41 ], [ %res.2175, %if.else80 ]
%exitcond188.not = icmp eq i64 %17, %wide.trip.count187
br i1 %exitcond188.not, label %for.end120, label %for.body38, !llvm.loop !12
for.end120: ; preds = %for.inc118, %for.end21
%res.2.lcssa = phi i32 [ %14, %for.end21 ], [ %res.3, %for.inc118 ]
%call121 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %res.2.lcssa)
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %sum) #4
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %i) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
if(b%a==0) printf("%d\n",b+a);
else printf("%d\n",b-a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230590/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230590/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: 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 %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%sub.sink.p = select i1 %cmp, i32 %1, i32 %2
%sub.sink = add i32 %0, %sub.sink.p
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.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(){
int a,b;
scanf("%d %d",&a,&b);
if(b%a == 0){
printf("%d",a+b);
}else{
printf("%d",b-a);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230633/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230633/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%sub.sink.p = select i1 %cmp, i32 %1, i32 %2
%sub.sink = add i32 %0, %sub.sink.p
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.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()
{
int a,b;
scanf("%d%d",&a,&b);
if(b%a==0){
printf("%d",a+b);
}else{
printf("%d",b-a);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230677/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230677/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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 %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%sub.sink.p = select i1 %cmp, i32 %1, i32 %2
%sub.sink = add i32 %0, %sub.sink.p
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.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>
#include <stdlib.h>
#include <string.h>
int main()
{
int n;
char **a,**b;
int c=0;
scanf("%d",&n);
a=(char**)malloc(n*(sizeof(char*)));
for (int j = 0; j < n; j++) {
a[j] = (char*) malloc(sizeof(char) * 5);
}
b=(char**)malloc(n*(sizeof(char*)));
for (int j = 0; j < n; j++) {
b[j] = (char*) malloc(sizeof(char) * 5);
}
for(int i=0;i<n;i++){
scanf("%s",a[i]);
}
for(int i=0;i<n;i++){
scanf("%s",b[i]);
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(strcmp(a[i],b[j])==0){
c++;
b[j]="XXXXX";
break;
}
}
}
printf("%d",n-c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23072/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23072/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"XXXXX\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp96 = icmp sgt i32 %0, 0
br i1 %cmp96, label %for.body.preheader, label %for.cond.cleanup46
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body
%call6 = call noalias ptr @malloc(i64 noundef %mul) #6
br i1 %cmp96, label %for.body12.preheader, label %for.cond.cleanup46
for.body12.preheader: ; preds = %for.cond.cleanup
%wide.trip.count117 = zext i32 %0 to i64
br label %for.body12
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call3 = call noalias dereferenceable_or_null(5) ptr @malloc(i64 noundef 5) #6
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call3, ptr %arrayidx, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !11
for.cond19.preheader: ; preds = %for.body12
br i1 %cmp96, label %for.body23, label %for.cond.cleanup46
for.body12: ; preds = %for.body12.preheader, %for.body12
%indvars.iv114 = phi i64 [ 0, %for.body12.preheader ], [ %indvars.iv.next115, %for.body12 ]
%call13 = call noalias dereferenceable_or_null(5) ptr @malloc(i64 noundef 5) #6
%arrayidx15 = getelementptr inbounds ptr, ptr %call6, i64 %indvars.iv114
store ptr %call13, ptr %arrayidx15, align 8, !tbaa !9
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%exitcond118.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count117
br i1 %exitcond118.not, label %for.cond19.preheader, label %for.body12, !llvm.loop !13
for.cond31.preheader: ; preds = %for.body23
%cmp32102 = icmp sgt i32 %2, 0
br i1 %cmp32102, label %for.body35, label %for.cond.cleanup46
for.body23: ; preds = %for.cond19.preheader, %for.body23
%indvars.iv119 = phi i64 [ %indvars.iv.next120, %for.body23 ], [ 0, %for.cond19.preheader ]
%arrayidx25 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv119
%1 = load ptr, ptr %arrayidx25, align 8, !tbaa !9
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %1)
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp20 = icmp slt i64 %indvars.iv.next120, %3
br i1 %cmp20, label %for.body23, label %for.cond31.preheader, !llvm.loop !14
for.cond43.preheader: ; preds = %for.body35
%cmp44106 = icmp sgt i32 %7, 0
br i1 %cmp44106, label %for.cond49.preheader.us.preheader, label %for.cond.cleanup46
for.cond49.preheader.us.preheader: ; preds = %for.cond43.preheader
%wide.trip.count133 = zext i32 %7 to i64
br label %for.cond49.preheader.us
for.cond49.preheader.us: ; preds = %for.cond49.preheader.us.preheader, %cleanup.us
%indvars.iv130 = phi i64 [ 0, %for.cond49.preheader.us.preheader ], [ %indvars.iv.next131, %cleanup.us ]
%c.0107.us = phi i32 [ 0, %for.cond49.preheader.us.preheader ], [ %c.1.us, %cleanup.us ]
%arrayidx55.us = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv130
%4 = load ptr, ptr %arrayidx55.us, align 8, !tbaa !9
br label %for.body53.us
for.cond49.us: ; preds = %for.body53.us
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%exitcond129.not = icmp eq i64 %indvars.iv.next126, %wide.trip.count133
br i1 %exitcond129.not, label %cleanup.us, label %for.body53.us, !llvm.loop !15
for.body53.us: ; preds = %for.cond49.preheader.us, %for.cond49.us
%indvars.iv125 = phi i64 [ 0, %for.cond49.preheader.us ], [ %indvars.iv.next126, %for.cond49.us ]
%arrayidx57.us = getelementptr inbounds ptr, ptr %call6, i64 %indvars.iv125
%5 = load ptr, ptr %arrayidx57.us, align 8, !tbaa !9
%call58.us = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) %5) #7
%cmp59.us = icmp eq i32 %call58.us, 0
br i1 %cmp59.us, label %if.then.us, label %for.cond49.us
if.then.us: ; preds = %for.body53.us
%arrayidx57.us.le = getelementptr inbounds ptr, ptr %call6, i64 %indvars.iv125
%inc61.us = add nsw i32 %c.0107.us, 1
store ptr @.str.2, ptr %arrayidx57.us.le, align 8, !tbaa !9
br label %cleanup.us
cleanup.us: ; preds = %for.cond49.us, %if.then.us
%c.1.us = phi i32 [ %inc61.us, %if.then.us ], [ %c.0107.us, %for.cond49.us ]
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%exitcond134.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count133
br i1 %exitcond134.not, label %for.cond.cleanup46, label %for.cond49.preheader.us, !llvm.loop !16
for.body35: ; preds = %for.cond31.preheader, %for.body35
%indvars.iv122 = phi i64 [ %indvars.iv.next123, %for.body35 ], [ 0, %for.cond31.preheader ]
%arrayidx37 = getelementptr inbounds ptr, ptr %call6, i64 %indvars.iv122
%6 = load ptr, ptr %arrayidx37, align 8, !tbaa !9
%call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %6)
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp32 = icmp slt i64 %indvars.iv.next123, %8
br i1 %cmp32, label %for.body35, label %for.cond43.preheader, !llvm.loop !17
for.cond.cleanup46: ; preds = %cleanup.us, %entry, %for.cond.cleanup, %for.cond19.preheader, %for.cond31.preheader, %for.cond43.preheader
%.lcssa145 = phi i32 [ %7, %for.cond43.preheader ], [ %2, %for.cond31.preheader ], [ %0, %for.cond19.preheader ], [ %0, %for.cond.cleanup ], [ %0, %entry ], [ %7, %cleanup.us ]
%c.0.lcssa = phi i32 [ 0, %for.cond43.preheader ], [ 0, %for.cond31.preheader ], [ 0, %for.cond19.preheader ], [ 0, %for.cond.cleanup ], [ 0, %entry ], [ %c.1.us, %cleanup.us ]
%sub = sub nsw i32 %.lcssa145, %c.0.lcssa
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; 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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
|
#include <stdio.h>
int func(int a, int b) {
if ( b % a == 0 ) {
return a+b;
} else {
return b-a;
}
}
int main() {
int a, b;
scanf("%d %d", &a, &b);
printf("%d\n", func(a, b));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230763/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230763/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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(none) uwtable
define dso_local i32 @func(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%rem = srem i32 %b, %a
%cmp = icmp eq i32 %rem, 0
%0 = sub i32 0, %a
%retval.0.p = select i1 %cmp, i32 %a, i32 %0
%retval.0 = add i32 %retval.0.p, %b
ret i32 %retval.0
}
; 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
%1 = load i32, ptr %b, align 4, !tbaa !5
%rem.i = srem i32 %1, %0
%cmp.i = icmp eq i32 %rem.i, 0
%2 = sub i32 0, %0
%retval.0.p.i = select i1 %cmp.i, i32 %0, i32 %2
%retval.0.i = add i32 %retval.0.p.i, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %retval.0.i)
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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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(B%A==0)
printf("%d",A+B);
else
printf("%d",B-A);
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230813/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230813/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %B, align 4, !tbaa !5
%1 = load i32, ptr %A, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%sub.sink.p = select i1 %cmp, i32 %1, i32 %2
%sub.sink = add i32 %0, %sub.sink.p
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.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(B%A==0){
printf("%d\n",A+B);
}else{
printf("%d\n",B-A);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230864/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230864/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: 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 %B, align 4, !tbaa !5
%1 = load i32, ptr %A, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%sub.sink.p = select i1 %cmp, i32 %1, i32 %2
%sub.sink = add i32 %0, %sub.sink.p
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.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(){
int a,b;
int c;
scanf("%d %d",&a,&b);
if(b%a == 0){
c = a + b;
}
else{
c = b - a;
}
printf("%d",c);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230907/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230907/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%c.0.p = select i1 %cmp, i32 %1, i32 %2
%c.0 = add i32 %c.0.p, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0)
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, sum=0;
scanf("%d %d", &A, &B);
if(B%A == 0) {
sum = A + B;
} else {
sum = B - A;
}
printf("%d", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230950/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230950/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %B, align 4, !tbaa !5
%1 = load i32, ptr %A, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%sum.0.p = select i1 %cmp, i32 %1, i32 %2
%sum.0 = add i32 %sum.0.p, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0)
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(B%A==0){
printf("%d\n",A+B);
}
else printf("%d\n",B-A);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_230994/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_230994/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: 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 %B, align 4, !tbaa !5
%1 = load i32, ptr %A, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%sub.sink.p = select i1 %cmp, i32 %1, i32 %2
%sub.sink = add i32 %0, %sub.sink.p
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.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(){
int a,b;
scanf("%d %d",&a,&b);
if(b%a==0) printf("%d",a+b);
else printf("%d",b-a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231036/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231036/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%2 = sub i32 0, %1
%sub.sink.p = select i1 %cmp, i32 %1, i32 %2
%sub.sink = add i32 %0, %sub.sink.p
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.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>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) {
return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) {
return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007
#define INF 1000000009
typedef long long ll;
void swap(ll *a, ll *b)
{
ll tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
// a ÷b (mod MOD) →(a % MOD) * modinv(b, MOD) % MDO
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b; swap(&a, &b);
u -= t * v; swap(&u, &v);
}
u %= m;
if (u < 0) u += m;
return u;
}
ll combi(ll n, ll r) {
ll ans = 1;
for ( ll i = 0; i < r; i++ ) {
ans = (ans * (n - i) % MOD) * modinv(r - i, MOD) % MOD;
}
return ans;
}
ll PowMod(ll n, ll pow, ll mod) {
if (pow == 0) return 1;
if (pow % 2 == 0) {
ll tmp = PowMod(n, pow / 2, mod);
return tmp * tmp % mod;
}
return n * PowMod(n, pow - 1, mod);
}
int main(void) {
ll n, a, b;
scanf("%lld %lld %lld", &n, &a, &b);
ll sum = PowMod(2, n, MOD);
sum = ((sum - combi(n, a) + MOD) % MOD - combi(n, b) - 1 + MOD) % MOD;
printf("%lld\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231094/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231094/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @acs(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @des(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !9
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmp_str(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !10
%1 = load ptr, ptr %b, align 8, !tbaa !10
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #9
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !12
%1 = load i64, ptr %b, align 8, !tbaa !12
store i64 %1, ptr %a, align 8, !tbaa !12
store i64 %0, ptr %b, align 8, !tbaa !12
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @modinv(i64 noundef %a, i64 noundef %m) local_unnamed_addr #5 {
entry:
%tobool.not11 = icmp eq i64 %m, 0
br i1 %tobool.not11, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%v.015 = phi i64 [ %sub2, %while.body ], [ 0, %entry ]
%u.014 = phi i64 [ %v.015, %while.body ], [ 1, %entry ]
%b.013 = phi i64 [ %sub.recomposed, %while.body ], [ %m, %entry ]
%a.addr.012 = phi i64 [ %b.013, %while.body ], [ %a, %entry ]
%div = sdiv i64 %a.addr.012, %b.013
%mul = mul nsw i64 %div, %b.013
%sub.recomposed = srem i64 %a.addr.012, %b.013
%mul1 = mul nsw i64 %div, %v.015
%sub2 = sub nsw i64 %u.014, %mul1
%tobool.not = icmp eq i64 %sub.recomposed, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%u.0.lcssa = phi i64 [ 1, %entry ], [ %v.015, %while.body ]
%rem = srem i64 %u.0.lcssa, %m
%cmp = icmp slt i64 %rem, 0
%add = select i1 %cmp, i64 %m, i64 0
%spec.select = add nsw i64 %add, %rem
ret i64 %spec.select
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @combi(i64 noundef %n, i64 noundef %r) local_unnamed_addr #5 {
entry:
%cmp9 = icmp sgt i64 %r, 0
br i1 %cmp9, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %modinv.exit, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %rem3, %modinv.exit ]
ret i64 %ans.0.lcssa
for.body: ; preds = %entry, %modinv.exit
%i.011 = phi i64 [ %inc, %modinv.exit ], [ 0, %entry ]
%ans.010 = phi i64 [ %rem3, %modinv.exit ], [ 1, %entry ]
%sub = sub nsw i64 %n, %i.011
%mul = mul nsw i64 %sub, %ans.010
%sub1 = sub nsw i64 %r, %i.011
br label %while.body.i
while.body.i: ; preds = %while.body.i, %for.body
%v.015.i = phi i64 [ %sub2.i, %while.body.i ], [ 0, %for.body ]
%u.014.i = phi i64 [ %v.015.i, %while.body.i ], [ 1, %for.body ]
%b.013.i = phi i64 [ %sub.i.recomposed, %while.body.i ], [ 1000000007, %for.body ]
%a.addr.012.i = phi i64 [ %b.013.i, %while.body.i ], [ %sub1, %for.body ]
%div.i = sdiv i64 %a.addr.012.i, %b.013.i
%mul.i = mul nsw i64 %div.i, %b.013.i
%sub.i.recomposed = srem i64 %a.addr.012.i, %b.013.i
%mul1.i = mul nsw i64 %div.i, %v.015.i
%sub2.i = sub nsw i64 %u.014.i, %mul1.i
%tobool.not.i = icmp eq i64 %sub.i.recomposed, 0
br i1 %tobool.not.i, label %modinv.exit, label %while.body.i, !llvm.loop !14
modinv.exit: ; preds = %while.body.i
%rem = srem i64 %mul, 1000000007
%rem.i = srem i64 %v.015.i, 1000000007
%cmp.i = icmp slt i64 %rem.i, 0
%add.i = select i1 %cmp.i, i64 1000000007, i64 0
%spec.select.i = add nsw i64 %add.i, %rem.i
%mul2 = mul nsw i64 %spec.select.i, %rem
%rem3 = srem i64 %mul2, 1000000007
%inc = add nuw nsw i64 %i.011, 1
%exitcond.not = icmp eq i64 %inc, %r
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !16
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @PowMod(i64 noundef %n, i64 noundef %pow, i64 noundef %mod) local_unnamed_addr #6 {
entry:
%cmp18 = icmp eq i64 %pow, 0
br i1 %cmp18, label %common.ret29, label %if.end
if.end: ; preds = %entry
%0 = and i64 %pow, 1
%cmp1 = icmp eq i64 %0, 0
br i1 %cmp1, label %if.then2, label %if.end4
common.ret29: ; preds = %entry, %if.end4.1, %if.end4, %if.then2
%common.ret29.op = phi i64 [ %accumulator.ret.tr, %if.then2 ], [ 1, %entry ], [ %n, %if.end4 ], [ %mul6.1, %if.end4.1 ]
ret i64 %common.ret29.op
if.then2: ; preds = %if.end.1, %if.end
%pow.tr20.lcssa = phi i64 [ %pow, %if.end ], [ %sub, %if.end.1 ]
%accumulator.tr19.lcssa = phi i64 [ 1, %if.end ], [ %n, %if.end.1 ]
%div = sdiv i64 %pow.tr20.lcssa, 2
%call = tail call i64 @PowMod(i64 noundef %n, i64 noundef %div, i64 noundef %mod)
%mul = mul nsw i64 %call, %call
%rem3 = srem i64 %mul, %mod
%accumulator.ret.tr = mul nsw i64 %rem3, %accumulator.tr19.lcssa
br label %common.ret29
if.end4: ; preds = %if.end
%sub = add nsw i64 %pow, -1
%cmp = icmp eq i64 %sub, 0
br i1 %cmp, label %common.ret29, label %if.end.1
if.end.1: ; preds = %if.end4
%1 = and i64 %sub, 1
%cmp1.1 = icmp eq i64 %1, 0
br i1 %cmp1.1, label %if.then2, label %if.end4.1
if.end4.1: ; preds = %if.end.1
%mul6.1 = mul nsw i64 %n, %n
br label %common.ret29
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #10
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %n, align 8, !tbaa !12
%call1 = call i64 @PowMod(i64 noundef 2, i64 noundef %0, i64 noundef 1000000007)
%1 = load i64, ptr %a, align 8, !tbaa !12
%cmp9.i = icmp sgt i64 %1, 0
br i1 %cmp9.i, label %for.body.i, label %combi.exit
for.body.i: ; preds = %entry, %modinv.exit.i
%i.011.i = phi i64 [ %inc.i, %modinv.exit.i ], [ 0, %entry ]
%ans.010.i = phi i64 [ %rem3.i, %modinv.exit.i ], [ 1, %entry ]
%sub.i = sub nsw i64 %0, %i.011.i
%sub1.i = sub nsw i64 %1, %i.011.i
br label %while.body.i.i
while.body.i.i: ; preds = %while.body.i.i, %for.body.i
%v.015.i.i = phi i64 [ %sub2.i.i, %while.body.i.i ], [ 0, %for.body.i ]
%u.014.i.i = phi i64 [ %v.015.i.i, %while.body.i.i ], [ 1, %for.body.i ]
%b.013.i.i = phi i64 [ %sub.i.i.recomposed, %while.body.i.i ], [ 1000000007, %for.body.i ]
%a.addr.012.i.i = phi i64 [ %b.013.i.i, %while.body.i.i ], [ %sub1.i, %for.body.i ]
%div.i.i = sdiv i64 %a.addr.012.i.i, %b.013.i.i
%mul.i.i = mul nsw i64 %div.i.i, %b.013.i.i
%sub.i.i.recomposed = srem i64 %a.addr.012.i.i, %b.013.i.i
%mul1.i.i = mul nsw i64 %div.i.i, %v.015.i.i
%sub2.i.i = sub nsw i64 %u.014.i.i, %mul1.i.i
%tobool.not.i.i = icmp eq i64 %sub.i.i.recomposed, 0
br i1 %tobool.not.i.i, label %modinv.exit.i, label %while.body.i.i, !llvm.loop !14
modinv.exit.i: ; preds = %while.body.i.i
%mul.i = mul nsw i64 %sub.i, %ans.010.i
%rem.i = srem i64 %mul.i, 1000000007
%rem.i.i = srem i64 %v.015.i.i, 1000000007
%cmp.i.i = icmp slt i64 %rem.i.i, 0
%add.i.i = select i1 %cmp.i.i, i64 1000000007, i64 0
%spec.select.i.i = add nsw i64 %add.i.i, %rem.i.i
%mul2.i = mul nsw i64 %spec.select.i.i, %rem.i
%rem3.i = srem i64 %mul2.i, 1000000007
%inc.i = add nuw nsw i64 %i.011.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %1
br i1 %exitcond.not.i, label %combi.exit, label %for.body.i, !llvm.loop !16
combi.exit: ; preds = %modinv.exit.i, %entry
%ans.0.lcssa.i = phi i64 [ 1, %entry ], [ %rem3.i, %modinv.exit.i ]
%2 = load i64, ptr %b, align 8, !tbaa !12
%cmp9.i10 = icmp sgt i64 %2, 0
br i1 %cmp9.i10, label %for.body.i12, label %combi.exit39
for.body.i12: ; preds = %combi.exit, %modinv.exit.i29
%i.011.i13 = phi i64 [ %inc.i37, %modinv.exit.i29 ], [ 0, %combi.exit ]
%ans.010.i14 = phi i64 [ %rem3.i36, %modinv.exit.i29 ], [ 1, %combi.exit ]
%sub.i15 = sub nsw i64 %0, %i.011.i13
%sub1.i17 = sub nsw i64 %2, %i.011.i13
br label %while.body.i.i18
while.body.i.i18: ; preds = %while.body.i.i18, %for.body.i12
%v.015.i.i19 = phi i64 [ %sub2.i.i27, %while.body.i.i18 ], [ 0, %for.body.i12 ]
%u.014.i.i20 = phi i64 [ %v.015.i.i19, %while.body.i.i18 ], [ 1, %for.body.i12 ]
%b.013.i.i21 = phi i64 [ %sub.i.i25.recomposed, %while.body.i.i18 ], [ 1000000007, %for.body.i12 ]
%a.addr.012.i.i22 = phi i64 [ %b.013.i.i21, %while.body.i.i18 ], [ %sub1.i17, %for.body.i12 ]
%div.i.i23 = sdiv i64 %a.addr.012.i.i22, %b.013.i.i21
%mul.i.i24 = mul nsw i64 %div.i.i23, %b.013.i.i21
%sub.i.i25.recomposed = srem i64 %a.addr.012.i.i22, %b.013.i.i21
%mul1.i.i26 = mul nsw i64 %div.i.i23, %v.015.i.i19
%sub2.i.i27 = sub nsw i64 %u.014.i.i20, %mul1.i.i26
%tobool.not.i.i28 = icmp eq i64 %sub.i.i25.recomposed, 0
br i1 %tobool.not.i.i28, label %modinv.exit.i29, label %while.body.i.i18, !llvm.loop !14
modinv.exit.i29: ; preds = %while.body.i.i18
%mul.i16 = mul nsw i64 %sub.i15, %ans.010.i14
%rem.i30 = srem i64 %mul.i16, 1000000007
%rem.i.i31 = srem i64 %v.015.i.i19, 1000000007
%cmp.i.i32 = icmp slt i64 %rem.i.i31, 0
%add.i.i33 = select i1 %cmp.i.i32, i64 1000000007, i64 0
%spec.select.i.i34 = add nsw i64 %add.i.i33, %rem.i.i31
%mul2.i35 = mul nsw i64 %spec.select.i.i34, %rem.i30
%rem3.i36 = srem i64 %mul2.i35, 1000000007
%inc.i37 = add nuw nsw i64 %i.011.i13, 1
%exitcond.not.i38 = icmp eq i64 %inc.i37, %2
br i1 %exitcond.not.i38, label %combi.exit39.loopexit, label %for.body.i12, !llvm.loop !16
combi.exit39.loopexit: ; preds = %modinv.exit.i29
%3 = xor i64 %rem3.i36, -1
br label %combi.exit39
combi.exit39: ; preds = %combi.exit39.loopexit, %combi.exit
%ans.0.lcssa.i11 = phi i64 [ -2, %combi.exit ], [ %3, %combi.exit39.loopexit ]
%sub = add i64 %call1, 1000000007
%add = sub i64 %sub, %ans.0.lcssa.i
%rem = srem i64 %add, 1000000007
%sub5 = add nsw i64 %rem, 1000000007
%add6 = add nsw i64 %sub5, %ans.0.lcssa.i11
%rem7 = srem i64 %add6, 1000000007
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %rem7)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #10
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #10
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #10
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
|
#if 0
cat <<EOF >mistaken-paste
#endif
// thanks for @rsk0315_h4x
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define BIG 2000000007
#define VERYBIG 2000000000000007LL
#define MOD 1000000007
#define FOD 998244353
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 1000000
#ifdef __cplusplus
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <functional>
#include <array>
using std::queue;
using std::priority_queue;
using std::stack;
using std::tuple;
using std::set;
using std::map;
using std::vector;
using std::greater;
using std::pair;
using std::string;
using std::get;
template <typename T, typename U>
pair<T, U> operator+(pair<T, U> l, pair<T, U> r) {
return pair<T, U>(l.first + r.first, l.second + r.second);
}
#endif
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
sll a;
sll b;
sll c;
} hwllc;
typedef struct {
hwll a;
hwll b;
} linell;
ull n, m;
ull h, w;
ull k;
ull q;
sll va, vb, vc, vd, ve, vf;
ull ua, ub, uc, ud, ue, uf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
char ch, dh;
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
ull divide (ull a, ull b, ull modulo) {
return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
ull udiff (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sdiff (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
#define BEGCMP(NAME) int32_t NAME (const void *left, const void *right)
#define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right
#define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1
// int32_t pullcomp (const void *left, const void *right) {
// ull l = *(ull*)left;
// ull r = *(ull*)right;
// if (l < r) {
// return -1;
// }
// if (l > r) {
// return +1;
// }
// return 0;
// }
BEGCMP(pullcomp){
DEFLR(ull);
CMPRET(l, r);
return 0;
}
BEGCMP(prevcomp){
DEFLR(ull);
CMPRET(r, l);
return 0;
}
BEGCMP(psllcomp){
DEFLR(sll);
CMPRET(l, r);
return 0;
}
BEGCMP(pcharcomp){
DEFLR(char);
CMPRET(l, r);
return 0;
}
BEGCMP(pdoublecomp){
DEFLR(double);
CMPRET(l, r);
return 0;
}
int32_t pstrcomp (const void *left, const void *right) {
char* l = *(char**)left;
char* r = *(char**)right;
return strcmp(l, r);
}
BEGCMP(phwllABcomp){
DEFLR(hwll);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
return 0;
}
BEGCMP(phwllREVcomp){
DEFLR(hwll);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
return 0;
}
BEGCMP(ptriplecomp){
DEFLR(hwllc);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
CMPRET(l.c, r.c);
return 0;
}
BEGCMP(ptripleREVcomp){
DEFLR(hwllc);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
CMPRET(l.c, r.c);
return 0;
}
int32_t pquadcomp (const void *left, const void *right) {
linell l = *(linell*)left;
linell r = *(linell*)right;
sll ac = phwllABcomp(&(l.a), &(r.a));
if (ac) return ac;
sll bc = phwllABcomp(&(l.b), &(r.b));
if (bc) return bc;
return 0;
}
bool isinrange (sll left, sll x, sll right) {
return (left <= x && x <= right);
}
bool isinrange_soft (sll left, sll x, sll right) {
return (left <= x && x <= right) || (left >= x && x >= right);
}
sll a[N_MAX + 5];
// ull a[N_MAX + 5];
// sll a[3001][3001];
sll b[N_MAX + 5];
// ull b[N_MAX + 5];
// sll b[3001][3001];
sll c[N_MAX + 5];
ull d[N_MAX + 5];
sll e[N_MAX];
char s[N_MAX + 1];
// char s[3010][3010];
char t[N_MAX + 1];
// char t[3010][3010];
char u[N_MAX + 1];
hwll xy[N_MAX + 5];
hwllc tup[N_MAX + 5];
sll table[3005][3005];
// here we go
double p[N_MAX];
sll seg[524288], base = 262144;
sll segf_ (sll l, sll r, sll beg, sll end, sll i) {
if (end <= l || r <= beg) return 0;
if (l <= beg && end <= r) return seg[i];
sll med = (beg + end) / 2;
sll vl = segf_(l, r, beg, med, i * 2);
sll vr = segf_(l, r, med, end, i * 2 + 1);
return smax(vl, vr);
}
sll segf (sll l, sll r) {
return segf_(l, r, 0, base, 1);
}
void segup (sll v, sll x) {
seg[v += base] = x;
while (v /= 2) {
seg[v] = smax(seg[v * 2], seg[v * 2 + 1]);
}
}
ull bcnt (ull x) {
if (!x) return 0;
return bcnt(x / 2) + (x % 2);
}
ull gin[N_MAX];
ull dp[10005][2][105];
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;
n = strlen(s);
dp[0][0][0] = 1;
for (i = 0; i < n; i++) {
for (j = 0; j < 2; j++) {
for (ki = 0; ki < m; ki++) {
// printf("\t%lld %lld %lld\n", i, j, ki);
for (li = 0; li < 10; li++) {
if (!j && (s[i] - '0') < li) break;
dpcell = &dp[i + 1][(j || (s[i] - '0' > li)) ? 1 : 0][(ki + li) % m];
*dpcell = (*dpcell + dp[i][j][ki]) % MOD;
// printf("%lld %lld %lld <- %lld (%lld)\n", i + 1, (j || s[i] - '0' > li) ? 1ll : 0ll, (ki * 10 + li) % m, *dpcell, li);
}
}
}
}
result = MOD - 1;
for (j = 0; j < 2; j++) {
result = (result + dp[n][j][0]) % MOD;
}
printf("%lld\n", result);
// printf("%.15lf\n", dresult);
// puts(s);
return 0;
success:
puts("YES");
// puts("Yes");
// printf("%llu\n", result);
// puts("0");
// puts("Yay!");
return 0;
fail:
// puts("NO");
// puts("No");
// puts("0");
puts("-1");
// puts("-1 -1 -1");
// puts("Impossible");
return 1;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
// scanf("%llu%llu", &h, &w);
// scanf("%llu", &n, &m);
// scanf("%llu", &k, &n, &m);
// scanf("%llu%llu", &h, &w);
// scanf("%llu", &q);
scanf("%s", s);
// scanf("%lld%lld", &va, &vb, &vc, &vd);
// scanf("%llu%llu%llu", &ua, &ub, &uc, &ud);
// scanf("%s", t);
scanf("%lld", &m);
// for (i = 0; i < n; i++) {
// // scanf("%lld%lld", &xy[i].a, &xy[i].b);
// // scanf("%lld%lld%lld", &tup[i].a, &tup[i].b, &tup[i].c);
// scanf("%lld", &a[i]);
// scanf("%lld", &b[i]);
// // scanf("%lld", &c[i]);
// // scanf("%lld", &d[i]);
// a[i]--;
// b[i]--;
// // c[i]--;
// // d[i]--;
// // xy[i].a--;
// // xy[i].b--;
// // tup[i].a--;
// // tup[i].b--;
// }
// scanf("%llu", &m, &k);
// scanf("%llu", &q);
// scanf("%s", s);
// for (i = 0; i < n; i++) {
// scanf("%lld", &a[i]);
// // scanf("%lld", &b[i]);
// // b[i]--;
// // c[i]--;
// }
// scanf("%llu", &q);
// for (i = 0; i < q; i++) {
// scanf("%lld%lld", &xy[i].a, &xy[i].b);
// xy[i].a--;
// xy[i].b--;
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < n; j++) {
// scanf("%lld", &table[i][j]);
// // table[i][j]--;
// }
// }
// for (i = 0; i < h; i++) {
// scanf("%s", s[i]);
// }
// scanf("%llu", &q);
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231166/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231166/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.hwll = type { i64, i64 }
%struct.hwllc = type { i64, i64, i64 }
@base = dso_local local_unnamed_addr global i64 262144, align 8
@seg = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16
@s = dso_local global [1000001 x i8] zeroinitializer, align 16
@n = dso_local local_unnamed_addr global i64 0, align 8
@dp = dso_local local_unnamed_addr global [10005 x [2 x [105 x i64]]] zeroinitializer, align 16
@m = dso_local global i64 0, align 8
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%lld\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
@q = dso_local local_unnamed_addr global i64 0, align 8
@va = dso_local local_unnamed_addr global i64 0, align 8
@vb = dso_local local_unnamed_addr global i64 0, align 8
@vc = dso_local local_unnamed_addr global i64 0, align 8
@vd = dso_local local_unnamed_addr global i64 0, align 8
@ve = dso_local local_unnamed_addr global i64 0, align 8
@vf = dso_local local_unnamed_addr global i64 0, align 8
@ua = dso_local local_unnamed_addr global i64 0, align 8
@ub = dso_local local_unnamed_addr global i64 0, align 8
@uc = dso_local local_unnamed_addr global i64 0, align 8
@ud = dso_local local_unnamed_addr global i64 0, align 8
@ue = dso_local local_unnamed_addr global i64 0, align 8
@uf = dso_local local_unnamed_addr global i64 0, align 8
@vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@ch = dso_local local_unnamed_addr global i8 0, align 1
@dh = dso_local local_unnamed_addr global i8 0, align 1
@a = dso_local local_unnamed_addr global [1000005 x i64] zeroinitializer, align 16
@b = dso_local local_unnamed_addr global [1000005 x i64] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [1000005 x i64] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [1000005 x i64] zeroinitializer, align 16
@e = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16
@u = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16
@xy = dso_local local_unnamed_addr global [1000005 x %struct.hwll] zeroinitializer, align 16
@tup = dso_local local_unnamed_addr global [1000005 x %struct.hwllc] zeroinitializer, align 16
@table = dso_local local_unnamed_addr global [3005 x [3005 x i64]] zeroinitializer, align 16
@p = dso_local local_unnamed_addr global [1000000 x double] zeroinitializer, align 16
@gin = dso_local local_unnamed_addr global [1000000 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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%sub = add i64 %modulo, -2
%tobool.not12.i = icmp eq i64 %sub, 0
br i1 %tobool.not12.i, label %bitpow.exit, label %while.body.i
while.body.i: ; preds = %entry, %if.end.i
%result.015.i = phi i64 [ %result.1.i, %if.end.i ], [ 1, %entry ]
%a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %b, %entry ]
%x.addr.013.i = phi i64 [ %div11.i, %if.end.i ], [ %sub, %entry ]
%and.i = and i64 %x.addr.013.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul i64 %a.addr.014.i, %result.015.i
%rem.i = urem i64 %mul.i, %modulo
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%result.1.i = phi i64 [ %rem.i, %if.then.i ], [ %result.015.i, %while.body.i ]
%div11.i = lshr i64 %x.addr.013.i, 1
%mul2.i = mul i64 %a.addr.014.i, %a.addr.014.i
%rem3.i = urem i64 %mul2.i, %modulo
%tobool.not.i = icmp ult i64 %x.addr.013.i, 2
br i1 %tobool.not.i, label %bitpow.exit, label %while.body.i, !llvm.loop !5
bitpow.exit: ; preds = %if.end.i, %entry
%result.0.lcssa.i = phi i64 [ 1, %entry ], [ %result.1.i, %if.end.i ]
%mul = mul i64 %result.0.lcssa.i, %a
%rem = urem i64 %mul, %modulo
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @udiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not = icmp ult i64 %a, %b
%sub = sub i64 %a, %b
%sub1 = sub i64 %b, %a
%retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sdiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %a, %b
%retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 {
entry:
%tobool.not6 = icmp eq i64 %n, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ]
%0 = trunc i64 %n.addr.07 to i32
%1 = and i32 %0, 1
%spec.select = add i32 %1, %result.08
%div5 = lshr i64 %n.addr.07, 1
%tobool.not = icmp ult i64 %n.addr.07, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !7
while.end: ; preds = %while.body, %entry
%result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
ret i32 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp ult i64 %0, %1
%cmp1 = icmp ugt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @prevcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp ult i64 %1, %0
%cmp1 = icmp ugt i64 %1, %0
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i8, ptr %left, align 1, !tbaa !12
%1 = load i8, ptr %right, align 1, !tbaa !12
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp sgt i8 %0, %1
%. = zext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pdoublecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load double, ptr %left, align 8, !tbaa !13
%1 = load double, ptr %right, align 8, !tbaa !13
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp ogt double %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @pstrcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr %left, align 8, !tbaa !15
%1 = load ptr, ptr %right, align 8, !tbaa !15
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #12
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptriplecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptripleREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pquadcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !20
%l.sroa.4.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.4.0.copyload = load i64, ptr %l.sroa.4.0.left.sroa_idx, align 8, !tbaa.struct !19
%l.sroa.5.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0.left.sroa_idx, align 8, !tbaa.struct !17
%l.sroa.6.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 24
%l.sroa.6.0.copyload = load i64, ptr %l.sroa.6.0.left.sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !20
%r.sroa.4.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.4.0.copyload = load i64, ptr %r.sroa.4.0.right.sroa_idx, align 8, !tbaa.struct !19
%r.sroa.5.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0.right.sroa_idx, align 8, !tbaa.struct !17
%r.sroa.6.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 24
%r.sroa.6.0.copyload = load i64, ptr %r.sroa.6.0.right.sroa_idx, align 8, !tbaa.struct !18
%cmp.i = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp.i, label %cleanup10, label %if.end.i
if.end.i: ; preds = %entry
%cmp4.i = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4.i, label %cleanup10, label %if.end6.i
if.end6.i: ; preds = %if.end.i
%cmp8.i = icmp slt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp8.i, label %cleanup10, label %phwllABcomp.exit
phwllABcomp.exit: ; preds = %if.end6.i
%cmp13.i.not = icmp sgt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp13.i.not, label %cleanup10, label %if.end
if.end: ; preds = %phwllABcomp.exit
%cmp.i21 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp.i21, label %cleanup10, label %if.end.i22
if.end.i22: ; preds = %if.end
%cmp4.i23 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4.i23, label %cleanup10, label %if.end6.i24
if.end6.i24: ; preds = %if.end.i22
%cmp8.i25 = icmp slt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
br i1 %cmp8.i25, label %cleanup10, label %if.end10.i26
if.end10.i26: ; preds = %if.end6.i24
%cmp13.i27 = icmp sgt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
%..i28 = zext i1 %cmp13.i27 to i32
br label %cleanup10
cleanup10: ; preds = %if.end10.i26, %if.end6.i24, %if.end.i22, %if.end, %if.end6.i, %if.end.i, %entry, %phwllABcomp.exit
%retval.1 = phi i32 [ 1, %phwllABcomp.exit ], [ -1, %if.end6.i ], [ 1, %if.end.i ], [ -1, %entry ], [ -1, %if.end ], [ 1, %if.end.i22 ], [ -1, %if.end6.i24 ], [ %..i28, %if.end10.i26 ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp = icmp sle i64 %left, %x
%cmp1 = icmp sle i64 %x, %right
%0 = and i1 %cmp, %cmp1
ret i1 %0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange_soft(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %left, %x
%cmp1.not = icmp sgt i64 %x, %right
%or.cond = or i1 %cmp.not, %cmp1.not
br i1 %or.cond, label %lor.rhs, label %lor.end
lor.rhs: ; preds = %entry
%cmp2 = icmp sge i64 %left, %x
%cmp3 = icmp sge i64 %x, %right
%0 = and i1 %cmp2, %cmp3
br label %lor.end
lor.end: ; preds = %entry, %lor.rhs
%1 = phi i1 [ %0, %lor.rhs ], [ true, %entry ]
ret i1 %1
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @segf_(i64 noundef %l, i64 noundef %r, i64 noundef %beg, i64 noundef %end, i64 noundef %i) local_unnamed_addr #6 {
entry:
%cmp.not = icmp sgt i64 %end, %l
%cmp1.not = icmp sgt i64 %r, %beg
%or.cond = and i1 %cmp1.not, %cmp.not
br i1 %or.cond, label %if.end, label %common.ret26
if.end: ; preds = %entry
%cmp2.not = icmp sgt i64 %l, %beg
%cmp3.not = icmp sgt i64 %end, %r
%or.cond25 = or i1 %cmp2.not, %cmp3.not
br i1 %or.cond25, label %if.end5, label %if.then4
if.then4: ; preds = %if.end
%arrayidx = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %i
%0 = load i64, ptr %arrayidx, align 8, !tbaa !8
br label %common.ret26
common.ret26: ; preds = %entry, %if.then4, %if.end5
%common.ret26.op = phi i64 [ %cond.i, %if.end5 ], [ %0, %if.then4 ], [ 0, %entry ]
ret i64 %common.ret26.op
if.end5: ; preds = %if.end
%add = add nsw i64 %end, %beg
%div = sdiv i64 %add, 2
%mul = shl nsw i64 %i, 1
%call = tail call i64 @segf_(i64 noundef %l, i64 noundef %r, i64 noundef %beg, i64 noundef %div, i64 noundef %mul)
%add7 = or i64 %mul, 1
%call8 = tail call i64 @segf_(i64 noundef %l, i64 noundef %r, i64 noundef %div, i64 noundef %end, i64 noundef %add7)
%cond.i = tail call i64 @llvm.smax.i64(i64 %call, i64 %call8)
br label %common.ret26
}
; Function Attrs: nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @segf(i64 noundef %l, i64 noundef %r) local_unnamed_addr #7 {
entry:
%0 = load i64, ptr @base, align 8, !tbaa !8
%call = tail call i64 @segf_(i64 noundef %l, i64 noundef %r, i64 noundef 0, i64 noundef %0, i64 noundef 1)
ret i64 %call
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @segup(i64 noundef %v, i64 noundef %x) local_unnamed_addr #8 {
entry:
%0 = load i64, ptr @base, align 8, !tbaa !8
%add = add nsw i64 %0, %v
%arrayidx = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %add
store i64 %x, ptr %arrayidx, align 8, !tbaa !8
%v.addr.0.off10 = add i64 %add, 1
%tobool.not11 = icmp ult i64 %v.addr.0.off10, 3
br i1 %tobool.not11, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%v.addr.012 = phi i64 [ %div, %while.body ], [ %add, %entry ]
%div = sdiv i64 %v.addr.012, 2
%mul = shl nsw i64 %div, 1
%arrayidx1 = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %mul
%1 = load i64, ptr %arrayidx1, align 16, !tbaa !8
%add3 = or i64 %mul, 1
%arrayidx4 = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %add3
%2 = load i64, ptr %arrayidx4, align 8, !tbaa !8
%cond.i = tail call i64 @llvm.smax.i64(i64 %1, i64 %2)
%arrayidx5 = getelementptr inbounds [524288 x i64], ptr @seg, i64 0, i64 %div
store i64 %cond.i, ptr %arrayidx5, align 8, !tbaa !8
%v.addr.0.off = add nsw i64 %div, 1
%tobool.not = icmp ult i64 %v.addr.0.off, 3
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !21
while.end: ; preds = %while.body, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bcnt(i64 noundef %x) local_unnamed_addr #1 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr6 = phi i64 [ %div3, %if.end ], [ %x, %entry ]
%accumulator.tr5 = phi i64 [ %add, %if.end ], [ 0, %entry ]
%div3 = lshr i64 %x.tr6, 1
%rem = and i64 %x.tr6, 1
%add = add i64 %rem, %accumulator.tr5
%tobool.not = icmp ult i64 %x.tr6, 2
br i1 %tobool.not, label %return, label %if.end
return: ; preds = %if.end, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %if.end ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #9 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #12
store i64 %call, ptr @n, align 8, !tbaa !8
store i64 1, ptr @dp, align 16, !tbaa !8
%cmp99.not = icmp eq i64 %call, 0
br i1 %cmp99.not, label %for.cond38.preheader, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = load i64, ptr @m, align 8, !tbaa !8
%cmp587.not = icmp eq i64 %0, 0
br i1 %cmp587.not, label %for.cond38.preheader, label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.lr.ph, %for.inc35.split.us.us
%i.0100.us = phi i64 [ %add84.us, %for.inc35.split.us.us ], [ 0, %for.cond1.preheader.lr.ph ]
%arrayidx.us = getelementptr inbounds [1000001 x i8], ptr @s, i64 0, i64 %i.0100.us
%add84.us = add nuw nsw i64 %i.0100.us, 1
br label %for.cond4.preheader.us.us
for.cond4.preheader.us.us: ; preds = %for.cond4.for.inc32_crit_edge.us.us, %for.cond1.preheader.us
%tobool.not.us.us = phi i1 [ true, %for.cond1.preheader.us ], [ false, %for.cond4.for.inc32_crit_edge.us.us ]
%j.090.us.us = phi i64 [ 0, %for.cond1.preheader.us ], [ 1, %for.cond4.for.inc32_crit_edge.us.us ]
br i1 %tobool.not.us.us, label %for.cond7.preheader.lr.ph.split.us.us.us, label %for.cond7.preheader.us94.us
for.cond7.preheader.us94.us: ; preds = %for.cond4.preheader.us.us, %for.cond7.preheader.us94.us
%ki.088.us95.us = phi i64 [ %add22.us.us.1, %for.cond7.preheader.us94.us ], [ 0, %for.cond4.preheader.us.us ]
%arrayidx26.us96.us = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %i.0100.us, i64 %j.090.us.us, i64 %ki.088.us95.us
%arrayidx23.us.us = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %ki.088.us95.us
%1 = load i64, ptr %arrayidx23.us.us, align 8, !tbaa !8
%2 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us = add i64 %2, %1
%rem28.us.us = urem i64 %add27.us.us, 1000000007
store i64 %rem28.us.us, ptr %arrayidx23.us.us, align 8, !tbaa !8
%add22.us.us.1 = add nuw nsw i64 %ki.088.us95.us, 1
%3 = icmp eq i64 %add22.us.us.1, %0
%iv.rem = select i1 %3, i64 0, i64 %add22.us.us.1
%arrayidx23.us.us.1 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %iv.rem
%4 = load i64, ptr %arrayidx23.us.us.1, align 8, !tbaa !8
%5 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.1 = add i64 %5, %4
%rem28.us.us.1 = urem i64 %add27.us.us.1, 1000000007
store i64 %rem28.us.us.1, ptr %arrayidx23.us.us.1, align 8, !tbaa !8
%add22.us.us.2 = add nuw nsw i64 %ki.088.us95.us, 2
%rem.us.us.2 = urem i64 %add22.us.us.2, %0
%arrayidx23.us.us.2 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %rem.us.us.2
%6 = load i64, ptr %arrayidx23.us.us.2, align 8, !tbaa !8
%7 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.2 = add i64 %7, %6
%rem28.us.us.2 = urem i64 %add27.us.us.2, 1000000007
store i64 %rem28.us.us.2, ptr %arrayidx23.us.us.2, align 8, !tbaa !8
%add22.us.us.3 = add nuw nsw i64 %ki.088.us95.us, 3
%rem.us.us.3 = urem i64 %add22.us.us.3, %0
%arrayidx23.us.us.3 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %rem.us.us.3
%8 = load i64, ptr %arrayidx23.us.us.3, align 8, !tbaa !8
%9 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.3 = add i64 %9, %8
%rem28.us.us.3 = urem i64 %add27.us.us.3, 1000000007
store i64 %rem28.us.us.3, ptr %arrayidx23.us.us.3, align 8, !tbaa !8
%add22.us.us.4 = add nuw nsw i64 %ki.088.us95.us, 4
%rem.us.us.4 = urem i64 %add22.us.us.4, %0
%arrayidx23.us.us.4 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %rem.us.us.4
%10 = load i64, ptr %arrayidx23.us.us.4, align 8, !tbaa !8
%11 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.4 = add i64 %11, %10
%rem28.us.us.4 = urem i64 %add27.us.us.4, 1000000007
store i64 %rem28.us.us.4, ptr %arrayidx23.us.us.4, align 8, !tbaa !8
%add22.us.us.5 = add nuw nsw i64 %ki.088.us95.us, 5
%rem.us.us.5 = urem i64 %add22.us.us.5, %0
%arrayidx23.us.us.5 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %rem.us.us.5
%12 = load i64, ptr %arrayidx23.us.us.5, align 8, !tbaa !8
%13 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.5 = add i64 %13, %12
%rem28.us.us.5 = urem i64 %add27.us.us.5, 1000000007
store i64 %rem28.us.us.5, ptr %arrayidx23.us.us.5, align 8, !tbaa !8
%add22.us.us.6 = add nuw nsw i64 %ki.088.us95.us, 6
%rem.us.us.6 = urem i64 %add22.us.us.6, %0
%arrayidx23.us.us.6 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %rem.us.us.6
%14 = load i64, ptr %arrayidx23.us.us.6, align 8, !tbaa !8
%15 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.6 = add i64 %15, %14
%rem28.us.us.6 = urem i64 %add27.us.us.6, 1000000007
store i64 %rem28.us.us.6, ptr %arrayidx23.us.us.6, align 8, !tbaa !8
%add22.us.us.7 = add nuw nsw i64 %ki.088.us95.us, 7
%rem.us.us.7 = urem i64 %add22.us.us.7, %0
%arrayidx23.us.us.7 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %rem.us.us.7
%16 = load i64, ptr %arrayidx23.us.us.7, align 8, !tbaa !8
%17 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.7 = add i64 %17, %16
%rem28.us.us.7 = urem i64 %add27.us.us.7, 1000000007
store i64 %rem28.us.us.7, ptr %arrayidx23.us.us.7, align 8, !tbaa !8
%add22.us.us.8 = add nuw nsw i64 %ki.088.us95.us, 8
%rem.us.us.8 = urem i64 %add22.us.us.8, %0
%arrayidx23.us.us.8 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %rem.us.us.8
%18 = load i64, ptr %arrayidx23.us.us.8, align 8, !tbaa !8
%19 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.8 = add i64 %19, %18
%rem28.us.us.8 = urem i64 %add27.us.us.8, 1000000007
store i64 %rem28.us.us.8, ptr %arrayidx23.us.us.8, align 8, !tbaa !8
%add22.us.us.9 = add nuw nsw i64 %ki.088.us95.us, 9
%rem.us.us.9 = urem i64 %add22.us.us.9, %0
%arrayidx23.us.us.9 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 1, i64 %rem.us.us.9
%20 = load i64, ptr %arrayidx23.us.us.9, align 8, !tbaa !8
%21 = load i64, ptr %arrayidx26.us96.us, align 8, !tbaa !8
%add27.us.us.9 = add i64 %21, %20
%rem28.us.us.9 = urem i64 %add27.us.us.9, 1000000007
store i64 %rem28.us.us.9, ptr %arrayidx23.us.us.9, align 8, !tbaa !8
%exitcond.not = icmp eq i64 %add22.us.us.1, %0
br i1 %exitcond.not, label %for.cond4.for.inc32_crit_edge.us.us, label %for.cond7.preheader.us94.us, !llvm.loop !22
for.cond4.for.inc32_crit_edge.us.us: ; preds = %for.cond7.preheader.us94.us, %for.inc29.split.us.us.us.us
br i1 %tobool.not.us.us, label %for.cond4.preheader.us.us, label %for.inc35.split.us.us, !llvm.loop !23
for.cond7.preheader.lr.ph.split.us.us.us: ; preds = %for.cond4.preheader.us.us
%22 = load i8, ptr %arrayidx.us, align 1, !tbaa !12
%23 = tail call i8 @llvm.smax.i8(i8 %22, i8 47)
%24 = zext i8 %23 to i64
%smax = add nsw i64 %24, -47
%exitcond105 = icmp eq i64 %smax, 0
%cmp19.us.us.us.us = icmp sgt i8 %22, 48
%idxprom.us.us.us.us = zext i1 %cmp19.us.us.us.us to i64
%exitcond105.1 = icmp eq i64 %smax, 1
%cmp19.us.us.us.us.1 = icmp sgt i8 %22, 49
%idxprom.us.us.us.us.1 = zext i1 %cmp19.us.us.us.us.1 to i64
%exitcond105.2 = icmp eq i64 %smax, 2
%cmp19.us.us.us.us.2 = icmp sgt i8 %22, 50
%idxprom.us.us.us.us.2 = zext i1 %cmp19.us.us.us.us.2 to i64
%exitcond105.3 = icmp eq i64 %smax, 3
%cmp19.us.us.us.us.3 = icmp sgt i8 %22, 51
%idxprom.us.us.us.us.3 = zext i1 %cmp19.us.us.us.us.3 to i64
%exitcond105.4 = icmp eq i64 %smax, 4
%cmp19.us.us.us.us.4 = icmp sgt i8 %22, 52
%idxprom.us.us.us.us.4 = zext i1 %cmp19.us.us.us.us.4 to i64
%exitcond105.5 = icmp eq i64 %smax, 5
%cmp19.us.us.us.us.5 = icmp sgt i8 %22, 53
%idxprom.us.us.us.us.5 = zext i1 %cmp19.us.us.us.us.5 to i64
%exitcond105.6 = icmp eq i64 %smax, 6
%cmp19.us.us.us.us.6 = icmp sgt i8 %22, 54
%idxprom.us.us.us.us.6 = zext i1 %cmp19.us.us.us.us.6 to i64
%exitcond105.7 = icmp eq i64 %smax, 7
%cmp19.us.us.us.us.7 = icmp sgt i8 %22, 55
%idxprom.us.us.us.us.7 = zext i1 %cmp19.us.us.us.us.7 to i64
%exitcond105.8 = icmp eq i64 %smax, 8
%cmp19.us.us.us.us.8 = icmp sgt i8 %22, 56
%idxprom.us.us.us.us.8 = zext i1 %cmp19.us.us.us.us.8 to i64
%exitcond105.9 = icmp eq i64 %smax, 9
%cmp19.us.us.us.us.9 = icmp sgt i8 %22, 57
%idxprom.us.us.us.us.9 = zext i1 %cmp19.us.us.us.us.9 to i64
br label %for.cond7.preheader.us.us.us
for.cond7.preheader.us.us.us: ; preds = %for.inc29.split.us.us.us.us, %for.cond7.preheader.lr.ph.split.us.us.us
%ki.088.us.us.us = phi i64 [ 0, %for.cond7.preheader.lr.ph.split.us.us.us ], [ %inc30.us.us.us, %for.inc29.split.us.us.us.us ]
%arrayidx26.us.us.us = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %i.0100.us, i64 0, i64 %ki.088.us.us.us
br i1 %exitcond105, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us
lor.rhs.us.us.us.us: ; preds = %for.cond7.preheader.us.us.us
%arrayidx23.us.us.us.us = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us, i64 %ki.088.us.us.us
%25 = load i64, ptr %arrayidx23.us.us.us.us, align 8, !tbaa !8
%26 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us = add i64 %26, %25
%rem28.us.us.us.us = urem i64 %add27.us.us.us.us, 1000000007
store i64 %rem28.us.us.us.us, ptr %arrayidx23.us.us.us.us, align 8, !tbaa !8
br i1 %exitcond105.1, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.1
lor.rhs.us.us.us.us.1: ; preds = %lor.rhs.us.us.us.us
%add22.us.us.us.us.1 = add nuw nsw i64 %ki.088.us.us.us, 1
%27 = icmp eq i64 %add22.us.us.us.us.1, %0
%iv.rem107 = select i1 %27, i64 0, i64 %add22.us.us.us.us.1
%arrayidx23.us.us.us.us.1 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.1, i64 %iv.rem107
%28 = load i64, ptr %arrayidx23.us.us.us.us.1, align 8, !tbaa !8
%add27.us.us.us.us.1 = add i64 %26, %28
%rem28.us.us.us.us.1 = urem i64 %add27.us.us.us.us.1, 1000000007
store i64 %rem28.us.us.us.us.1, ptr %arrayidx23.us.us.us.us.1, align 8, !tbaa !8
br i1 %exitcond105.2, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.2
lor.rhs.us.us.us.us.2: ; preds = %lor.rhs.us.us.us.us.1
%add22.us.us.us.us.2 = add nuw nsw i64 %ki.088.us.us.us, 2
%rem.us.us.us.us.2 = urem i64 %add22.us.us.us.us.2, %0
%arrayidx23.us.us.us.us.2 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.2, i64 %rem.us.us.us.us.2
%29 = load i64, ptr %arrayidx23.us.us.us.us.2, align 8, !tbaa !8
%30 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us.2 = add i64 %30, %29
%rem28.us.us.us.us.2 = urem i64 %add27.us.us.us.us.2, 1000000007
store i64 %rem28.us.us.us.us.2, ptr %arrayidx23.us.us.us.us.2, align 8, !tbaa !8
br i1 %exitcond105.3, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.3
lor.rhs.us.us.us.us.3: ; preds = %lor.rhs.us.us.us.us.2
%add22.us.us.us.us.3 = add nuw nsw i64 %ki.088.us.us.us, 3
%rem.us.us.us.us.3 = urem i64 %add22.us.us.us.us.3, %0
%arrayidx23.us.us.us.us.3 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.3, i64 %rem.us.us.us.us.3
%31 = load i64, ptr %arrayidx23.us.us.us.us.3, align 8, !tbaa !8
%32 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us.3 = add i64 %32, %31
%rem28.us.us.us.us.3 = urem i64 %add27.us.us.us.us.3, 1000000007
store i64 %rem28.us.us.us.us.3, ptr %arrayidx23.us.us.us.us.3, align 8, !tbaa !8
br i1 %exitcond105.4, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.4
lor.rhs.us.us.us.us.4: ; preds = %lor.rhs.us.us.us.us.3
%add22.us.us.us.us.4 = add nuw nsw i64 %ki.088.us.us.us, 4
%rem.us.us.us.us.4 = urem i64 %add22.us.us.us.us.4, %0
%arrayidx23.us.us.us.us.4 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.4, i64 %rem.us.us.us.us.4
%33 = load i64, ptr %arrayidx23.us.us.us.us.4, align 8, !tbaa !8
%34 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us.4 = add i64 %34, %33
%rem28.us.us.us.us.4 = urem i64 %add27.us.us.us.us.4, 1000000007
store i64 %rem28.us.us.us.us.4, ptr %arrayidx23.us.us.us.us.4, align 8, !tbaa !8
br i1 %exitcond105.5, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.5
lor.rhs.us.us.us.us.5: ; preds = %lor.rhs.us.us.us.us.4
%add22.us.us.us.us.5 = add nuw nsw i64 %ki.088.us.us.us, 5
%rem.us.us.us.us.5 = urem i64 %add22.us.us.us.us.5, %0
%arrayidx23.us.us.us.us.5 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.5, i64 %rem.us.us.us.us.5
%35 = load i64, ptr %arrayidx23.us.us.us.us.5, align 8, !tbaa !8
%36 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us.5 = add i64 %36, %35
%rem28.us.us.us.us.5 = urem i64 %add27.us.us.us.us.5, 1000000007
store i64 %rem28.us.us.us.us.5, ptr %arrayidx23.us.us.us.us.5, align 8, !tbaa !8
br i1 %exitcond105.6, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.6
lor.rhs.us.us.us.us.6: ; preds = %lor.rhs.us.us.us.us.5
%add22.us.us.us.us.6 = add nuw nsw i64 %ki.088.us.us.us, 6
%rem.us.us.us.us.6 = urem i64 %add22.us.us.us.us.6, %0
%arrayidx23.us.us.us.us.6 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.6, i64 %rem.us.us.us.us.6
%37 = load i64, ptr %arrayidx23.us.us.us.us.6, align 8, !tbaa !8
%38 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us.6 = add i64 %38, %37
%rem28.us.us.us.us.6 = urem i64 %add27.us.us.us.us.6, 1000000007
store i64 %rem28.us.us.us.us.6, ptr %arrayidx23.us.us.us.us.6, align 8, !tbaa !8
br i1 %exitcond105.7, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.7
lor.rhs.us.us.us.us.7: ; preds = %lor.rhs.us.us.us.us.6
%add22.us.us.us.us.7 = add nuw nsw i64 %ki.088.us.us.us, 7
%rem.us.us.us.us.7 = urem i64 %add22.us.us.us.us.7, %0
%arrayidx23.us.us.us.us.7 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.7, i64 %rem.us.us.us.us.7
%39 = load i64, ptr %arrayidx23.us.us.us.us.7, align 8, !tbaa !8
%40 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us.7 = add i64 %40, %39
%rem28.us.us.us.us.7 = urem i64 %add27.us.us.us.us.7, 1000000007
store i64 %rem28.us.us.us.us.7, ptr %arrayidx23.us.us.us.us.7, align 8, !tbaa !8
br i1 %exitcond105.8, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.8
lor.rhs.us.us.us.us.8: ; preds = %lor.rhs.us.us.us.us.7
%add22.us.us.us.us.8 = add nuw nsw i64 %ki.088.us.us.us, 8
%rem.us.us.us.us.8 = urem i64 %add22.us.us.us.us.8, %0
%arrayidx23.us.us.us.us.8 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.8, i64 %rem.us.us.us.us.8
%41 = load i64, ptr %arrayidx23.us.us.us.us.8, align 8, !tbaa !8
%42 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us.8 = add i64 %42, %41
%rem28.us.us.us.us.8 = urem i64 %add27.us.us.us.us.8, 1000000007
store i64 %rem28.us.us.us.us.8, ptr %arrayidx23.us.us.us.us.8, align 8, !tbaa !8
br i1 %exitcond105.9, label %for.inc29.split.us.us.us.us, label %lor.rhs.us.us.us.us.9
lor.rhs.us.us.us.us.9: ; preds = %lor.rhs.us.us.us.us.8
%add22.us.us.us.us.9 = add nuw nsw i64 %ki.088.us.us.us, 9
%rem.us.us.us.us.9 = urem i64 %add22.us.us.us.us.9, %0
%arrayidx23.us.us.us.us.9 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %add84.us, i64 %idxprom.us.us.us.us.9, i64 %rem.us.us.us.us.9
%43 = load i64, ptr %arrayidx23.us.us.us.us.9, align 8, !tbaa !8
%44 = load i64, ptr %arrayidx26.us.us.us, align 8, !tbaa !8
%add27.us.us.us.us.9 = add i64 %44, %43
%rem28.us.us.us.us.9 = urem i64 %add27.us.us.us.us.9, 1000000007
store i64 %rem28.us.us.us.us.9, ptr %arrayidx23.us.us.us.us.9, align 8, !tbaa !8
br label %for.inc29.split.us.us.us.us
for.inc29.split.us.us.us.us: ; preds = %lor.rhs.us.us.us.us.9, %lor.rhs.us.us.us.us.8, %lor.rhs.us.us.us.us.7, %lor.rhs.us.us.us.us.6, %lor.rhs.us.us.us.us.5, %lor.rhs.us.us.us.us.4, %lor.rhs.us.us.us.us.3, %lor.rhs.us.us.us.us.2, %lor.rhs.us.us.us.us.1, %lor.rhs.us.us.us.us, %for.cond7.preheader.us.us.us
%inc30.us.us.us = add nuw nsw i64 %ki.088.us.us.us, 1
%exitcond108.not = icmp eq i64 %inc30.us.us.us, %0
br i1 %exitcond108.not, label %for.cond4.for.inc32_crit_edge.us.us, label %for.cond7.preheader.us.us.us, !llvm.loop !22
for.inc35.split.us.us: ; preds = %for.cond4.for.inc32_crit_edge.us.us
%exitcond109.not = icmp eq i64 %add84.us, %call
br i1 %exitcond109.not, label %for.cond38.preheader, label %for.cond1.preheader.us, !llvm.loop !24
for.cond38.preheader: ; preds = %for.inc35.split.us.us, %for.cond1.preheader.lr.ph, %entry
%arrayidx43 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %call, i64 0
%45 = load i64, ptr %arrayidx43, align 16, !tbaa !8
%add45 = add i64 %45, 1000000006
%rem46 = urem i64 %add45, 1000000007
%arrayidx43.1 = getelementptr inbounds [10005 x [2 x [105 x i64]]], ptr @dp, i64 0, i64 %call, i64 1
%46 = load i64, ptr %arrayidx43.1, align 8, !tbaa !8
%add45.1 = add i64 %46, %rem46
%rem46.1 = urem i64 %add45.1, 1000000007
%call50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %rem46.1)
ret i64 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #9 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @s)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @m)
%call2 = tail call i64 @solve()
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.smax.i8(i8, i8) #11
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #12 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!10, !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !10, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !10, i64 0}
!17 = !{i64 0, i64 8, !8, i64 8, i64 8, !8}
!18 = !{i64 0, i64 8, !8}
!19 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8}
!20 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8, i64 24, i64 8, !8}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
|
#include<stdio.h>
#define N 200000
double count=0;
void margesort(int,int);
void marge(int,int,int);
int S[N],Left[N/2+1],Right[N/2+1];
int main(){
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&S[i]);
margesort(0,n);
printf("%0.f\n",count);
return 0;
}
void margesort(int left,int right){
int mid;
if(left+1 < right){
mid = (left + right)/2;
margesort(left,mid);
margesort(mid,right);
marge(left,mid,right);
}
}
void marge(int left,int mid,int right){
int n1,n2,i,j=0,k;
n1 = mid - left;
n2 = right - mid;
for(i=0;i<n1;i++) Left[i] = S[left+i];
Left[n1]=-1;
for(i=0;i<n2;i++) Right[i] = S[mid+i];
Right[n2]=-1;
i=0;
for(k=left;k<right;k++){
if(Left[i] > Right[j]){
S[k] = Left[i];
i++;
count += n2 - j;
}
else{
S[k] = Right[j];
j++;
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231209/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231209/source.c"
target datalayout = "e-m:e-p270: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 double 0.000000e+00, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@S = dso_local global [200000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%0.f\0A\00", align 1
@Left = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@Right = dso_local local_unnamed_addr global [100001 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i32], ptr @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 @margesort(i32 noundef 0, i32 noundef %.lcssa)
%3 = load double, ptr @count, align 8, !tbaa !11
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %3)
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, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @margesort(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 %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @margesort(i32 noundef %left, i32 noundef %div)
tail call void @margesort(i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub nsw i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.end.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep.i = getelementptr i8, ptr @S, i64 %1
%2 = xor i32 %left, -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) @Left, ptr noundef nonnull align 4 dereferenceable(1) %scevgep.i, i64 %6, i1 false), !tbaa !5
br label %for.end.i
for.end.i: ; preds = %for.body.preheader.i, %if.then
%idxprom4.i = sext i32 %sub.i to i64
%arrayidx5.i = getelementptr inbounds [100001 x i32], ptr @Left, i64 0, i64 %idxprom4.i
store i32 -1, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp769.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp769.i, label %for.body8.preheader.i, label %for.end16.i
for.body8.preheader.i: ; preds = %for.end.i
%7 = sext i32 %div to i64
%8 = shl nsw i64 %7, 2
%scevgep80.i = getelementptr i8, ptr @S, i64 %8
%9 = xor i32 %div, -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 16 dereferenceable(1) @Right, ptr noundef nonnull align 4 dereferenceable(1) %scevgep80.i, i64 %13, i1 false), !tbaa !5
br label %for.end16.i
for.end16.i: ; preds = %for.body8.preheader.i, %for.end.i
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [100001 x i32], ptr @Right, i64 0, i64 %idxprom17.i
store i32 -1, ptr %arrayidx18.i, align 4, !tbaa !5
%count.promoted.i = load double, ptr @count, align 8, !tbaa !11
%14 = sext i32 %left to i64
%wide.trip.count.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.inc39.i, %for.end16.i
%indvars.iv.i = phi i64 [ %14, %for.end16.i ], [ %indvars.iv.next.i, %for.inc39.i ]
%j.076.i = phi i32 [ 0, %for.end16.i ], [ %j.1.i, %for.inc39.i ]
%i.275.i = phi i32 [ 0, %for.end16.i ], [ %i.3.i, %for.inc39.i ]
%add337274.i = phi double [ %count.promoted.i, %for.end16.i ], [ %add3371.i, %for.inc39.i ]
%idxprom22.i = sext i32 %i.275.i to i64
%arrayidx23.i = getelementptr inbounds [100001 x i32], ptr @Left, i64 0, i64 %idxprom22.i
%15 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%idxprom24.i = sext i32 %j.076.i to i64
%arrayidx25.i = getelementptr inbounds [100001 x i32], ptr @Right, i64 0, i64 %idxprom24.i
%16 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%cmp26.i = icmp sgt i32 %15, %16
br i1 %cmp26.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %for.body21.i
%inc31.i = add nsw i32 %i.275.i, 1
%sub32.i = sub nsw i32 %sub1.i, %j.076.i
%conv.i = sitofp i32 %sub32.i to double
%add33.i = fadd double %add337274.i, %conv.i
store double %add33.i, ptr @count, align 8, !tbaa !11
br label %for.inc39.i
if.else.i: ; preds = %for.body21.i
%inc38.i = add nsw i32 %j.076.i, 1
br label %for.inc39.i
for.inc39.i: ; preds = %if.else.i, %if.then.i
%.sink.i = phi i32 [ %15, %if.then.i ], [ %16, %if.else.i ]
%add3371.i = phi double [ %add33.i, %if.then.i ], [ %add337274.i, %if.else.i ]
%i.3.i = phi i32 [ %inc31.i, %if.then.i ], [ %i.275.i, %if.else.i ]
%j.1.i = phi i32 [ %j.076.i, %if.then.i ], [ %inc38.i, %if.else.i ]
%17 = getelementptr inbounds [200000 x i32], ptr @S, 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.count.i
br i1 %exitcond.not.i, label %if.end, label %for.body21.i, !llvm.loop !13
if.end: ; preds = %for.inc39.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, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @marge(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
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr @S, 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 16 dereferenceable(1) @Left, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%idxprom4 = sext i32 %sub to i64
%arrayidx5 = getelementptr inbounds [100001 x i32], ptr @Left, i64 0, i64 %idxprom4
store i32 -1, ptr %arrayidx5, align 4, !tbaa !5
%cmp769 = icmp sgt i32 %sub1, 0
br i1 %cmp769, label %for.body8.preheader, label %for.end16
for.body8.preheader: ; preds = %for.end
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep80 = getelementptr i8, ptr @S, 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 16 dereferenceable(1) @Right, ptr noundef nonnull align 4 dereferenceable(1) %scevgep80, i64 %13, i1 false), !tbaa !5
br label %for.end16
for.end16: ; preds = %for.body8.preheader, %for.end
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [100001 x i32], ptr @Right, i64 0, i64 %idxprom17
store i32 -1, ptr %arrayidx18, align 4, !tbaa !5
%cmp2073 = icmp slt i32 %left, %right
br i1 %cmp2073, label %for.body21.preheader, label %for.end41
for.body21.preheader: ; preds = %for.end16
%count.promoted = load double, ptr @count, align 8, !tbaa !11
%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.inc39
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.inc39 ]
%j.076 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.inc39 ]
%i.275 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.inc39 ]
%add337274 = phi double [ %count.promoted, %for.body21.preheader ], [ %add3371, %for.inc39 ]
%idxprom22 = sext i32 %i.275 to i64
%arrayidx23 = getelementptr inbounds [100001 x i32], ptr @Left, i64 0, i64 %idxprom22
%15 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %j.076 to i64
%arrayidx25 = getelementptr inbounds [100001 x i32], ptr @Right, i64 0, i64 %idxprom24
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %15, %16
br i1 %cmp26, label %if.then, label %if.else
if.then: ; preds = %for.body21
%inc31 = add nsw i32 %i.275, 1
%sub32 = sub nsw i32 %sub1, %j.076
%conv = sitofp i32 %sub32 to double
%add33 = fadd double %add337274, %conv
store double %add33, ptr @count, align 8, !tbaa !11
br label %for.inc39
if.else: ; preds = %for.body21
%inc38 = add nsw i32 %j.076, 1
br label %for.inc39
for.inc39: ; preds = %if.then, %if.else
%.sink = phi i32 [ %15, %if.then ], [ %16, %if.else ]
%add3371 = phi double [ %add33, %if.then ], [ %add337274, %if.else ]
%i.3 = phi i32 [ %inc31, %if.then ], [ %i.275, %if.else ]
%j.1 = phi i32 [ %j.076, %if.then ], [ %inc38, %if.else ]
%17 = getelementptr inbounds [200000 x i32], ptr @S, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %17, 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.body21, !llvm.loop !13
for.end41: ; preds = %for.inc39, %for.end16
ret void
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
int get_uint() {
int n = 0;
int c = getchar_unlocked();
if(c < 48 || 57 < c) return c;
while(47 < c && c < 58) {
n = 10 * n + (c & 0xf);
c = getchar_unlocked();
}
return n;
}
void put_ull(long long n) {
if(!n) {
putchar_unlocked('0');
return;
}
char buf[20];
int i = 0;
while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
while(i--)putchar_unlocked(buf[i]);
}
long long merge_sort(int *first, int *last) {
const int N = (int)(last - first);
if(N < 2) return 0;
int *mid = first + N / 2;
const int N1 = (int)(mid - first);
const int N2 = (int)(last - mid);
int *left = malloc(sizeof(int) * (N1 + 1));
int *right = malloc(sizeof(int) * (N2 + 1));
memcpy(left, first, sizeof(int) * (N1 + 1));
memcpy(right, mid, sizeof(int) * (N2 + 1));
left[N1] = right[N2] = 1 << 30;
long long cnt = 0;
cnt += merge_sort(left, left + N1);
cnt += merge_sort(right, right + N2);
for(int *it = first, i = 0, j = 0; it != last; ++it) {
if(left[i] <= right[j]) *it = left[i++];
else *it = right[j++], cnt += N / 2 - i;
}
free(left);
free(right);
return cnt;
}
int main(int argc, char **argv) {
int n = get_uint();
int a[200001];
for(int i = 0; i < n; ++i) a[i] = get_uint();
put_ull(merge_sort(a, a + n));
putchar_unlocked('\n');
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231252/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231252/source.c"
target datalayout = "e-m:e-p270: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] }
@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 @get_uint() 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) #6
br label %getchar_unlocked.exit
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 %getchar_unlocked.exit
getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%4 = add i32 %cond.i, -58
%or.cond = icmp ult i32 %4, -10
br i1 %or.cond, label %cleanup, label %while.body.preheader
while.body.preheader: ; preds = %getchar_unlocked.exit
%.pre24 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit21
%5 = phi ptr [ %9, %getchar_unlocked.exit21 ], [ %.pre24, %while.body.preheader ]
%c.023 = phi i32 [ %cond.i17, %getchar_unlocked.exit21 ], [ %cond.i, %while.body.preheader ]
%n.022 = phi i32 [ %add, %getchar_unlocked.exit21 ], [ 0, %while.body.preheader ]
%mul = mul nsw i32 %n.022, 10
%and = and i32 %c.023, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i12 = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 1
%6 = load ptr, ptr %_IO_read_ptr.i12, align 8, !tbaa !9
%_IO_read_end.i13 = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 2
%7 = load ptr, ptr %_IO_read_end.i13, align 8, !tbaa !14
%cmp.not.i14 = icmp ult ptr %6, %7
br i1 %cmp.not.i14, label %cond.false.i18, label %cond.true.i15, !prof !15
cond.true.i15: ; preds = %while.body
%call.i16 = tail call i32 @__uflow(ptr noundef nonnull %5) #6
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit21
cond.false.i18: ; preds = %while.body
%incdec.ptr.i19 = getelementptr inbounds i8, ptr %6, i64 1
store ptr %incdec.ptr.i19, ptr %_IO_read_ptr.i12, align 8, !tbaa !9
%8 = load i8, ptr %6, align 1, !tbaa !16
%conv3.i20 = zext i8 %8 to i32
br label %getchar_unlocked.exit21
getchar_unlocked.exit21: ; preds = %cond.true.i15, %cond.false.i18
%9 = phi ptr [ %.pre, %cond.true.i15 ], [ %5, %cond.false.i18 ]
%cond.i17 = phi i32 [ %call.i16, %cond.true.i15 ], [ %conv3.i20, %cond.false.i18 ]
%10 = add i32 %cond.i17, -48
%11 = icmp ult i32 %10, 10
br i1 %11, label %while.body, label %cleanup, !llvm.loop !17
cleanup: ; preds = %getchar_unlocked.exit21, %getchar_unlocked.exit
%retval.0 = phi i32 [ %cond.i, %getchar_unlocked.exit ], [ %add, %getchar_unlocked.exit21 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local void @put_ull(i64 noundef %n) local_unnamed_addr #0 {
entry:
%buf = alloca [20 x i8], align 16
%tobool.not = icmp eq i64 %n, 0
br i1 %tobool.not, label %if.then, label %if.end
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) #6
br label %return
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 %return
if.end: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %buf) #6
br label %while.body
while.body: ; preds = %if.end, %while.body
%indvars.iv28 = phi i32 [ 1, %if.end ], [ %indvars.iv.next29, %while.body ]
%indvars.iv = phi i64 [ 0, %if.end ], [ %indvars.iv.next, %while.body ]
%n.addr.024 = phi i64 [ %n, %if.end ], [ %div, %while.body ]
%rem = srem i64 %n.addr.024, 10
%3 = trunc i64 %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 i64 %n.addr.024, 10
%n.addr.024.off = add i64 %n.addr.024, 9
%tobool1.not = icmp ult i64 %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) #6
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 %while.end9, label %while.body4, !llvm.loop !22
while.end9: ; preds = %putchar_unlocked.exit23
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %buf) #6
br label %return
return: ; preds = %cond.false.i, %cond.true.i, %while.end9
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i64 @merge_sort(ptr noundef %first, ptr noundef %last) local_unnamed_addr #0 {
entry:
%sub.ptr.lhs.cast = ptrtoint ptr %last to i64
%sub.ptr.rhs.cast = ptrtoint ptr %first to i64
%sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast
%sub.ptr.div = lshr exact i64 %sub.ptr.sub, 2
%conv = trunc i64 %sub.ptr.div to i32
%cmp = icmp slt i32 %conv, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%div89 = lshr i32 %conv, 1
%idx.ext = zext i32 %div89 to i64
%add.ptr = getelementptr inbounds i32, ptr %first, i64 %idx.ext
%sub.ptr.lhs.cast2 = ptrtoint ptr %add.ptr to i64
%sub.ptr.sub9 = sub i64 %sub.ptr.lhs.cast, %sub.ptr.lhs.cast2
%add = add nuw nsw i32 %div89, 1
%conv12 = zext i32 %add to i64
%mul = shl nuw nsw i64 %conv12, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #7
%add13 = shl i64 %sub.ptr.sub9, 30
%sext = add i64 %add13, 4294967296
%0 = ashr exact i64 %sext, 30
%mul15 = and i64 %0, -4
%call16 = tail call noalias ptr @malloc(i64 noundef %mul15) #7
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %first, i64 %mul, i1 false)
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %call16, ptr align 4 %add.ptr, i64 %mul15, i1 false)
%idxprom = ashr i64 %add13, 32
%arrayidx = getelementptr inbounds i32, ptr %call16, i64 %idxprom
store i32 1073741824, ptr %arrayidx, align 4, !tbaa !23
%arrayidx24 = getelementptr inbounds i32, ptr %call, i64 %idx.ext
store i32 1073741824, ptr %arrayidx24, align 4, !tbaa !23
%call27 = tail call i64 @merge_sort(ptr noundef %call, ptr noundef nonnull %arrayidx24)
%call31 = tail call i64 @merge_sort(ptr noundef %call16, ptr noundef nonnull %arrayidx)
%add32 = add nsw i64 %call31, %call27
%cmp33.not91 = icmp eq ptr %first, %last
br i1 %cmp33.not91, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.inc, %if.end
%cnt.0.lcssa = phi i64 [ %add32, %if.end ], [ %cnt.1, %for.inc ]
tail call void @free(ptr noundef nonnull %call) #6
tail call void @free(ptr noundef nonnull %call16) #6
br label %cleanup
for.body: ; preds = %if.end, %for.inc
%j.095 = phi i32 [ %j.1, %for.inc ], [ 0, %if.end ]
%i.094 = phi i32 [ %i.1, %for.inc ], [ 0, %if.end ]
%it.093 = phi ptr [ %incdec.ptr, %for.inc ], [ %first, %if.end ]
%cnt.092 = phi i64 [ %cnt.1, %for.inc ], [ %add32, %if.end ]
%idxprom35 = sext i32 %i.094 to i64
%arrayidx36 = getelementptr inbounds i32, ptr %call, i64 %idxprom35
%1 = load i32, ptr %arrayidx36, align 4, !tbaa !23
%idxprom37 = sext i32 %j.095 to i64
%arrayidx38 = getelementptr inbounds i32, ptr %call16, i64 %idxprom37
%2 = load i32, ptr %arrayidx38, align 4, !tbaa !23
%cmp39.not = icmp sgt i32 %1, %2
br i1 %cmp39.not, label %if.else, label %if.then41
if.then41: ; preds = %for.body
%inc = add nsw i32 %i.094, 1
br label %for.inc
if.else: ; preds = %for.body
%inc44 = add nsw i32 %j.095, 1
%sub = sub nsw i32 %div89, %i.094
%conv48 = sext i32 %sub to i64
%add49 = add nsw i64 %cnt.092, %conv48
br label %for.inc
for.inc: ; preds = %if.then41, %if.else
%.sink = phi i32 [ %2, %if.else ], [ %1, %if.then41 ]
%cnt.1 = phi i64 [ %add49, %if.else ], [ %cnt.092, %if.then41 ]
%i.1 = phi i32 [ %i.094, %if.else ], [ %inc, %if.then41 ]
%j.1 = phi i32 [ %inc44, %if.else ], [ %j.095, %if.then41 ]
store i32 %.sink, ptr %it.093, align 4
%incdec.ptr = getelementptr inbounds i32, ptr %it.093, i64 1
%cmp33.not = icmp eq ptr %incdec.ptr, %last
br i1 %cmp33.not, label %for.cond.cleanup, label %for.body, !llvm.loop !24
cleanup: ; preds = %entry, %for.cond.cleanup
%retval.0 = phi i64 [ %cnt.0.lcssa, %for.cond.cleanup ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%buf.i = alloca [20 x i8], align 16
%a = alloca [200001 x i32], align 16
%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) #6
br label %getchar_unlocked.exit.i
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 %getchar_unlocked.exit.i
getchar_unlocked.exit.i: ; preds = %cond.false.i.i, %cond.true.i.i
%cond.i.i = phi i32 [ %call.i.i, %cond.true.i.i ], [ %conv3.i.i, %cond.false.i.i ]
%4 = add i32 %cond.i.i, -58
%or.cond.i = icmp ult i32 %4, -10
br i1 %or.cond.i, label %get_uint.exit, label %while.body.preheader.i
while.body.preheader.i: ; preds = %getchar_unlocked.exit.i
%.pre24.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body.i
while.body.i: ; preds = %getchar_unlocked.exit21.i, %while.body.preheader.i
%5 = phi ptr [ %9, %getchar_unlocked.exit21.i ], [ %.pre24.i, %while.body.preheader.i ]
%c.023.i = phi i32 [ %cond.i17.i, %getchar_unlocked.exit21.i ], [ %cond.i.i, %while.body.preheader.i ]
%n.022.i = phi i32 [ %add.i, %getchar_unlocked.exit21.i ], [ 0, %while.body.preheader.i ]
%mul.i = mul nsw i32 %n.022.i, 10
%and.i = and i32 %c.023.i, 15
%add.i = add nsw i32 %mul.i, %and.i
%_IO_read_ptr.i12.i = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 1
%6 = load ptr, ptr %_IO_read_ptr.i12.i, align 8, !tbaa !9
%_IO_read_end.i13.i = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 2
%7 = load ptr, ptr %_IO_read_end.i13.i, align 8, !tbaa !14
%cmp.not.i14.i = icmp ult ptr %6, %7
br i1 %cmp.not.i14.i, label %cond.false.i18.i, label %cond.true.i15.i, !prof !15
cond.true.i15.i: ; preds = %while.body.i
%call.i16.i = tail call i32 @__uflow(ptr noundef nonnull %5) #6
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit21.i
cond.false.i18.i: ; preds = %while.body.i
%incdec.ptr.i19.i = getelementptr inbounds i8, ptr %6, i64 1
store ptr %incdec.ptr.i19.i, ptr %_IO_read_ptr.i12.i, align 8, !tbaa !9
%8 = load i8, ptr %6, align 1, !tbaa !16
%conv3.i20.i = zext i8 %8 to i32
br label %getchar_unlocked.exit21.i
getchar_unlocked.exit21.i: ; preds = %cond.false.i18.i, %cond.true.i15.i
%9 = phi ptr [ %.pre.i, %cond.true.i15.i ], [ %5, %cond.false.i18.i ]
%cond.i17.i = phi i32 [ %call.i16.i, %cond.true.i15.i ], [ %conv3.i20.i, %cond.false.i18.i ]
%10 = add i32 %cond.i17.i, -48
%11 = icmp ult i32 %10, 10
br i1 %11, label %while.body.i, label %get_uint.exit, !llvm.loop !17
get_uint.exit: ; preds = %getchar_unlocked.exit21.i, %getchar_unlocked.exit.i
%retval.0.i = phi i32 [ %cond.i.i, %getchar_unlocked.exit.i ], [ %add.i, %getchar_unlocked.exit21.i ]
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %a) #6
%cmp46 = icmp sgt i32 %retval.0.i, 0
br i1 %cmp46, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %get_uint.exit
%wide.trip.count = zext i32 %retval.0.i to i64
%.pre49 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %for.body
for.cond.cleanup: ; preds = %get_uint.exit45, %get_uint.exit
%idx.ext = sext i32 %retval.0.i to i64
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %idx.ext
%call3 = call i64 @merge_sort(ptr noundef nonnull %a, ptr noundef nonnull %add.ptr)
%tobool.not.i = icmp eq i64 %call3, 0
br i1 %tobool.not.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %for.cond.cleanup
%12 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 5
%13 = load ptr, ptr %_IO_write_ptr.i.i, align 8, !tbaa !19
%_IO_write_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 6
%14 = load ptr, ptr %_IO_write_end.i.i, align 8, !tbaa !20
%cmp.not.i.i9 = icmp ult ptr %13, %14
br i1 %cmp.not.i.i9, label %cond.false.i.i12, label %cond.true.i.i10, !prof !15
cond.true.i.i10: ; preds = %if.then.i
%call.i.i11 = call i32 @__overflow(ptr noundef nonnull %12, i32 noundef 48) #6
br label %put_ull.exit
cond.false.i.i12: ; preds = %if.then.i
%incdec.ptr.i.i13 = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr.i.i13, ptr %_IO_write_ptr.i.i, align 8, !tbaa !19
store i8 48, ptr %13, align 1, !tbaa !16
br label %put_ull.exit
if.end.i: ; preds = %for.cond.cleanup
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %buf.i) #6
br label %while.body.i8
while.body.i8: ; preds = %while.body.i8, %if.end.i
%indvars.iv28.i = phi i32 [ 1, %if.end.i ], [ %indvars.iv.next29.i, %while.body.i8 ]
%indvars.iv.i = phi i64 [ 0, %if.end.i ], [ %indvars.iv.next.i, %while.body.i8 ]
%n.addr.024.i = phi i64 [ %call3, %if.end.i ], [ %div.i, %while.body.i8 ]
%rem.i = srem i64 %n.addr.024.i, 10
%15 = trunc i64 %rem.i to i8
%conv.i = add nsw i8 %15, 48
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds [20 x i8], ptr %buf.i, i64 0, i64 %indvars.iv.i
store i8 %conv.i, ptr %arrayidx.i, align 1, !tbaa !16
%div.i = sdiv i64 %n.addr.024.i, 10
%n.addr.024.off.i = add i64 %n.addr.024.i, 9
%tobool1.not.i = icmp ult i64 %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.i8, !llvm.loop !21
while.body4.preheader.i: ; preds = %while.body.i8
%16 = 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 [ %16, %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.i, i64 0, i64 %indvars.iv.next31.i
%17 = load i8, ptr %arrayidx6.i, align 1, !tbaa !16
%18 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i15.i = getelementptr inbounds %struct._IO_FILE, ptr %18, i64 0, i32 5
%19 = load ptr, ptr %_IO_write_ptr.i15.i, align 8, !tbaa !19
%_IO_write_end.i16.i = getelementptr inbounds %struct._IO_FILE, ptr %18, i64 0, i32 6
%20 = load ptr, ptr %_IO_write_end.i16.i, align 8, !tbaa !20
%cmp.not.i17.i = icmp ult ptr %19, %20
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 %17 to i32
%call.i19.i = call i32 @__overflow(ptr noundef nonnull %18, i32 noundef %conv7.i) #6
br label %putchar_unlocked.exit23.i
cond.false.i21.i: ; preds = %while.body4.i
%incdec.ptr.i22.i = getelementptr inbounds i8, ptr %19, i64 1
store ptr %incdec.ptr.i22.i, ptr %_IO_write_ptr.i15.i, align 8, !tbaa !19
store i8 %17, ptr %19, align 1, !tbaa !16
br label %putchar_unlocked.exit23.i
putchar_unlocked.exit23.i: ; preds = %cond.false.i21.i, %cond.true.i18.i
%21 = and i64 %indvars.iv.next31.i, 4294967295
%tobool3.not.i = icmp eq i64 %21, 0
br i1 %tobool3.not.i, label %while.end9.i, label %while.body4.i, !llvm.loop !22
while.end9.i: ; preds = %putchar_unlocked.exit23.i
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %buf.i) #6
br label %put_ull.exit
put_ull.exit: ; preds = %cond.true.i.i10, %cond.false.i.i12, %while.end9.i
%22 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 5
%23 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !19
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 6
%24 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !20
%cmp.not.i = icmp ult ptr %23, %24
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %put_ull.exit
%call.i = call i32 @__overflow(ptr noundef nonnull %22, i32 noundef 10) #6
br label %putchar_unlocked.exit
cond.false.i: ; preds = %put_ull.exit
%incdec.ptr.i = getelementptr inbounds i8, ptr %23, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !19
store i8 10, ptr %23, align 1, !tbaa !16
br label %putchar_unlocked.exit
putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %a) #6
ret i32 0
for.body: ; preds = %for.body.preheader, %get_uint.exit45
%.pre24.i2352 = phi ptr [ %.pre49, %for.body.preheader ], [ %.pre24.i2353, %get_uint.exit45 ]
%25 = phi ptr [ %.pre49, %for.body.preheader ], [ %38, %get_uint.exit45 ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %get_uint.exit45 ]
%_IO_read_ptr.i.i14 = getelementptr inbounds %struct._IO_FILE, ptr %25, i64 0, i32 1
%26 = load ptr, ptr %_IO_read_ptr.i.i14, align 8, !tbaa !9
%_IO_read_end.i.i15 = getelementptr inbounds %struct._IO_FILE, ptr %25, i64 0, i32 2
%27 = load ptr, ptr %_IO_read_end.i.i15, align 8, !tbaa !14
%cmp.not.i.i16 = icmp ult ptr %26, %27
br i1 %cmp.not.i.i16, label %cond.false.i.i42, label %cond.true.i.i17, !prof !15
cond.true.i.i17: ; preds = %for.body
%call.i.i18 = tail call i32 @__uflow(ptr noundef nonnull %25) #6
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit.i19
cond.false.i.i42: ; preds = %for.body
%incdec.ptr.i.i43 = getelementptr inbounds i8, ptr %26, i64 1
store ptr %incdec.ptr.i.i43, ptr %_IO_read_ptr.i.i14, align 8, !tbaa !9
%28 = load i8, ptr %26, align 1, !tbaa !16
%conv3.i.i44 = zext i8 %28 to i32
br label %getchar_unlocked.exit.i19
getchar_unlocked.exit.i19: ; preds = %cond.false.i.i42, %cond.true.i.i17
%.pre24.i23 = phi ptr [ %.pre, %cond.true.i.i17 ], [ %.pre24.i2352, %cond.false.i.i42 ]
%29 = phi ptr [ %.pre, %cond.true.i.i17 ], [ %25, %cond.false.i.i42 ]
%cond.i.i20 = phi i32 [ %call.i.i18, %cond.true.i.i17 ], [ %conv3.i.i44, %cond.false.i.i42 ]
%30 = add i32 %cond.i.i20, -58
%or.cond.i21 = icmp ult i32 %30, -10
br i1 %or.cond.i21, label %get_uint.exit45, label %while.body.i24
while.body.i24: ; preds = %getchar_unlocked.exit.i19, %getchar_unlocked.exit21.i36
%.pre24.i2351 = phi ptr [ %.pre24.i2350, %getchar_unlocked.exit21.i36 ], [ %.pre24.i23, %getchar_unlocked.exit.i19 ]
%31 = phi ptr [ %35, %getchar_unlocked.exit21.i36 ], [ %.pre24.i23, %getchar_unlocked.exit.i19 ]
%c.023.i25 = phi i32 [ %cond.i17.i37, %getchar_unlocked.exit21.i36 ], [ %cond.i.i20, %getchar_unlocked.exit.i19 ]
%n.022.i26 = phi i32 [ %add.i29, %getchar_unlocked.exit21.i36 ], [ 0, %getchar_unlocked.exit.i19 ]
%mul.i27 = mul nsw i32 %n.022.i26, 10
%and.i28 = and i32 %c.023.i25, 15
%add.i29 = add nsw i32 %mul.i27, %and.i28
%_IO_read_ptr.i12.i30 = getelementptr inbounds %struct._IO_FILE, ptr %31, i64 0, i32 1
%32 = load ptr, ptr %_IO_read_ptr.i12.i30, align 8, !tbaa !9
%_IO_read_end.i13.i31 = getelementptr inbounds %struct._IO_FILE, ptr %31, i64 0, i32 2
%33 = load ptr, ptr %_IO_read_end.i13.i31, align 8, !tbaa !14
%cmp.not.i14.i32 = icmp ult ptr %32, %33
br i1 %cmp.not.i14.i32, label %cond.false.i18.i39, label %cond.true.i15.i33, !prof !15
cond.true.i15.i33: ; preds = %while.body.i24
%call.i16.i34 = tail call i32 @__uflow(ptr noundef nonnull %31) #6
%.pre.i35 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit21.i36
cond.false.i18.i39: ; preds = %while.body.i24
%incdec.ptr.i19.i40 = getelementptr inbounds i8, ptr %32, i64 1
store ptr %incdec.ptr.i19.i40, ptr %_IO_read_ptr.i12.i30, align 8, !tbaa !9
%34 = load i8, ptr %32, align 1, !tbaa !16
%conv3.i20.i41 = zext i8 %34 to i32
br label %getchar_unlocked.exit21.i36
getchar_unlocked.exit21.i36: ; preds = %cond.false.i18.i39, %cond.true.i15.i33
%.pre24.i2350 = phi ptr [ %.pre.i35, %cond.true.i15.i33 ], [ %.pre24.i2351, %cond.false.i18.i39 ]
%35 = phi ptr [ %.pre.i35, %cond.true.i15.i33 ], [ %31, %cond.false.i18.i39 ]
%cond.i17.i37 = phi i32 [ %call.i16.i34, %cond.true.i15.i33 ], [ %conv3.i20.i41, %cond.false.i18.i39 ]
%36 = add i32 %cond.i17.i37, -48
%37 = icmp ult i32 %36, 10
br i1 %37, label %while.body.i24, label %get_uint.exit45, !llvm.loop !17
get_uint.exit45: ; preds = %getchar_unlocked.exit21.i36, %getchar_unlocked.exit.i19
%.pre24.i2353 = phi ptr [ %.pre24.i23, %getchar_unlocked.exit.i19 ], [ %.pre24.i2350, %getchar_unlocked.exit21.i36 ]
%38 = phi ptr [ %29, %getchar_unlocked.exit.i19 ], [ %35, %getchar_unlocked.exit21.i36 ]
%retval.0.i38 = phi i32 [ %cond.i.i20, %getchar_unlocked.exit.i19 ], [ %add.i29, %getchar_unlocked.exit21.i36 ]
%arrayidx = getelementptr inbounds [200001 x i32], ptr %a, i64 0, i64 %indvars.iv
store i32 %retval.0.i38, 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.cond.cleanup, label %for.body, !llvm.loop !25
}
declare i32 @__uflow(ptr noundef) local_unnamed_addr #5
declare i32 @__overflow(ptr noundef, i32 noundef) local_unnamed_addr #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "no-trapping-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 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !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}
|
#include <stdio.h>
long cnt=0;
void merge(int s[],int n,int left,int mid,int right){
int i,j,k;
long L[n];
long R[n];
int n1 = mid - left;
int n2 = right - mid;
for(i = 0;i<n1;i++){
L[i] = s[left + i];
}
for(i = 0;i<n2;i++){
R[i] = s[mid+i];
}
L[n1]=2000000000;
R[n2]=2000000000;
i = 0;
j = 0;
for(k = left;k<right;k++){
if(L[i]<R[j]){
s[k] = L[i++];
}
else{
cnt=cnt+(n1-i);
s[k] = R[j++];
}
}
}
void mergeSort(int s[],int n,int left,int right){
if(left+1< right){
int mid;
mid= (left + right)/2;
mergeSort(s,n,left, mid);
mergeSort(s,n,mid, right);
merge(s,n,left,mid, right);
}
}
int main(void){
int i,n;
int s[500000];
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\n",s[i]);
// }
// else{
// printf("%d ",s[i]);
// }
// }
printf("%ld\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231296/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231296/source.c"
target datalayout = "e-m:e-p270: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 i64 0, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %s, i32 noundef %n, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%0 = zext i32 %n to i64
%vla = alloca i64, i64 %0, align 16
%vla1 = alloca i64, i64 %0, align 16
%sub = sub nsw i32 %mid, %left
%sub2 = sub i32 %right, %mid
%cmp76 = icmp sgt i32 %sub, 0
br i1 %cmp76, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%1 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %s, i64 %1
%min.iters.check = icmp ult i32 %sub, 4
br i1 %min.iters.check, label %for.body.preheader117, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%2 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <2 x i32>, ptr %2, align 4, !tbaa !5
%3 = getelementptr i32, ptr %2, i64 2
%wide.load102 = load <2 x i32>, ptr %3, align 4, !tbaa !5
%4 = sext <2 x i32> %wide.load to <2 x i64>
%5 = sext <2 x i32> %wide.load102 to <2 x i64>
%6 = getelementptr inbounds i64, ptr %vla, i64 %index
store <2 x i64> %4, ptr %6, align 16, !tbaa !9
%7 = getelementptr inbounds i64, ptr %6, i64 2
store <2 x i64> %5, ptr %7, align 16, !tbaa !9
%index.next = add nuw i64 %index, 4
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !11
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.preheader117
for.body.preheader117: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond5.preheader: ; preds = %for.body, %middle.block, %entry
%cmp678 = icmp sgt i32 %sub2, 0
br i1 %cmp678, label %for.body8.preheader, label %for.end17
for.body8.preheader: ; preds = %for.cond5.preheader
%9 = sext i32 %mid to i64
%wide.trip.count93 = zext i32 %sub2 to i64
%invariant.gep100 = getelementptr i32, ptr %s, i64 %9
%min.iters.check105 = icmp ult i32 %sub2, 4
br i1 %min.iters.check105, label %for.body8.preheader116, label %vector.ph106
vector.ph106: ; preds = %for.body8.preheader
%n.vec108 = and i64 %wide.trip.count93, 4294967292
br label %vector.body111
vector.body111: ; preds = %vector.body111, %vector.ph106
%index112 = phi i64 [ 0, %vector.ph106 ], [ %index.next115, %vector.body111 ]
%10 = getelementptr i32, ptr %invariant.gep100, i64 %index112
%wide.load113 = load <2 x i32>, ptr %10, align 4, !tbaa !5
%11 = getelementptr i32, ptr %10, i64 2
%wide.load114 = load <2 x i32>, ptr %11, align 4, !tbaa !5
%12 = sext <2 x i32> %wide.load113 to <2 x i64>
%13 = sext <2 x i32> %wide.load114 to <2 x i64>
%14 = getelementptr inbounds i64, ptr %vla1, i64 %index112
store <2 x i64> %12, ptr %14, align 16, !tbaa !9
%15 = getelementptr inbounds i64, ptr %14, i64 2
store <2 x i64> %13, ptr %15, align 16, !tbaa !9
%index.next115 = add nuw i64 %index112, 4
%16 = icmp eq i64 %index.next115, %n.vec108
br i1 %16, label %middle.block103, label %vector.body111, !llvm.loop !15
middle.block103: ; preds = %vector.body111
%cmp.n110 = icmp eq i64 %n.vec108, %wide.trip.count93
br i1 %cmp.n110, label %for.end17, label %for.body8.preheader116
for.body8.preheader116: ; preds = %for.body8.preheader, %middle.block103
%indvars.iv89.ph = phi i64 [ 0, %for.body8.preheader ], [ %n.vec108, %middle.block103 ]
br label %for.body8
for.body: ; preds = %for.body.preheader117, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader117 ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%17 = load i32, ptr %gep, align 4, !tbaa !5
%conv = sext i32 %17 to i64
%arrayidx4 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
store i64 %conv, ptr %arrayidx4, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond5.preheader, label %for.body, !llvm.loop !16
for.body8: ; preds = %for.body8.preheader116, %for.body8
%indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.body8 ], [ %indvars.iv89.ph, %for.body8.preheader116 ]
%gep101 = getelementptr i32, ptr %invariant.gep100, i64 %indvars.iv89
%18 = load i32, ptr %gep101, align 4, !tbaa !5
%conv12 = sext i32 %18 to i64
%arrayidx14 = getelementptr inbounds i64, ptr %vla1, i64 %indvars.iv89
store i64 %conv12, ptr %arrayidx14, align 8, !tbaa !9
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%exitcond94.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count93
br i1 %exitcond94.not, label %for.end17, label %for.body8, !llvm.loop !17
for.end17: ; preds = %for.body8, %middle.block103, %for.cond5.preheader
%idxprom18 = sext i32 %sub to i64
%arrayidx19 = getelementptr inbounds i64, ptr %vla, i64 %idxprom18
store i64 2000000000, ptr %arrayidx19, align 8, !tbaa !9
%idxprom20 = sext i32 %sub2 to i64
%arrayidx21 = getelementptr inbounds i64, ptr %vla1, i64 %idxprom20
store i64 2000000000, ptr %arrayidx21, align 8, !tbaa !9
%cmp2382 = icmp slt i32 %left, %right
br i1 %cmp2382, label %for.body25.preheader, label %for.end49
for.body25.preheader: ; preds = %for.end17
%cnt.promoted = load i64, ptr @cnt, align 8, !tbaa !9
%19 = sext i32 %left to i64
%wide.trip.count98 = sext i32 %right to i64
br label %for.body25
for.body25: ; preds = %for.body25.preheader, %for.inc47
%indvars.iv95 = phi i64 [ %19, %for.body25.preheader ], [ %indvars.iv.next96, %for.inc47 ]
%i.286 = phi i32 [ 0, %for.body25.preheader ], [ %i.3, %for.inc47 ]
%j.085 = phi i32 [ 0, %for.body25.preheader ], [ %j.1, %for.inc47 ]
%add408183 = phi i64 [ %cnt.promoted, %for.body25.preheader ], [ %add4080, %for.inc47 ]
%idxprom26 = sext i32 %i.286 to i64
%arrayidx27 = getelementptr inbounds i64, ptr %vla, i64 %idxprom26
%20 = load i64, ptr %arrayidx27, align 8, !tbaa !9
%idxprom28 = sext i32 %j.085 to i64
%arrayidx29 = getelementptr inbounds i64, ptr %vla1, i64 %idxprom28
%21 = load i64, ptr %arrayidx29, align 8, !tbaa !9
%cmp30 = icmp slt i64 %20, %21
br i1 %cmp30, label %if.then, label %if.else
if.then: ; preds = %for.body25
%inc32 = add nsw i32 %i.286, 1
br label %for.inc47
if.else: ; preds = %for.body25
%sub38 = sub nsw i32 %sub, %i.286
%conv39 = sext i32 %sub38 to i64
%add40 = add nsw i64 %add408183, %conv39
store i64 %add40, ptr @cnt, align 8, !tbaa !9
%inc41 = add nsw i32 %j.085, 1
br label %for.inc47
for.inc47: ; preds = %if.then, %if.else
%conv44.sink.in = phi i64 [ %20, %if.then ], [ %21, %if.else ]
%add4080 = phi i64 [ %add408183, %if.then ], [ %add40, %if.else ]
%j.1 = phi i32 [ %j.085, %if.then ], [ %inc41, %if.else ]
%i.3 = phi i32 [ %inc32, %if.then ], [ %i.286, %if.else ]
%conv44.sink = trunc i64 %conv44.sink.in to i32
%22 = getelementptr inbounds i32, ptr %s, i64 %indvars.iv95
store i32 %conv44.sink, ptr %22, align 4
%indvars.iv.next96 = add nsw i64 %indvars.iv95, 1
%exitcond99.not = icmp eq i64 %indvars.iv.next96, %wide.trip.count98
br i1 %exitcond99.not, label %for.end49, label %for.body25, !llvm.loop !18
for.end49: ; preds = %for.inc47, %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 %s, i32 noundef %n, 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.ret14
common.ret14: ; 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 %s, i32 noundef %n, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %s, i32 noundef %n, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %s, i32 noundef %n, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret14
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
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
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, 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 !19
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 i64, ptr @cnt, align 8, !tbaa !9
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %3)
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: 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(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(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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !13, !14}
!16 = distinct !{!16, !12, !14, !13}
!17 = distinct !{!17, !12, !14, !13}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
|
#include<stdio.h>
#define INFTY 2000000000
#define MAX 200000
long long merge(int S[], int left, int mid, int right){
int n1 , n2;
int i , j , k;
long long c = 0;
n1 = mid - left;
n2 = right - mid;
int L[MAX/2+2] , R[MAX/2+2];
for( i = 0; i < n1; i++ ){
L[i] = S[left + i];
}
for( i = 0; i < n2; i++ ){
R[i] = S[mid + i];
}
L[n1] = R[n2] = INFTY;
i = 0;
j = 0;
for ( k = left; k < right; k++ ){
if( L[i] <= R[j] ){
S[k] = L[i];
i++;
}else{
S[k] = R[j];
j++;
c += n1 - i;
}
}
return c;
}
long long mergeSort(int S[], int left, int right){
int mid;
long long v1 , v2 , v3;
if ( left+1 < right ){
mid = (left + right)/2;
v1 = mergeSort(S, left, mid);
v2 = mergeSort(S, mid, right);
v3 = merge(S, left, mid, right);
return v1 + v2 + v3;
}else{ return 0; }
}
int main( void ){
int n;
int S[MAX];
int i;
long long ans;
scanf( "%d" , &n );
for( i = 0; i < n; i++ ){
scanf( "%d" , &S[i] );
}
ans = mergeSort(S, 0, n);
printf( "%lld\n" , ans );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231339/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231339/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i64 @merge(ptr nocapture noundef %S, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%L = alloca [100002 x i32], align 16
%R = alloca [100002 x i32], align 16
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
call void @llvm.lifetime.start.p0(i64 400008, ptr nonnull %L) #5
call void @llvm.lifetime.start.p0(i64 400008, ptr nonnull %R) #5
%cmp71 = icmp sgt i32 %sub, 0
br i1 %cmp71, 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 %S, 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
%cmp573 = icmp sgt i32 %sub1, 0
br i1 %cmp573, 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
%scevgep82 = getelementptr i8, ptr %S, 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) %scevgep82, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [100002 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 [100002 x i32], ptr %L, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2075 = icmp slt i32 %left, %right
br i1 %cmp2075, 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.inc39
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.inc39 ]
%c.079 = phi i64 [ 0, %for.body21.preheader ], [ %c.1, %for.inc39 ]
%j.077 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.inc39 ]
%i.276 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.inc39 ]
%idxprom22 = sext i32 %i.276 to i64
%arrayidx23 = getelementptr inbounds [100002 x i32], ptr %L, i64 0, i64 %idxprom22
%15 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %j.077 to i64
%arrayidx25 = getelementptr inbounds [100002 x i32], ptr %R, i64 0, i64 %idxprom24
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.not = icmp sgt i32 %15, %16
br i1 %cmp26.not, label %if.else, label %if.then
if.then: ; preds = %for.body21
%inc31 = add nsw i32 %i.276, 1
br label %for.inc39
if.else: ; preds = %for.body21
%inc36 = add nsw i32 %j.077, 1
%sub37 = sub nsw i32 %sub, %i.276
%conv = sext i32 %sub37 to i64
%add38 = add nsw i64 %c.079, %conv
br label %for.inc39
for.inc39: ; preds = %if.then, %if.else
%.sink = phi i32 [ %16, %if.else ], [ %15, %if.then ]
%i.3 = phi i32 [ %i.276, %if.else ], [ %inc31, %if.then ]
%j.1 = phi i32 [ %inc36, %if.else ], [ %j.077, %if.then ]
%c.1 = phi i64 [ %add38, %if.else ], [ %c.079, %if.then ]
%17 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv
store i32 %.sink, ptr %17, 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.body21, !llvm.loop !9
for.end41: ; preds = %for.inc39, %for.end14
%c.0.lcssa = phi i64 [ 0, %for.end14 ], [ %c.1, %for.inc39 ]
call void @llvm.lifetime.end.p0(i64 400008, ptr nonnull %R) #5
call void @llvm.lifetime.end.p0(i64 400008, ptr nonnull %L) #5
ret i64 %c.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i64 @mergeSort(ptr noundef %S, 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.ret19
common.ret19: ; preds = %entry, %if.then
%common.ret19.op = phi i64 [ %add5, %if.then ], [ 0, %entry ]
ret i64 %common.ret19.op
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
%call = tail call i64 @mergeSort(ptr noundef %S, i32 noundef %left, i32 noundef %div)
%call2 = tail call i64 @mergeSort(ptr noundef %S, i32 noundef %div, i32 noundef %right)
%call3 = tail call i64 @merge(ptr noundef %S, i32 noundef %left, i32 noundef %div, i32 noundef %right)
%add4 = add nsw i64 %call2, %call
%add5 = add nsw i64 %add4, %call3
br label %common.ret19
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%S = alloca [200000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 800000, 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
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i32], ptr %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 !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%call2 = call i64 @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %call2)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %S) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree 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(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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>
void swap(int *array, int a, int b) {
int temp = array[a];
array[a] = array[b];
array[b] = temp;
}
int partition(int *array, int left, int right, int pivot) {
int pivValue = array[pivot];
swap(array, pivot, right); //put pivot value on the end
int storePos = left;
int i=0;
for(i=left; i < right; i++)
{
if(array[i] < pivValue)
{
swap(array, i, storePos);//put smaller no on left
storePos++;
}
}
swap(array, storePos, right); //put pivot back on the correct pos
return storePos;
}
int kth(int* array, int k, int length)
{
int left = 0;if(k<0)k=0;
int right = length-1;
while(1){
// printf("amrit\n");
int pivIndex = (left+right)/2; //choose a pivot
int newPiv = partition(array, left, right, pivIndex);
if(newPiv == k)
return array[newPiv];
else if(newPiv < k) //search on the right half
{
left = newPiv+1;
}
else //search on the left half
{
right = newPiv-1;
}
}
}
int main(){
int n,m,bm,x=0,array[51];
scanf("%d %d",&n,&m);
bm=m;
while(m-->=0){
if(m==0)
scanf("%d",&array[x]);
else
scanf("%d ",&array[x]);
x++;
}
int min,min1,i=0,j,l=0,max=n-1;
min=kth(array,max,bm)-kth(array,l,bm);
for(i=0;i<bm-n;i++){
l++;
max++;
min1=kth(array,max,bm)-kth(array,l,bm);
if(min1<min)
min=min1;
}
printf("%d\n",min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23139/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23139/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %array, i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom1 = sext i32 %b to i64
%arrayidx2 = getelementptr inbounds i32, ptr %array, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
store i32 %0, ptr %arrayidx2, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @partition(ptr nocapture noundef %array, i32 noundef %left, i32 noundef %right, i32 noundef %pivot) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %pivot to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom1.i = sext i32 %right to i64
%arrayidx2.i = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i
%1 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
store i32 %0, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp27 = icmp slt i32 %left, %right
br i1 %cmp27, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = sub nsw i64 %idxprom1.i, %2
%xtraiter = and i64 %3, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader
%arrayidx2.prol = getelementptr inbounds i32, ptr %array, i64 %2
%4 = load i32, ptr %arrayidx2.prol, align 4, !tbaa !5
%cmp3.prol = icmp slt i32 %4, %0
br i1 %cmp3.prol, label %if.then.prol, label %for.inc.prol
if.then.prol: ; preds = %for.body.prol
%idxprom1.i21.prol = sext i32 %left to i64
%arrayidx2.i22.prol = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.prol
%5 = load i32, ptr %arrayidx2.i22.prol, align 4, !tbaa !5
store i32 %5, ptr %arrayidx2.prol, align 4, !tbaa !5
store i32 %4, ptr %arrayidx2.i22.prol, align 4, !tbaa !5
%inc.prol = add nsw i32 %left, 1
br label %for.inc.prol
for.inc.prol: ; preds = %if.then.prol, %for.body.prol
%storePos.1.prol = phi i32 [ %inc.prol, %if.then.prol ], [ %left, %for.body.prol ]
%indvars.iv.next.prol = add nsw i64 %2, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.inc.prol, %for.body.preheader
%storePos.1.lcssa.unr = phi i32 [ undef, %for.body.preheader ], [ %storePos.1.prol, %for.inc.prol ]
%indvars.iv.unr = phi i64 [ %2, %for.body.preheader ], [ %indvars.iv.next.prol, %for.inc.prol ]
%storePos.028.unr = phi i32 [ %left, %for.body.preheader ], [ %storePos.1.prol, %for.inc.prol ]
%6 = sub nsw i64 0, %idxprom1.i
%7 = xor i64 %2, %6
%8 = icmp eq i64 %7, -1
br i1 %8, label %for.end.loopexit, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.prol.loopexit
%invariant.gep = getelementptr i32, ptr %array, i64 1
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ %indvars.iv.unr, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%storePos.028 = phi i32 [ %storePos.028.unr, %for.body.preheader.new ], [ %storePos.1.1, %for.inc.1 ]
%arrayidx2 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%9 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp3 = icmp slt i32 %9, %0
br i1 %cmp3, label %if.then, label %for.inc
if.then: ; preds = %for.body
%idxprom1.i21 = sext i32 %storePos.028 to i64
%arrayidx2.i22 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21
%10 = load i32, ptr %arrayidx2.i22, align 4, !tbaa !5
store i32 %10, ptr %arrayidx2, align 4, !tbaa !5
store i32 %9, ptr %arrayidx2.i22, align 4, !tbaa !5
%inc = add nsw i32 %storePos.028, 1
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%storePos.1 = phi i32 [ %inc, %if.then ], [ %storePos.028, %for.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%11 = load i32, ptr %gep, align 4, !tbaa !5
%cmp3.1 = icmp slt i32 %11, %0
br i1 %cmp3.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%idxprom1.i21.1 = sext i32 %storePos.1 to i64
%arrayidx2.i22.1 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.1
%12 = load i32, ptr %arrayidx2.i22.1, align 4, !tbaa !5
store i32 %12, ptr %gep, align 4, !tbaa !5
store i32 %11, ptr %arrayidx2.i22.1, align 4, !tbaa !5
%inc.1 = add nsw i32 %storePos.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%storePos.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %storePos.1, %for.inc ]
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %idxprom1.i
br i1 %exitcond.not.1, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc.1, %for.body.prol.loopexit
%storePos.1.lcssa = phi i32 [ %storePos.1.lcssa.unr, %for.body.prol.loopexit ], [ %storePos.1.1, %for.inc.1 ]
%.pre = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%13 = phi i32 [ %0, %entry ], [ %.pre, %for.end.loopexit ]
%storePos.0.lcssa = phi i32 [ %left, %entry ], [ %storePos.1.lcssa, %for.end.loopexit ]
%idxprom.i23 = sext i32 %storePos.0.lcssa to i64
%arrayidx.i24 = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23
%14 = load i32, ptr %arrayidx.i24, align 4, !tbaa !5
store i32 %13, ptr %arrayidx.i24, align 4, !tbaa !5
store i32 %14, ptr %arrayidx2.i, align 4, !tbaa !5
ret i32 %storePos.0.lcssa
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @kth(ptr nocapture noundef %array, i32 noundef %k, i32 noundef %length) local_unnamed_addr #3 {
entry:
%spec.store.select = tail call i32 @llvm.smax.i32(i32 %k, i32 0)
%sub = add nsw i32 %length, -1
%invariant.gep = getelementptr i32, ptr %array, i64 1
br label %while.cond
while.cond: ; preds = %cleanup, %entry
%left.0 = phi i32 [ 0, %entry ], [ %left.1, %cleanup ]
%right.0 = phi i32 [ %sub, %entry ], [ %right.1, %cleanup ]
%add = add nsw i32 %right.0, %left.0
%div = sdiv i32 %add, 2
%idxprom.i = sext i32 %div to i64
%arrayidx.i = getelementptr inbounds i32, ptr %array, i64 %idxprom.i
%0 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom1.i.i = sext i32 %right.0 to i64
%arrayidx2.i.i = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i.i
%1 = load i32, ptr %arrayidx2.i.i, align 4, !tbaa !5
store i32 %1, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %0, ptr %arrayidx2.i.i, align 4, !tbaa !5
%cmp27.i = icmp slt i32 %left.0, %right.0
br i1 %cmp27.i, label %for.body.preheader.i, label %partition.exit
for.body.preheader.i: ; preds = %while.cond
%2 = sext i32 %left.0 to i64
%3 = sub nsw i64 %idxprom1.i.i, %2
%xtraiter = and i64 %3, 1
%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.preheader.i
%arrayidx2.i.prol = getelementptr inbounds i32, ptr %array, i64 %2
%4 = load i32, ptr %arrayidx2.i.prol, align 4, !tbaa !5
%cmp3.i.prol = icmp slt i32 %4, %0
br i1 %cmp3.i.prol, label %if.then.i.prol, label %for.inc.i.prol
if.then.i.prol: ; preds = %for.body.i.prol
%idxprom1.i21.i.prol = sext i32 %left.0 to i64
%arrayidx2.i22.i.prol = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.prol
%5 = load i32, ptr %arrayidx2.i22.i.prol, align 4, !tbaa !5
store i32 %5, ptr %arrayidx2.i.prol, align 4, !tbaa !5
store i32 %4, ptr %arrayidx2.i22.i.prol, align 4, !tbaa !5
%inc.i.prol = add nsw i32 %left.0, 1
br label %for.inc.i.prol
for.inc.i.prol: ; preds = %if.then.i.prol, %for.body.i.prol
%storePos.1.i.prol = phi i32 [ %inc.i.prol, %if.then.i.prol ], [ %left.0, %for.body.i.prol ]
%indvars.iv.next.i.prol = add nsw i64 %2, 1
br label %for.body.i.prol.loopexit
for.body.i.prol.loopexit: ; preds = %for.inc.i.prol, %for.body.preheader.i
%storePos.1.i.lcssa.unr = phi i32 [ undef, %for.body.preheader.i ], [ %storePos.1.i.prol, %for.inc.i.prol ]
%indvars.iv.i.unr = phi i64 [ %2, %for.body.preheader.i ], [ %indvars.iv.next.i.prol, %for.inc.i.prol ]
%storePos.028.i.unr = phi i32 [ %left.0, %for.body.preheader.i ], [ %storePos.1.i.prol, %for.inc.i.prol ]
%6 = sub nsw i64 0, %idxprom1.i.i
%7 = xor i64 %2, %6
%8 = icmp eq i64 %7, -1
br i1 %8, label %for.end.loopexit.i, label %for.body.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.inc.i.1
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.1, %for.inc.i.1 ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%storePos.028.i = phi i32 [ %storePos.1.i.1, %for.inc.i.1 ], [ %storePos.028.i.unr, %for.body.i.prol.loopexit ]
%arrayidx2.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp3.i = icmp slt i32 %9, %0
br i1 %cmp3.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body.i
%idxprom1.i21.i = sext i32 %storePos.028.i to i64
%arrayidx2.i22.i = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i
%10 = load i32, ptr %arrayidx2.i22.i, align 4, !tbaa !5
store i32 %10, ptr %arrayidx2.i, align 4, !tbaa !5
store i32 %9, ptr %arrayidx2.i22.i, align 4, !tbaa !5
%inc.i = add nsw i32 %storePos.028.i, 1
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.i
%storePos.1.i = phi i32 [ %inc.i, %if.then.i ], [ %storePos.028.i, %for.body.i ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.i
%11 = load i32, ptr %gep, align 4, !tbaa !5
%cmp3.i.1 = icmp slt i32 %11, %0
br i1 %cmp3.i.1, label %if.then.i.1, label %for.inc.i.1
if.then.i.1: ; preds = %for.inc.i
%idxprom1.i21.i.1 = sext i32 %storePos.1.i to i64
%arrayidx2.i22.i.1 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.1
%12 = load i32, ptr %arrayidx2.i22.i.1, align 4, !tbaa !5
store i32 %12, ptr %gep, align 4, !tbaa !5
store i32 %11, ptr %arrayidx2.i22.i.1, align 4, !tbaa !5
%inc.i.1 = add nsw i32 %storePos.1.i, 1
br label %for.inc.i.1
for.inc.i.1: ; preds = %if.then.i.1, %for.inc.i
%storePos.1.i.1 = phi i32 [ %inc.i.1, %if.then.i.1 ], [ %storePos.1.i, %for.inc.i ]
%indvars.iv.next.i.1 = add nsw i64 %indvars.iv.i, 2
%exitcond.not.i.1 = icmp eq i64 %indvars.iv.next.i.1, %idxprom1.i.i
br i1 %exitcond.not.i.1, label %for.end.loopexit.i, label %for.body.i, !llvm.loop !9
for.end.loopexit.i: ; preds = %for.inc.i.1, %for.body.i.prol.loopexit
%storePos.1.i.lcssa = phi i32 [ %storePos.1.i.lcssa.unr, %for.body.i.prol.loopexit ], [ %storePos.1.i.1, %for.inc.i.1 ]
%.pre.i = load i32, ptr %arrayidx2.i.i, align 4, !tbaa !5
br label %partition.exit
partition.exit: ; preds = %while.cond, %for.end.loopexit.i
%13 = phi i32 [ %0, %while.cond ], [ %.pre.i, %for.end.loopexit.i ]
%storePos.0.lcssa.i = phi i32 [ %left.0, %while.cond ], [ %storePos.1.i.lcssa, %for.end.loopexit.i ]
%idxprom.i23.i = sext i32 %storePos.0.lcssa.i to i64
%arrayidx.i24.i = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i
%14 = load i32, ptr %arrayidx.i24.i, align 4, !tbaa !5
store i32 %13, ptr %arrayidx.i24.i, align 4, !tbaa !5
store i32 %14, ptr %arrayidx2.i.i, align 4, !tbaa !5
%cmp1.not = icmp eq i32 %storePos.0.lcssa.i, %spec.store.select
br i1 %cmp1.not, label %cleanup11, label %cleanup
cleanup: ; preds = %partition.exit
%cmp3 = icmp slt i32 %storePos.0.lcssa.i, %spec.store.select
%add5 = add nsw i32 %storePos.0.lcssa.i, 1
%sub7 = add nsw i32 %storePos.0.lcssa.i, -1
%left.1 = select i1 %cmp3, i32 %add5, i32 %left.0
%right.1 = select i1 %cmp3, i32 %right.0, i32 %sub7
br label %while.cond
cleanup11: ; preds = %partition.exit
%arrayidx.i24.i.le = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i
%15 = load i32, ptr %arrayidx.i24.i.le, align 4, !tbaa !5
ret i32 %15
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%array = alloca [51 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.start.p0(i64 204, ptr nonnull %array) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%dec158 = add nsw i32 %0, -1
store i32 %dec158, ptr %m, align 4, !tbaa !5
%cmp159 = icmp sgt i32 %0, -1
br i1 %cmp159, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%dec161 = phi i32 [ %dec, %while.body ], [ %dec158, %entry ]
%cmp1 = icmp eq i32 %dec161, 0
%arrayidx = getelementptr inbounds [51 x i32], ptr %array, i64 0, i64 %indvars.iv
%.str.1..str.2 = select i1 %cmp1, ptr @.str.1, ptr @.str.2
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull %.str.1..str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%.pr = load i32, ptr %m, align 4, !tbaa !5
%dec = add nsw i32 %.pr, -1
store i32 %dec, ptr %m, align 4, !tbaa !5
%cmp = icmp sgt i32 %.pr, -1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%1 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%spec.store.select.i = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%invariant.gep = getelementptr i32, ptr %array, i64 1
br label %while.cond.i
while.cond.i: ; preds = %cleanup.i, %while.end
%left.0.i = phi i32 [ 0, %while.end ], [ %left.1.i, %cleanup.i ]
%right.0.i = phi i32 [ %dec158, %while.end ], [ %right.1.i, %cleanup.i ]
%add.i = add nsw i32 %right.0.i, %left.0.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i.i = sext i32 %div.i to i64
%arrayidx.i.i = getelementptr inbounds i32, ptr %array, i64 %idxprom.i.i
%2 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%idxprom1.i.i.i = sext i32 %right.0.i to i64
%arrayidx2.i.i.i = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i.i.i
%3 = load i32, ptr %arrayidx2.i.i.i, align 4, !tbaa !5
store i32 %3, ptr %arrayidx.i.i, align 4, !tbaa !5
store i32 %2, ptr %arrayidx2.i.i.i, align 4, !tbaa !5
%cmp27.i.i = icmp slt i32 %left.0.i, %right.0.i
br i1 %cmp27.i.i, label %for.body.preheader.i.i, label %partition.exit.i
for.body.preheader.i.i: ; preds = %while.cond.i
%4 = sext i32 %left.0.i to i64
%5 = sub nsw i64 %idxprom1.i.i.i, %4
%xtraiter = and i64 %5, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.i.prol.loopexit, label %for.body.i.i.prol
for.body.i.i.prol: ; preds = %for.body.preheader.i.i
%arrayidx2.i.i.prol = getelementptr inbounds i32, ptr %array, i64 %4
%6 = load i32, ptr %arrayidx2.i.i.prol, align 4, !tbaa !5
%cmp3.i.i.prol = icmp slt i32 %6, %2
br i1 %cmp3.i.i.prol, label %if.then.i.i.prol, label %for.inc.i.i.prol
if.then.i.i.prol: ; preds = %for.body.i.i.prol
%idxprom1.i21.i.i.prol = sext i32 %left.0.i to i64
%arrayidx2.i22.i.i.prol = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i.prol
%7 = load i32, ptr %arrayidx2.i22.i.i.prol, align 4, !tbaa !5
store i32 %7, ptr %arrayidx2.i.i.prol, align 4, !tbaa !5
store i32 %6, ptr %arrayidx2.i22.i.i.prol, align 4, !tbaa !5
%inc.i.i.prol = add nsw i32 %left.0.i, 1
br label %for.inc.i.i.prol
for.inc.i.i.prol: ; preds = %if.then.i.i.prol, %for.body.i.i.prol
%storePos.1.i.i.prol = phi i32 [ %inc.i.i.prol, %if.then.i.i.prol ], [ %left.0.i, %for.body.i.i.prol ]
%indvars.iv.next.i.i.prol = add nsw i64 %4, 1
br label %for.body.i.i.prol.loopexit
for.body.i.i.prol.loopexit: ; preds = %for.inc.i.i.prol, %for.body.preheader.i.i
%storePos.1.i.i.lcssa.unr = phi i32 [ undef, %for.body.preheader.i.i ], [ %storePos.1.i.i.prol, %for.inc.i.i.prol ]
%indvars.iv.i.i.unr = phi i64 [ %4, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i.prol, %for.inc.i.i.prol ]
%storePos.028.i.i.unr = phi i32 [ %left.0.i, %for.body.preheader.i.i ], [ %storePos.1.i.i.prol, %for.inc.i.i.prol ]
%8 = sub nsw i64 0, %idxprom1.i.i.i
%9 = xor i64 %4, %8
%10 = icmp eq i64 %9, -1
br i1 %10, label %for.end.loopexit.i.i, label %for.body.i.i
for.body.i.i: ; preds = %for.body.i.i.prol.loopexit, %for.inc.i.i.1
%indvars.iv.i.i = phi i64 [ %indvars.iv.next.i.i.1, %for.inc.i.i.1 ], [ %indvars.iv.i.i.unr, %for.body.i.i.prol.loopexit ]
%storePos.028.i.i = phi i32 [ %storePos.1.i.i.1, %for.inc.i.i.1 ], [ %storePos.028.i.i.unr, %for.body.i.i.prol.loopexit ]
%arrayidx2.i.i = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i.i
%11 = load i32, ptr %arrayidx2.i.i, align 4, !tbaa !5
%cmp3.i.i = icmp slt i32 %11, %2
br i1 %cmp3.i.i, label %if.then.i.i, label %for.inc.i.i
if.then.i.i: ; preds = %for.body.i.i
%idxprom1.i21.i.i = sext i32 %storePos.028.i.i to i64
%arrayidx2.i22.i.i = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i
%12 = load i32, ptr %arrayidx2.i22.i.i, align 4, !tbaa !5
store i32 %12, ptr %arrayidx2.i.i, align 4, !tbaa !5
store i32 %11, ptr %arrayidx2.i22.i.i, align 4, !tbaa !5
%inc.i.i = add nsw i32 %storePos.028.i.i, 1
br label %for.inc.i.i
for.inc.i.i: ; preds = %if.then.i.i, %for.body.i.i
%storePos.1.i.i = phi i32 [ %inc.i.i, %if.then.i.i ], [ %storePos.028.i.i, %for.body.i.i ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.i.i
%13 = load i32, ptr %gep, align 4, !tbaa !5
%cmp3.i.i.1 = icmp slt i32 %13, %2
br i1 %cmp3.i.i.1, label %if.then.i.i.1, label %for.inc.i.i.1
if.then.i.i.1: ; preds = %for.inc.i.i
%idxprom1.i21.i.i.1 = sext i32 %storePos.1.i.i to i64
%arrayidx2.i22.i.i.1 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i.1
%14 = load i32, ptr %arrayidx2.i22.i.i.1, align 4, !tbaa !5
store i32 %14, ptr %gep, align 4, !tbaa !5
store i32 %13, ptr %arrayidx2.i22.i.i.1, align 4, !tbaa !5
%inc.i.i.1 = add nsw i32 %storePos.1.i.i, 1
br label %for.inc.i.i.1
for.inc.i.i.1: ; preds = %if.then.i.i.1, %for.inc.i.i
%storePos.1.i.i.1 = phi i32 [ %inc.i.i.1, %if.then.i.i.1 ], [ %storePos.1.i.i, %for.inc.i.i ]
%indvars.iv.next.i.i.1 = add nsw i64 %indvars.iv.i.i, 2
%exitcond.not.i.i.1 = icmp eq i64 %indvars.iv.next.i.i.1, %idxprom1.i.i.i
br i1 %exitcond.not.i.i.1, label %for.end.loopexit.i.i, label %for.body.i.i, !llvm.loop !9
for.end.loopexit.i.i: ; preds = %for.inc.i.i.1, %for.body.i.i.prol.loopexit
%storePos.1.i.i.lcssa = phi i32 [ %storePos.1.i.i.lcssa.unr, %for.body.i.i.prol.loopexit ], [ %storePos.1.i.i.1, %for.inc.i.i.1 ]
%.pre.i.i = load i32, ptr %arrayidx2.i.i.i, align 4, !tbaa !5
br label %partition.exit.i
partition.exit.i: ; preds = %for.end.loopexit.i.i, %while.cond.i
%15 = phi i32 [ %2, %while.cond.i ], [ %.pre.i.i, %for.end.loopexit.i.i ]
%storePos.0.lcssa.i.i = phi i32 [ %left.0.i, %while.cond.i ], [ %storePos.1.i.i.lcssa, %for.end.loopexit.i.i ]
%idxprom.i23.i.i = sext i32 %storePos.0.lcssa.i.i to i64
%arrayidx.i24.i.i = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i.i
%16 = load i32, ptr %arrayidx.i24.i.i, align 4, !tbaa !5
store i32 %15, ptr %arrayidx.i24.i.i, align 4, !tbaa !5
store i32 %16, ptr %arrayidx2.i.i.i, align 4, !tbaa !5
%cmp1.not.i = icmp eq i32 %storePos.0.lcssa.i.i, %spec.store.select.i
br i1 %cmp1.not.i, label %kth.exit, label %cleanup.i
cleanup.i: ; preds = %partition.exit.i
%cmp3.i = icmp slt i32 %storePos.0.lcssa.i.i, %spec.store.select.i
%add5.i = add nsw i32 %storePos.0.lcssa.i.i, 1
%sub7.i = add nsw i32 %storePos.0.lcssa.i.i, -1
%left.1.i = select i1 %cmp3.i, i32 %add5.i, i32 %left.0.i
%right.1.i = select i1 %cmp3.i, i32 %right.0.i, i32 %sub7.i
br label %while.cond.i
kth.exit: ; preds = %partition.exit.i
%arrayidx.i24.i.i.le = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i.i
%17 = load i32, ptr %arrayidx.i24.i.i.le, align 4, !tbaa !5
%invariant.gep174 = getelementptr i32, ptr %array, i64 1
br label %while.cond.i38
while.cond.i38: ; preds = %cleanup.i53, %kth.exit
%left.0.i39 = phi i32 [ 0, %kth.exit ], [ %left.1.i57, %cleanup.i53 ]
%right.0.i40 = phi i32 [ %dec158, %kth.exit ], [ %right.1.i58, %cleanup.i53 ]
%add.i41 = add nsw i32 %right.0.i40, %left.0.i39
%div.i42 = sdiv i32 %add.i41, 2
%idxprom.i.i43 = sext i32 %div.i42 to i64
%arrayidx.i.i44 = getelementptr inbounds i32, ptr %array, i64 %idxprom.i.i43
%18 = load i32, ptr %arrayidx.i.i44, align 4, !tbaa !5
%idxprom1.i.i.i45 = sext i32 %right.0.i40 to i64
%arrayidx2.i.i.i46 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i.i.i45
%19 = load i32, ptr %arrayidx2.i.i.i46, align 4, !tbaa !5
store i32 %19, ptr %arrayidx.i.i44, align 4, !tbaa !5
store i32 %18, ptr %arrayidx2.i.i.i46, align 4, !tbaa !5
%cmp27.i.i47 = icmp slt i32 %left.0.i39, %right.0.i40
br i1 %cmp27.i.i47, label %for.body.preheader.i.i60, label %partition.exit.i48
for.body.preheader.i.i60: ; preds = %while.cond.i38
%20 = sext i32 %left.0.i39 to i64
%21 = sub nsw i64 %idxprom1.i.i.i45, %20
%xtraiter168 = and i64 %21, 1
%lcmp.mod169.not = icmp eq i64 %xtraiter168, 0
br i1 %lcmp.mod169.not, label %for.body.i.i61.prol.loopexit, label %for.body.i.i61.prol
for.body.i.i61.prol: ; preds = %for.body.preheader.i.i60
%arrayidx2.i.i64.prol = getelementptr inbounds i32, ptr %array, i64 %20
%22 = load i32, ptr %arrayidx2.i.i64.prol, align 4, !tbaa !5
%cmp3.i.i65.prol = icmp slt i32 %22, %18
br i1 %cmp3.i.i65.prol, label %if.then.i.i72.prol, label %for.inc.i.i66.prol
if.then.i.i72.prol: ; preds = %for.body.i.i61.prol
%idxprom1.i21.i.i73.prol = sext i32 %left.0.i39 to i64
%arrayidx2.i22.i.i74.prol = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i73.prol
%23 = load i32, ptr %arrayidx2.i22.i.i74.prol, align 4, !tbaa !5
store i32 %23, ptr %arrayidx2.i.i64.prol, align 4, !tbaa !5
store i32 %22, ptr %arrayidx2.i22.i.i74.prol, align 4, !tbaa !5
%inc.i.i75.prol = add nsw i32 %left.0.i39, 1
br label %for.inc.i.i66.prol
for.inc.i.i66.prol: ; preds = %if.then.i.i72.prol, %for.body.i.i61.prol
%storePos.1.i.i67.prol = phi i32 [ %inc.i.i75.prol, %if.then.i.i72.prol ], [ %left.0.i39, %for.body.i.i61.prol ]
%indvars.iv.next.i.i68.prol = add nsw i64 %20, 1
br label %for.body.i.i61.prol.loopexit
for.body.i.i61.prol.loopexit: ; preds = %for.inc.i.i66.prol, %for.body.preheader.i.i60
%storePos.1.i.i67.lcssa.unr = phi i32 [ undef, %for.body.preheader.i.i60 ], [ %storePos.1.i.i67.prol, %for.inc.i.i66.prol ]
%indvars.iv.i.i62.unr = phi i64 [ %20, %for.body.preheader.i.i60 ], [ %indvars.iv.next.i.i68.prol, %for.inc.i.i66.prol ]
%storePos.028.i.i63.unr = phi i32 [ %left.0.i39, %for.body.preheader.i.i60 ], [ %storePos.1.i.i67.prol, %for.inc.i.i66.prol ]
%24 = sub nsw i64 0, %idxprom1.i.i.i45
%25 = xor i64 %20, %24
%26 = icmp eq i64 %25, -1
br i1 %26, label %for.end.loopexit.i.i70, label %for.body.i.i61
for.body.i.i61: ; preds = %for.body.i.i61.prol.loopexit, %for.inc.i.i66.1
%indvars.iv.i.i62 = phi i64 [ %indvars.iv.next.i.i68.1, %for.inc.i.i66.1 ], [ %indvars.iv.i.i62.unr, %for.body.i.i61.prol.loopexit ]
%storePos.028.i.i63 = phi i32 [ %storePos.1.i.i67.1, %for.inc.i.i66.1 ], [ %storePos.028.i.i63.unr, %for.body.i.i61.prol.loopexit ]
%arrayidx2.i.i64 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i.i62
%27 = load i32, ptr %arrayidx2.i.i64, align 4, !tbaa !5
%cmp3.i.i65 = icmp slt i32 %27, %18
br i1 %cmp3.i.i65, label %if.then.i.i72, label %for.inc.i.i66
if.then.i.i72: ; preds = %for.body.i.i61
%idxprom1.i21.i.i73 = sext i32 %storePos.028.i.i63 to i64
%arrayidx2.i22.i.i74 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i73
%28 = load i32, ptr %arrayidx2.i22.i.i74, align 4, !tbaa !5
store i32 %28, ptr %arrayidx2.i.i64, align 4, !tbaa !5
store i32 %27, ptr %arrayidx2.i22.i.i74, align 4, !tbaa !5
%inc.i.i75 = add nsw i32 %storePos.028.i.i63, 1
br label %for.inc.i.i66
for.inc.i.i66: ; preds = %if.then.i.i72, %for.body.i.i61
%storePos.1.i.i67 = phi i32 [ %inc.i.i75, %if.then.i.i72 ], [ %storePos.028.i.i63, %for.body.i.i61 ]
%gep175 = getelementptr i32, ptr %invariant.gep174, i64 %indvars.iv.i.i62
%29 = load i32, ptr %gep175, align 4, !tbaa !5
%cmp3.i.i65.1 = icmp slt i32 %29, %18
br i1 %cmp3.i.i65.1, label %if.then.i.i72.1, label %for.inc.i.i66.1
if.then.i.i72.1: ; preds = %for.inc.i.i66
%idxprom1.i21.i.i73.1 = sext i32 %storePos.1.i.i67 to i64
%arrayidx2.i22.i.i74.1 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i73.1
%30 = load i32, ptr %arrayidx2.i22.i.i74.1, align 4, !tbaa !5
store i32 %30, ptr %gep175, align 4, !tbaa !5
store i32 %29, ptr %arrayidx2.i22.i.i74.1, align 4, !tbaa !5
%inc.i.i75.1 = add nsw i32 %storePos.1.i.i67, 1
br label %for.inc.i.i66.1
for.inc.i.i66.1: ; preds = %if.then.i.i72.1, %for.inc.i.i66
%storePos.1.i.i67.1 = phi i32 [ %inc.i.i75.1, %if.then.i.i72.1 ], [ %storePos.1.i.i67, %for.inc.i.i66 ]
%indvars.iv.next.i.i68.1 = add nsw i64 %indvars.iv.i.i62, 2
%exitcond.not.i.i69.1 = icmp eq i64 %indvars.iv.next.i.i68.1, %idxprom1.i.i.i45
br i1 %exitcond.not.i.i69.1, label %for.end.loopexit.i.i70, label %for.body.i.i61, !llvm.loop !9
for.end.loopexit.i.i70: ; preds = %for.inc.i.i66.1, %for.body.i.i61.prol.loopexit
%storePos.1.i.i67.lcssa = phi i32 [ %storePos.1.i.i67.lcssa.unr, %for.body.i.i61.prol.loopexit ], [ %storePos.1.i.i67.1, %for.inc.i.i66.1 ]
%.pre.i.i71 = load i32, ptr %arrayidx2.i.i.i46, align 4, !tbaa !5
br label %partition.exit.i48
partition.exit.i48: ; preds = %for.end.loopexit.i.i70, %while.cond.i38
%31 = phi i32 [ %18, %while.cond.i38 ], [ %.pre.i.i71, %for.end.loopexit.i.i70 ]
%storePos.0.lcssa.i.i49 = phi i32 [ %left.0.i39, %while.cond.i38 ], [ %storePos.1.i.i67.lcssa, %for.end.loopexit.i.i70 ]
%idxprom.i23.i.i50 = sext i32 %storePos.0.lcssa.i.i49 to i64
%arrayidx.i24.i.i51 = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i.i50
%32 = load i32, ptr %arrayidx.i24.i.i51, align 4, !tbaa !5
store i32 %31, ptr %arrayidx.i24.i.i51, align 4, !tbaa !5
store i32 %32, ptr %arrayidx2.i.i.i46, align 4, !tbaa !5
%cmp1.not.i52 = icmp eq i32 %storePos.0.lcssa.i.i49, 0
br i1 %cmp1.not.i52, label %kth.exit76, label %cleanup.i53
cleanup.i53: ; preds = %partition.exit.i48
%cmp3.i54 = icmp slt i32 %storePos.0.lcssa.i.i49, 0
%add5.i55 = add nsw i32 %storePos.0.lcssa.i.i49, 1
%sub7.i56 = add nsw i32 %storePos.0.lcssa.i.i49, -1
%left.1.i57 = select i1 %cmp3.i54, i32 %add5.i55, i32 %left.0.i39
%right.1.i58 = select i1 %cmp3.i54, i32 %right.0.i40, i32 %sub7.i56
br label %while.cond.i38
kth.exit76: ; preds = %partition.exit.i48
%arrayidx.i24.i.i51.le = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i.i50
%33 = load i32, ptr %arrayidx.i24.i.i51.le, align 4, !tbaa !5
%sub9 = sub nsw i32 %17, %33
%sub10 = sub nsw i32 %0, %1
%cmp11162 = icmp sgt i32 %sub10, 0
br i1 %cmp11162, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %kth.exit76
%invariant.gep176 = getelementptr i32, ptr %array, i64 1
%invariant.gep178 = getelementptr i32, ptr %array, i64 1
br label %for.body
for.body: ; preds = %for.body.preheader, %kth.exit157
%max.0166 = phi i32 [ %inc13, %kth.exit157 ], [ %sub, %for.body.preheader ]
%l.0165 = phi i32 [ %inc12, %kth.exit157 ], [ 0, %for.body.preheader ]
%min.0163 = phi i32 [ %spec.select, %kth.exit157 ], [ %sub9, %for.body.preheader ]
%inc13 = add nsw i32 %max.0166, 1
%spec.store.select.i77 = call i32 @llvm.smax.i32(i32 %inc13, i32 0)
br label %while.cond.i79
while.cond.i79: ; preds = %cleanup.i94, %for.body
%left.0.i80 = phi i32 [ 0, %for.body ], [ %left.1.i98, %cleanup.i94 ]
%right.0.i81 = phi i32 [ %dec158, %for.body ], [ %right.1.i99, %cleanup.i94 ]
%add.i82 = add nsw i32 %right.0.i81, %left.0.i80
%div.i83 = sdiv i32 %add.i82, 2
%idxprom.i.i84 = sext i32 %div.i83 to i64
%arrayidx.i.i85 = getelementptr inbounds i32, ptr %array, i64 %idxprom.i.i84
%34 = load i32, ptr %arrayidx.i.i85, align 4, !tbaa !5
%idxprom1.i.i.i86 = sext i32 %right.0.i81 to i64
%arrayidx2.i.i.i87 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i.i.i86
%35 = load i32, ptr %arrayidx2.i.i.i87, align 4, !tbaa !5
store i32 %35, ptr %arrayidx.i.i85, align 4, !tbaa !5
store i32 %34, ptr %arrayidx2.i.i.i87, align 4, !tbaa !5
%cmp27.i.i88 = icmp slt i32 %left.0.i80, %right.0.i81
br i1 %cmp27.i.i88, label %for.body.preheader.i.i101, label %partition.exit.i89
for.body.preheader.i.i101: ; preds = %while.cond.i79
%36 = sext i32 %left.0.i80 to i64
%37 = sub nsw i64 %idxprom1.i.i.i86, %36
%xtraiter170 = and i64 %37, 1
%lcmp.mod171.not = icmp eq i64 %xtraiter170, 0
br i1 %lcmp.mod171.not, label %for.body.i.i102.prol.loopexit, label %for.body.i.i102.prol
for.body.i.i102.prol: ; preds = %for.body.preheader.i.i101
%arrayidx2.i.i105.prol = getelementptr inbounds i32, ptr %array, i64 %36
%38 = load i32, ptr %arrayidx2.i.i105.prol, align 4, !tbaa !5
%cmp3.i.i106.prol = icmp slt i32 %38, %34
br i1 %cmp3.i.i106.prol, label %if.then.i.i113.prol, label %for.inc.i.i107.prol
if.then.i.i113.prol: ; preds = %for.body.i.i102.prol
%idxprom1.i21.i.i114.prol = sext i32 %left.0.i80 to i64
%arrayidx2.i22.i.i115.prol = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i114.prol
%39 = load i32, ptr %arrayidx2.i22.i.i115.prol, align 4, !tbaa !5
store i32 %39, ptr %arrayidx2.i.i105.prol, align 4, !tbaa !5
store i32 %38, ptr %arrayidx2.i22.i.i115.prol, align 4, !tbaa !5
%inc.i.i116.prol = add nsw i32 %left.0.i80, 1
br label %for.inc.i.i107.prol
for.inc.i.i107.prol: ; preds = %if.then.i.i113.prol, %for.body.i.i102.prol
%storePos.1.i.i108.prol = phi i32 [ %inc.i.i116.prol, %if.then.i.i113.prol ], [ %left.0.i80, %for.body.i.i102.prol ]
%indvars.iv.next.i.i109.prol = add nsw i64 %36, 1
br label %for.body.i.i102.prol.loopexit
for.body.i.i102.prol.loopexit: ; preds = %for.inc.i.i107.prol, %for.body.preheader.i.i101
%storePos.1.i.i108.lcssa.unr = phi i32 [ undef, %for.body.preheader.i.i101 ], [ %storePos.1.i.i108.prol, %for.inc.i.i107.prol ]
%indvars.iv.i.i103.unr = phi i64 [ %36, %for.body.preheader.i.i101 ], [ %indvars.iv.next.i.i109.prol, %for.inc.i.i107.prol ]
%storePos.028.i.i104.unr = phi i32 [ %left.0.i80, %for.body.preheader.i.i101 ], [ %storePos.1.i.i108.prol, %for.inc.i.i107.prol ]
%40 = sub nsw i64 0, %idxprom1.i.i.i86
%41 = xor i64 %36, %40
%42 = icmp eq i64 %41, -1
br i1 %42, label %for.end.loopexit.i.i111, label %for.body.i.i102
for.body.i.i102: ; preds = %for.body.i.i102.prol.loopexit, %for.inc.i.i107.1
%indvars.iv.i.i103 = phi i64 [ %indvars.iv.next.i.i109.1, %for.inc.i.i107.1 ], [ %indvars.iv.i.i103.unr, %for.body.i.i102.prol.loopexit ]
%storePos.028.i.i104 = phi i32 [ %storePos.1.i.i108.1, %for.inc.i.i107.1 ], [ %storePos.028.i.i104.unr, %for.body.i.i102.prol.loopexit ]
%arrayidx2.i.i105 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i.i103
%43 = load i32, ptr %arrayidx2.i.i105, align 4, !tbaa !5
%cmp3.i.i106 = icmp slt i32 %43, %34
br i1 %cmp3.i.i106, label %if.then.i.i113, label %for.inc.i.i107
if.then.i.i113: ; preds = %for.body.i.i102
%idxprom1.i21.i.i114 = sext i32 %storePos.028.i.i104 to i64
%arrayidx2.i22.i.i115 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i114
%44 = load i32, ptr %arrayidx2.i22.i.i115, align 4, !tbaa !5
store i32 %44, ptr %arrayidx2.i.i105, align 4, !tbaa !5
store i32 %43, ptr %arrayidx2.i22.i.i115, align 4, !tbaa !5
%inc.i.i116 = add nsw i32 %storePos.028.i.i104, 1
br label %for.inc.i.i107
for.inc.i.i107: ; preds = %if.then.i.i113, %for.body.i.i102
%storePos.1.i.i108 = phi i32 [ %inc.i.i116, %if.then.i.i113 ], [ %storePos.028.i.i104, %for.body.i.i102 ]
%gep177 = getelementptr i32, ptr %invariant.gep176, i64 %indvars.iv.i.i103
%45 = load i32, ptr %gep177, align 4, !tbaa !5
%cmp3.i.i106.1 = icmp slt i32 %45, %34
br i1 %cmp3.i.i106.1, label %if.then.i.i113.1, label %for.inc.i.i107.1
if.then.i.i113.1: ; preds = %for.inc.i.i107
%idxprom1.i21.i.i114.1 = sext i32 %storePos.1.i.i108 to i64
%arrayidx2.i22.i.i115.1 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i114.1
%46 = load i32, ptr %arrayidx2.i22.i.i115.1, align 4, !tbaa !5
store i32 %46, ptr %gep177, align 4, !tbaa !5
store i32 %45, ptr %arrayidx2.i22.i.i115.1, align 4, !tbaa !5
%inc.i.i116.1 = add nsw i32 %storePos.1.i.i108, 1
br label %for.inc.i.i107.1
for.inc.i.i107.1: ; preds = %if.then.i.i113.1, %for.inc.i.i107
%storePos.1.i.i108.1 = phi i32 [ %inc.i.i116.1, %if.then.i.i113.1 ], [ %storePos.1.i.i108, %for.inc.i.i107 ]
%indvars.iv.next.i.i109.1 = add nsw i64 %indvars.iv.i.i103, 2
%exitcond.not.i.i110.1 = icmp eq i64 %indvars.iv.next.i.i109.1, %idxprom1.i.i.i86
br i1 %exitcond.not.i.i110.1, label %for.end.loopexit.i.i111, label %for.body.i.i102, !llvm.loop !9
for.end.loopexit.i.i111: ; preds = %for.inc.i.i107.1, %for.body.i.i102.prol.loopexit
%storePos.1.i.i108.lcssa = phi i32 [ %storePos.1.i.i108.lcssa.unr, %for.body.i.i102.prol.loopexit ], [ %storePos.1.i.i108.1, %for.inc.i.i107.1 ]
%.pre.i.i112 = load i32, ptr %arrayidx2.i.i.i87, align 4, !tbaa !5
br label %partition.exit.i89
partition.exit.i89: ; preds = %for.end.loopexit.i.i111, %while.cond.i79
%47 = phi i32 [ %34, %while.cond.i79 ], [ %.pre.i.i112, %for.end.loopexit.i.i111 ]
%storePos.0.lcssa.i.i90 = phi i32 [ %left.0.i80, %while.cond.i79 ], [ %storePos.1.i.i108.lcssa, %for.end.loopexit.i.i111 ]
%idxprom.i23.i.i91 = sext i32 %storePos.0.lcssa.i.i90 to i64
%arrayidx.i24.i.i92 = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i.i91
%48 = load i32, ptr %arrayidx.i24.i.i92, align 4, !tbaa !5
store i32 %47, ptr %arrayidx.i24.i.i92, align 4, !tbaa !5
store i32 %48, ptr %arrayidx2.i.i.i87, align 4, !tbaa !5
%cmp1.not.i93 = icmp eq i32 %storePos.0.lcssa.i.i90, %spec.store.select.i77
br i1 %cmp1.not.i93, label %kth.exit117, label %cleanup.i94
cleanup.i94: ; preds = %partition.exit.i89
%cmp3.i95 = icmp slt i32 %storePos.0.lcssa.i.i90, %spec.store.select.i77
%add5.i96 = add nsw i32 %storePos.0.lcssa.i.i90, 1
%sub7.i97 = add nsw i32 %storePos.0.lcssa.i.i90, -1
%left.1.i98 = select i1 %cmp3.i95, i32 %add5.i96, i32 %left.0.i80
%right.1.i99 = select i1 %cmp3.i95, i32 %right.0.i81, i32 %sub7.i97
br label %while.cond.i79
kth.exit117: ; preds = %partition.exit.i89
%arrayidx.i24.i.i92.le = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i.i91
%inc12 = add nuw nsw i32 %l.0165, 1
%49 = load i32, ptr %arrayidx.i24.i.i92.le, align 4, !tbaa !5
br label %while.cond.i119
while.cond.i119: ; preds = %cleanup.i134, %kth.exit117
%left.0.i120 = phi i32 [ 0, %kth.exit117 ], [ %left.1.i138, %cleanup.i134 ]
%right.0.i121 = phi i32 [ %dec158, %kth.exit117 ], [ %right.1.i139, %cleanup.i134 ]
%add.i122 = add nsw i32 %right.0.i121, %left.0.i120
%div.i123 = sdiv i32 %add.i122, 2
%idxprom.i.i124 = sext i32 %div.i123 to i64
%arrayidx.i.i125 = getelementptr inbounds i32, ptr %array, i64 %idxprom.i.i124
%50 = load i32, ptr %arrayidx.i.i125, align 4, !tbaa !5
%idxprom1.i.i.i126 = sext i32 %right.0.i121 to i64
%arrayidx2.i.i.i127 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i.i.i126
%51 = load i32, ptr %arrayidx2.i.i.i127, align 4, !tbaa !5
store i32 %51, ptr %arrayidx.i.i125, align 4, !tbaa !5
store i32 %50, ptr %arrayidx2.i.i.i127, align 4, !tbaa !5
%cmp27.i.i128 = icmp slt i32 %left.0.i120, %right.0.i121
br i1 %cmp27.i.i128, label %for.body.preheader.i.i141, label %partition.exit.i129
for.body.preheader.i.i141: ; preds = %while.cond.i119
%52 = sext i32 %left.0.i120 to i64
%53 = sub nsw i64 %idxprom1.i.i.i126, %52
%xtraiter172 = and i64 %53, 1
%lcmp.mod173.not = icmp eq i64 %xtraiter172, 0
br i1 %lcmp.mod173.not, label %for.body.i.i142.prol.loopexit, label %for.body.i.i142.prol
for.body.i.i142.prol: ; preds = %for.body.preheader.i.i141
%arrayidx2.i.i145.prol = getelementptr inbounds i32, ptr %array, i64 %52
%54 = load i32, ptr %arrayidx2.i.i145.prol, align 4, !tbaa !5
%cmp3.i.i146.prol = icmp slt i32 %54, %50
br i1 %cmp3.i.i146.prol, label %if.then.i.i153.prol, label %for.inc.i.i147.prol
if.then.i.i153.prol: ; preds = %for.body.i.i142.prol
%idxprom1.i21.i.i154.prol = sext i32 %left.0.i120 to i64
%arrayidx2.i22.i.i155.prol = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i154.prol
%55 = load i32, ptr %arrayidx2.i22.i.i155.prol, align 4, !tbaa !5
store i32 %55, ptr %arrayidx2.i.i145.prol, align 4, !tbaa !5
store i32 %54, ptr %arrayidx2.i22.i.i155.prol, align 4, !tbaa !5
%inc.i.i156.prol = add nsw i32 %left.0.i120, 1
br label %for.inc.i.i147.prol
for.inc.i.i147.prol: ; preds = %if.then.i.i153.prol, %for.body.i.i142.prol
%storePos.1.i.i148.prol = phi i32 [ %inc.i.i156.prol, %if.then.i.i153.prol ], [ %left.0.i120, %for.body.i.i142.prol ]
%indvars.iv.next.i.i149.prol = add nsw i64 %52, 1
br label %for.body.i.i142.prol.loopexit
for.body.i.i142.prol.loopexit: ; preds = %for.inc.i.i147.prol, %for.body.preheader.i.i141
%storePos.1.i.i148.lcssa.unr = phi i32 [ undef, %for.body.preheader.i.i141 ], [ %storePos.1.i.i148.prol, %for.inc.i.i147.prol ]
%indvars.iv.i.i143.unr = phi i64 [ %52, %for.body.preheader.i.i141 ], [ %indvars.iv.next.i.i149.prol, %for.inc.i.i147.prol ]
%storePos.028.i.i144.unr = phi i32 [ %left.0.i120, %for.body.preheader.i.i141 ], [ %storePos.1.i.i148.prol, %for.inc.i.i147.prol ]
%56 = sub nsw i64 0, %idxprom1.i.i.i126
%57 = xor i64 %52, %56
%58 = icmp eq i64 %57, -1
br i1 %58, label %for.end.loopexit.i.i151, label %for.body.i.i142
for.body.i.i142: ; preds = %for.body.i.i142.prol.loopexit, %for.inc.i.i147.1
%indvars.iv.i.i143 = phi i64 [ %indvars.iv.next.i.i149.1, %for.inc.i.i147.1 ], [ %indvars.iv.i.i143.unr, %for.body.i.i142.prol.loopexit ]
%storePos.028.i.i144 = phi i32 [ %storePos.1.i.i148.1, %for.inc.i.i147.1 ], [ %storePos.028.i.i144.unr, %for.body.i.i142.prol.loopexit ]
%arrayidx2.i.i145 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.i.i143
%59 = load i32, ptr %arrayidx2.i.i145, align 4, !tbaa !5
%cmp3.i.i146 = icmp slt i32 %59, %50
br i1 %cmp3.i.i146, label %if.then.i.i153, label %for.inc.i.i147
if.then.i.i153: ; preds = %for.body.i.i142
%idxprom1.i21.i.i154 = sext i32 %storePos.028.i.i144 to i64
%arrayidx2.i22.i.i155 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i154
%60 = load i32, ptr %arrayidx2.i22.i.i155, align 4, !tbaa !5
store i32 %60, ptr %arrayidx2.i.i145, align 4, !tbaa !5
store i32 %59, ptr %arrayidx2.i22.i.i155, align 4, !tbaa !5
%inc.i.i156 = add nsw i32 %storePos.028.i.i144, 1
br label %for.inc.i.i147
for.inc.i.i147: ; preds = %if.then.i.i153, %for.body.i.i142
%storePos.1.i.i148 = phi i32 [ %inc.i.i156, %if.then.i.i153 ], [ %storePos.028.i.i144, %for.body.i.i142 ]
%gep179 = getelementptr i32, ptr %invariant.gep178, i64 %indvars.iv.i.i143
%61 = load i32, ptr %gep179, align 4, !tbaa !5
%cmp3.i.i146.1 = icmp slt i32 %61, %50
br i1 %cmp3.i.i146.1, label %if.then.i.i153.1, label %for.inc.i.i147.1
if.then.i.i153.1: ; preds = %for.inc.i.i147
%idxprom1.i21.i.i154.1 = sext i32 %storePos.1.i.i148 to i64
%arrayidx2.i22.i.i155.1 = getelementptr inbounds i32, ptr %array, i64 %idxprom1.i21.i.i154.1
%62 = load i32, ptr %arrayidx2.i22.i.i155.1, align 4, !tbaa !5
store i32 %62, ptr %gep179, align 4, !tbaa !5
store i32 %61, ptr %arrayidx2.i22.i.i155.1, align 4, !tbaa !5
%inc.i.i156.1 = add nsw i32 %storePos.1.i.i148, 1
br label %for.inc.i.i147.1
for.inc.i.i147.1: ; preds = %if.then.i.i153.1, %for.inc.i.i147
%storePos.1.i.i148.1 = phi i32 [ %inc.i.i156.1, %if.then.i.i153.1 ], [ %storePos.1.i.i148, %for.inc.i.i147 ]
%indvars.iv.next.i.i149.1 = add nsw i64 %indvars.iv.i.i143, 2
%exitcond.not.i.i150.1 = icmp eq i64 %indvars.iv.next.i.i149.1, %idxprom1.i.i.i126
br i1 %exitcond.not.i.i150.1, label %for.end.loopexit.i.i151, label %for.body.i.i142, !llvm.loop !9
for.end.loopexit.i.i151: ; preds = %for.inc.i.i147.1, %for.body.i.i142.prol.loopexit
%storePos.1.i.i148.lcssa = phi i32 [ %storePos.1.i.i148.lcssa.unr, %for.body.i.i142.prol.loopexit ], [ %storePos.1.i.i148.1, %for.inc.i.i147.1 ]
%.pre.i.i152 = load i32, ptr %arrayidx2.i.i.i127, align 4, !tbaa !5
br label %partition.exit.i129
partition.exit.i129: ; preds = %for.end.loopexit.i.i151, %while.cond.i119
%63 = phi i32 [ %50, %while.cond.i119 ], [ %.pre.i.i152, %for.end.loopexit.i.i151 ]
%storePos.0.lcssa.i.i130 = phi i32 [ %left.0.i120, %while.cond.i119 ], [ %storePos.1.i.i148.lcssa, %for.end.loopexit.i.i151 ]
%idxprom.i23.i.i131 = sext i32 %storePos.0.lcssa.i.i130 to i64
%arrayidx.i24.i.i132 = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i.i131
%64 = load i32, ptr %arrayidx.i24.i.i132, align 4, !tbaa !5
store i32 %63, ptr %arrayidx.i24.i.i132, align 4, !tbaa !5
store i32 %64, ptr %arrayidx2.i.i.i127, align 4, !tbaa !5
%cmp1.not.i133 = icmp eq i32 %storePos.0.lcssa.i.i130, %inc12
br i1 %cmp1.not.i133, label %kth.exit157, label %cleanup.i134
cleanup.i134: ; preds = %partition.exit.i129
%cmp3.i135.not = icmp sgt i32 %storePos.0.lcssa.i.i130, %l.0165
%add5.i136 = add nsw i32 %storePos.0.lcssa.i.i130, 1
%sub7.i137 = add nsw i32 %storePos.0.lcssa.i.i130, -1
%left.1.i138 = select i1 %cmp3.i135.not, i32 %left.0.i120, i32 %add5.i136
%right.1.i139 = select i1 %cmp3.i135.not, i32 %sub7.i137, i32 %right.0.i121
br label %while.cond.i119
kth.exit157: ; preds = %partition.exit.i129
%arrayidx.i24.i.i132.le = getelementptr inbounds i32, ptr %array, i64 %idxprom.i23.i.i131
%65 = load i32, ptr %arrayidx.i24.i.i132.le, align 4, !tbaa !5
%sub18 = sub nsw i32 %49, %65
%spec.select = call i32 @llvm.smin.i32(i32 %sub18, i32 %min.0163)
%exitcond.not = icmp eq i32 %inc12, %sub10
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %kth.exit157, %kth.exit76
%min.0.lcssa = phi i32 [ %sub9, %kth.exit76 ], [ %spec.select, %kth.exit157 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 204, ptr nonnull %array) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 <string.h>
#include <stdlib.h>
#include <math.h>
long get_long(char *line, int size) {
if(!fgets(line, size, stdin)) return 0;
long num;
sscanf(line, "%ld", &num);
return num;
}
#define BUF_SIZE 15
long get_digit(long num) {
long ans = 0;
while(num) {
ans++;
num /= 10;
}
return ans;
}
int main(void) {
char line[BUF_SIZE];
long num = get_long(line, BUF_SIZE);
int start = (int)sqrt(num+0.5);
int i;
for(i = start; i >= 1; i--) {
if(num % i == 0) {
printf("%ld\n", get_digit(num/i));
return 0;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231432/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231432/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @get_long(ptr noundef %line, i32 noundef %size) local_unnamed_addr #0 {
entry:
%num = alloca i64, align 8
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @fgets(ptr noundef %line, i32 noundef %size, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %return, label %if.end
if.end: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %num) #5
%call1 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %line, ptr noundef nonnull @.str, ptr noundef nonnull %num) #5
%1 = load i64, ptr %num, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %num) #5
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i64 [ %1, %if.end ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, 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: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; 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 @get_digit(i64 noundef %num) local_unnamed_addr #3 {
entry:
%tobool.not3 = icmp eq i64 %num, 0
br i1 %tobool.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%ans.05 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%num.addr.04 = phi i64 [ %div, %while.body ], [ %num, %entry ]
%inc = add nuw nsw i64 %ans.05, 1
%div = sdiv i64 %num.addr.04, 10
%num.addr.04.off = add i64 %num.addr.04, 9
%tobool.not = icmp ult i64 %num.addr.04.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %inc, %while.body ]
ret i64 %ans.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num.i = alloca i64, align 8
%line = alloca [15 x i8], align 1
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %line) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 15, ptr noundef %0)
%tobool.not.i = icmp eq ptr %call.i, null
br i1 %tobool.not.i, label %get_long.exit, label %if.end.i
if.end.i: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %num.i) #5
%call1.i = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str, ptr noundef nonnull %num.i) #5
%1 = load i64, ptr %num.i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %num.i) #5
br label %get_long.exit
get_long.exit: ; preds = %entry, %if.end.i
%retval.0.i = phi i64 [ %1, %if.end.i ], [ 0, %entry ]
%conv = sitofp i64 %retval.0.i to double
%add = fadd double %conv, 5.000000e-01
%call1 = call double @sqrt(double noundef %add) #5
%conv2 = fptosi double %call1 to i32
%cmp19 = icmp sgt i32 %conv2, 0
br i1 %cmp19, label %for.body, label %cleanup
for.cond: ; preds = %for.body
%dec = add nsw i32 %i.020, -1
%cmp = icmp sgt i32 %i.020, 1
br i1 %cmp, label %for.body, label %cleanup, !llvm.loop !13
for.body: ; preds = %get_long.exit, %for.cond
%i.020 = phi i32 [ %dec, %for.cond ], [ %conv2, %get_long.exit ]
%conv4 = zext i32 %i.020 to i64
%rem = srem i64 %retval.0.i, %conv4
%div = sdiv i64 %retval.0.i, %conv4
%cmp5 = icmp eq i64 %rem, 0
br i1 %cmp5, label %if.then, label %for.cond
if.then: ; preds = %for.body
%tobool.not3.i = icmp eq i64 %div, 0
br i1 %tobool.not3.i, label %get_digit.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%ans.05.i = phi i64 [ %inc.i, %while.body.i ], [ 0, %if.then ]
%num.addr.04.i = phi i64 [ %div.i, %while.body.i ], [ %div, %if.then ]
%inc.i = add nuw nsw i64 %ans.05.i, 1
%div.i = sdiv i64 %num.addr.04.i, 10
%num.addr.04.off.i = add i64 %num.addr.04.i, 9
%tobool.not.i18 = icmp ult i64 %num.addr.04.off.i, 19
br i1 %tobool.not.i18, label %get_digit.exit, label %while.body.i, !llvm.loop !11
get_digit.exit: ; preds = %while.body.i, %if.then
%ans.0.lcssa.i = phi i64 [ 0, %if.then ], [ %inc.i, %while.body.i ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa.i)
br label %cleanup
cleanup: ; preds = %for.cond, %get_long.exit, %get_digit.exit
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %line) #5
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !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"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
int main() {
long n, a, b, i, result;
scanf("%ld", &n);
result = n;
for(a = 1; a*a <= n; a++) {
if(n%a == 0) {
b = n/a;
i = 0;
while(b > 0) {
b /= 10;
i++;
}
if(i < n) {
result = i;
}
}
}
printf("%ld\n", result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231490/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231490/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not19 = icmp slt i64 %0, 1
br i1 %cmp.not19, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%result.021 = phi i64 [ %result.1, %for.inc ], [ %0, %entry ]
%a.020 = phi i64 [ %inc7, %for.inc ], [ 1, %entry ]
%rem = srem i64 %0, %a.020
%div = sdiv i64 %0, %a.020
%cmp1 = icmp eq i64 %rem, 0
br i1 %cmp1, label %if.then, label %for.inc
if.then: ; preds = %for.body
%cmp216 = icmp sgt i64 %div, 0
br i1 %cmp216, label %while.body, label %while.end
while.body: ; preds = %if.then, %while.body
%i.018 = phi i64 [ %inc, %while.body ], [ 0, %if.then ]
%b.017 = phi i64 [ %div3, %while.body ], [ %div, %if.then ]
%div3 = udiv i64 %b.017, 10
%inc = add nuw nsw i64 %i.018, 1
%cmp2.not = icmp ult i64 %b.017, 10
br i1 %cmp2.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %if.then
%i.0.lcssa = phi i64 [ 0, %if.then ], [ %inc, %while.body ]
%cmp4 = icmp slt i64 %i.0.lcssa, %0
%spec.select = select i1 %cmp4, i64 %i.0.lcssa, i64 %result.021
br label %for.inc
for.inc: ; preds = %while.end, %for.body
%result.1 = phi i64 [ %result.021, %for.body ], [ %spec.select, %while.end ]
%inc7 = add nuw nsw i64 %a.020, 1
%mul = mul nsw i64 %inc7, %inc7
%cmp.not = icmp sgt i64 %mul, %0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%result.0.lcssa = phi i64 [ %0, %entry ], [ %result.1, %for.inc ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %result.0.lcssa)
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"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
void f(int *a,int *b){
int i,j;
scanf("%d:%d-%d:%d",&i,a,&j,b);
*a+=60*i;
*b+=60*j;//printf("%d %d\n",*a,*b);
}
int main(){
int n,m,i,k,s,t,d[110][2],h[110]={};
int a[110]={};
int b[110]={};
scanf("%d",&n);
for(i=0;i<n;i++)f(&d[i][0],&d[i][1]);
scanf("%d",&m);
while(m--){
scanf("%d",&k);
while(k--){
f(&s,&t);
for(i=0;i<n;i++){
if(s<=d[i][0]&&d[i][1]<=t)a[i]++;
}
}
}
scanf("%d",&m);
while(m--){
scanf("%d",&k);
while(k--){
f(&s,&t);
for(i=0;i<n;i++){
if(s<=d[i][0]&&d[i][1]<=t)b[i]++;
}
}
}
for(i=m=0;i<n;i++)m+=a[i]<b[i]?a[i]:b[i];
printf("%d\n",m);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231555/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231555/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d:%d-%d:%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @f(ptr noundef %a, ptr noundef %b) local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
%j = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i, ptr noundef %a, ptr noundef nonnull %j, ptr noundef %b)
%0 = load i32, ptr %i, align 4, !tbaa !5
%mul = mul nsw i32 %0, 60
%1 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %1, %mul
store i32 %add, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %j, align 4, !tbaa !5
%mul1 = mul nsw i32 %2, 60
%3 = load i32, ptr %b, align 4, !tbaa !5
%add2 = add nsw i32 %3, %mul1
store i32 %add2, ptr %b, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 @main() local_unnamed_addr #0 {
entry:
%i.i104 = alloca i32, align 4
%j.i105 = alloca i32, align 4
%i.i97 = alloca i32, align 4
%j.i98 = alloca i32, align 4
%i.i = alloca i32, align 4
%j.i = alloca i32, align 4
%n = alloca i32, align 4
%m = alloca i32, align 4
%k = alloca i32, align 4
%s = alloca i32, align 4
%t = alloca i32, align 4
%d = alloca [110 x [2 x i32]], align 16
%a = alloca [110 x i32], align 16
%b = alloca [110 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 880, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %a) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) %a, i8 0, i64 440, i1 false)
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %b) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) %b, i8 0, i64 440, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp111 = icmp sgt i32 %0, 0
br i1 %cmp111, 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 [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j.i) #5
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i, ptr noundef nonnull %arrayidx, ptr noundef nonnull %j.i, ptr noundef nonnull %arrayidx4)
%1 = load i32, ptr %i.i, align 4, !tbaa !5
%mul.i = mul nsw i32 %1, 60
%2 = load i32, ptr %arrayidx, align 8, !tbaa !5
%add.i = add nsw i32 %2, %mul.i
store i32 %add.i, ptr %arrayidx, align 8, !tbaa !5
%3 = load i32, ptr %j.i, align 4, !tbaa !5
%mul1.i = mul nsw i32 %3, 60
%4 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%add2.i = add nsw i32 %4, %mul1.i
store i32 %add2.i, ptr %arrayidx4, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j.i) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i) #5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%7 = load i32, ptr %m, align 4, !tbaa !5
%dec117 = add nsw i32 %7, -1
store i32 %dec117, ptr %m, align 4, !tbaa !5
%tobool.not118 = icmp eq i32 %7, 0
br i1 %tobool.not118, label %while.end28, label %while.body
while.cond.loopexit: ; preds = %while.cond7.loopexit, %while.body
%8 = load i32, ptr %m, align 4, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %m, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %while.end28, label %while.body, !llvm.loop !11
while.body: ; preds = %for.end, %while.cond.loopexit
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%9 = load i32, ptr %k, align 4, !tbaa !5
%dec8115 = add nsw i32 %9, -1
store i32 %dec8115, ptr %k, align 4, !tbaa !5
%tobool9.not116 = icmp eq i32 %9, 0
br i1 %tobool9.not116, label %while.cond.loopexit, label %while.body10
while.cond7.loopexit.loopexit.unr-lcssa: ; preds = %for.inc25.1, %for.body13.preheader
%indvars.iv130.unr = phi i64 [ 0, %for.body13.preheader ], [ %indvars.iv.next131.1, %for.inc25.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.cond7.loopexit, label %for.body13.epil
for.body13.epil: ; preds = %while.cond7.loopexit.loopexit.unr-lcssa
%arrayidx15.epil = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv130.unr
%10 = load i32, ptr %arrayidx15.epil, align 8, !tbaa !5
%cmp17.not.epil = icmp sgt i32 %add.i101, %10
br i1 %cmp17.not.epil, label %while.cond7.loopexit, label %land.lhs.true.epil
land.lhs.true.epil: ; preds = %for.body13.epil
%arrayidx20.epil = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv130.unr, i64 1
%11 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
%cmp21.not.epil = icmp sgt i32 %11, %add2.i103
br i1 %cmp21.not.epil, label %while.cond7.loopexit, label %if.then.epil
if.then.epil: ; preds = %land.lhs.true.epil
%arrayidx23.epil = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv130.unr
%12 = load i32, ptr %arrayidx23.epil, align 4, !tbaa !5
%inc24.epil = add nsw i32 %12, 1
store i32 %inc24.epil, ptr %arrayidx23.epil, align 4, !tbaa !5
br label %while.cond7.loopexit
while.cond7.loopexit: ; preds = %while.cond7.loopexit.loopexit.unr-lcssa, %if.then.epil, %land.lhs.true.epil, %for.body13.epil, %while.body10
%13 = load i32, ptr %k, align 4, !tbaa !5
%dec8 = add nsw i32 %13, -1
store i32 %dec8, ptr %k, align 4, !tbaa !5
%tobool9.not = icmp eq i32 %13, 0
br i1 %tobool9.not, label %while.cond.loopexit, label %while.body10, !llvm.loop !12
while.body10: ; preds = %while.body, %while.cond7.loopexit
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i97) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j.i98) #5
%call.i99 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i97, ptr noundef nonnull %s, ptr noundef nonnull %j.i98, ptr noundef nonnull %t)
%14 = load i32, ptr %i.i97, align 4, !tbaa !5
%mul.i100 = mul nsw i32 %14, 60
%15 = load i32, ptr %s, align 4, !tbaa !5
%add.i101 = add nsw i32 %15, %mul.i100
store i32 %add.i101, ptr %s, align 4, !tbaa !5
%16 = load i32, ptr %j.i98, align 4, !tbaa !5
%mul1.i102 = mul nsw i32 %16, 60
%17 = load i32, ptr %t, align 4, !tbaa !5
%add2.i103 = add nsw i32 %17, %mul1.i102
store i32 %add2.i103, ptr %t, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j.i98) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i97) #5
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp12113 = icmp sgt i32 %18, 0
br i1 %cmp12113, label %for.body13.preheader, label %while.cond7.loopexit
for.body13.preheader: ; preds = %while.body10
%wide.trip.count = zext i32 %18 to i64
%xtraiter = and i64 %wide.trip.count, 1
%19 = icmp eq i32 %18, 1
br i1 %19, label %while.cond7.loopexit.loopexit.unr-lcssa, label %for.body13.preheader.new
for.body13.preheader.new: ; preds = %for.body13.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body13
for.body13: ; preds = %for.inc25.1, %for.body13.preheader.new
%indvars.iv130 = phi i64 [ 0, %for.body13.preheader.new ], [ %indvars.iv.next131.1, %for.inc25.1 ]
%niter = phi i64 [ 0, %for.body13.preheader.new ], [ %niter.next.1, %for.inc25.1 ]
%arrayidx15 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv130
%20 = load i32, ptr %arrayidx15, align 16, !tbaa !5
%cmp17.not = icmp sgt i32 %add.i101, %20
br i1 %cmp17.not, label %for.inc25, label %land.lhs.true
land.lhs.true: ; preds = %for.body13
%arrayidx20 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv130, i64 1
%21 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.not = icmp sgt i32 %21, %add2.i103
br i1 %cmp21.not, label %for.inc25, label %if.then
if.then: ; preds = %land.lhs.true
%arrayidx23 = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv130
%22 = load i32, ptr %arrayidx23, align 8, !tbaa !5
%inc24 = add nsw i32 %22, 1
store i32 %inc24, ptr %arrayidx23, align 8, !tbaa !5
br label %for.inc25
for.inc25: ; preds = %for.body13, %land.lhs.true, %if.then
%indvars.iv.next131 = or i64 %indvars.iv130, 1
%arrayidx15.1 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv.next131
%23 = load i32, ptr %arrayidx15.1, align 8, !tbaa !5
%cmp17.not.1 = icmp sgt i32 %add.i101, %23
br i1 %cmp17.not.1, label %for.inc25.1, label %land.lhs.true.1
land.lhs.true.1: ; preds = %for.inc25
%arrayidx20.1 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv.next131, i64 1
%24 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%cmp21.not.1 = icmp sgt i32 %24, %add2.i103
br i1 %cmp21.not.1, label %for.inc25.1, label %if.then.1
if.then.1: ; preds = %land.lhs.true.1
%arrayidx23.1 = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv.next131
%25 = load i32, ptr %arrayidx23.1, align 4, !tbaa !5
%inc24.1 = add nsw i32 %25, 1
store i32 %inc24.1, ptr %arrayidx23.1, align 4, !tbaa !5
br label %for.inc25.1
for.inc25.1: ; preds = %if.then.1, %land.lhs.true.1, %for.inc25
%indvars.iv.next131.1 = add nuw nsw i64 %indvars.iv130, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %while.cond7.loopexit.loopexit.unr-lcssa, label %for.body13, !llvm.loop !13
while.end28: ; preds = %while.cond.loopexit, %for.end
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%26 = load i32, ptr %m, align 4, !tbaa !5
%dec31123 = add nsw i32 %26, -1
store i32 %dec31123, ptr %m, align 4, !tbaa !5
%tobool32.not124 = icmp eq i32 %26, 0
br i1 %tobool32.not124, label %while.end60, label %while.body33
while.cond30.loopexit: ; preds = %while.cond35.loopexit, %while.body33
%27 = load i32, ptr %m, align 4, !tbaa !5
%dec31 = add nsw i32 %27, -1
store i32 %dec31, ptr %m, align 4, !tbaa !5
%tobool32.not = icmp eq i32 %27, 0
br i1 %tobool32.not, label %while.end60, label %while.body33, !llvm.loop !14
while.body33: ; preds = %while.end28, %while.cond30.loopexit
%call34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%28 = load i32, ptr %k, align 4, !tbaa !5
%dec36121 = add nsw i32 %28, -1
store i32 %dec36121, ptr %k, align 4, !tbaa !5
%tobool37.not122 = icmp eq i32 %28, 0
br i1 %tobool37.not122, label %while.cond30.loopexit, label %while.body38
while.cond35.loopexit.loopexit.unr-lcssa: ; preds = %for.inc56.1, %for.body41.preheader
%indvars.iv133.unr = phi i64 [ 0, %for.body41.preheader ], [ %indvars.iv.next134.1, %for.inc56.1 ]
%lcmp.mod151.not = icmp eq i64 %xtraiter150, 0
br i1 %lcmp.mod151.not, label %while.cond35.loopexit, label %for.body41.epil
for.body41.epil: ; preds = %while.cond35.loopexit.loopexit.unr-lcssa
%arrayidx43.epil = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv133.unr
%29 = load i32, ptr %arrayidx43.epil, align 8, !tbaa !5
%cmp45.not.epil = icmp sgt i32 %add.i108, %29
br i1 %cmp45.not.epil, label %while.cond35.loopexit, label %land.lhs.true46.epil
land.lhs.true46.epil: ; preds = %for.body41.epil
%arrayidx49.epil = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv133.unr, i64 1
%30 = load i32, ptr %arrayidx49.epil, align 4, !tbaa !5
%cmp50.not.epil = icmp sgt i32 %30, %add2.i110
br i1 %cmp50.not.epil, label %while.cond35.loopexit, label %if.then51.epil
if.then51.epil: ; preds = %land.lhs.true46.epil
%arrayidx53.epil = getelementptr inbounds [110 x i32], ptr %b, i64 0, i64 %indvars.iv133.unr
%31 = load i32, ptr %arrayidx53.epil, align 4, !tbaa !5
%inc54.epil = add nsw i32 %31, 1
store i32 %inc54.epil, ptr %arrayidx53.epil, align 4, !tbaa !5
br label %while.cond35.loopexit
while.cond35.loopexit: ; preds = %while.cond35.loopexit.loopexit.unr-lcssa, %if.then51.epil, %land.lhs.true46.epil, %for.body41.epil, %while.body38
%32 = load i32, ptr %k, align 4, !tbaa !5
%dec36 = add nsw i32 %32, -1
store i32 %dec36, ptr %k, align 4, !tbaa !5
%tobool37.not = icmp eq i32 %32, 0
br i1 %tobool37.not, label %while.cond30.loopexit, label %while.body38, !llvm.loop !15
while.body38: ; preds = %while.body33, %while.cond35.loopexit
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i104) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j.i105) #5
%call.i106 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i104, ptr noundef nonnull %s, ptr noundef nonnull %j.i105, ptr noundef nonnull %t)
%33 = load i32, ptr %i.i104, align 4, !tbaa !5
%mul.i107 = mul nsw i32 %33, 60
%34 = load i32, ptr %s, align 4, !tbaa !5
%add.i108 = add nsw i32 %34, %mul.i107
store i32 %add.i108, ptr %s, align 4, !tbaa !5
%35 = load i32, ptr %j.i105, align 4, !tbaa !5
%mul1.i109 = mul nsw i32 %35, 60
%36 = load i32, ptr %t, align 4, !tbaa !5
%add2.i110 = add nsw i32 %36, %mul1.i109
store i32 %add2.i110, ptr %t, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j.i105) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i104) #5
%37 = load i32, ptr %n, align 4, !tbaa !5
%cmp40119 = icmp sgt i32 %37, 0
br i1 %cmp40119, label %for.body41.preheader, label %while.cond35.loopexit
for.body41.preheader: ; preds = %while.body38
%wide.trip.count136 = zext i32 %37 to i64
%xtraiter150 = and i64 %wide.trip.count136, 1
%38 = icmp eq i32 %37, 1
br i1 %38, label %while.cond35.loopexit.loopexit.unr-lcssa, label %for.body41.preheader.new
for.body41.preheader.new: ; preds = %for.body41.preheader
%unroll_iter152 = and i64 %wide.trip.count136, 4294967294
br label %for.body41
for.body41: ; preds = %for.inc56.1, %for.body41.preheader.new
%indvars.iv133 = phi i64 [ 0, %for.body41.preheader.new ], [ %indvars.iv.next134.1, %for.inc56.1 ]
%niter153 = phi i64 [ 0, %for.body41.preheader.new ], [ %niter153.next.1, %for.inc56.1 ]
%arrayidx43 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv133
%39 = load i32, ptr %arrayidx43, align 16, !tbaa !5
%cmp45.not = icmp sgt i32 %add.i108, %39
br i1 %cmp45.not, label %for.inc56, label %land.lhs.true46
land.lhs.true46: ; preds = %for.body41
%arrayidx49 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv133, i64 1
%40 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%cmp50.not = icmp sgt i32 %40, %add2.i110
br i1 %cmp50.not, label %for.inc56, label %if.then51
if.then51: ; preds = %land.lhs.true46
%arrayidx53 = getelementptr inbounds [110 x i32], ptr %b, i64 0, i64 %indvars.iv133
%41 = load i32, ptr %arrayidx53, align 8, !tbaa !5
%inc54 = add nsw i32 %41, 1
store i32 %inc54, ptr %arrayidx53, align 8, !tbaa !5
br label %for.inc56
for.inc56: ; preds = %for.body41, %land.lhs.true46, %if.then51
%indvars.iv.next134 = or i64 %indvars.iv133, 1
%arrayidx43.1 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv.next134
%42 = load i32, ptr %arrayidx43.1, align 8, !tbaa !5
%cmp45.not.1 = icmp sgt i32 %add.i108, %42
br i1 %cmp45.not.1, label %for.inc56.1, label %land.lhs.true46.1
land.lhs.true46.1: ; preds = %for.inc56
%arrayidx49.1 = getelementptr inbounds [110 x [2 x i32]], ptr %d, i64 0, i64 %indvars.iv.next134, i64 1
%43 = load i32, ptr %arrayidx49.1, align 4, !tbaa !5
%cmp50.not.1 = icmp sgt i32 %43, %add2.i110
br i1 %cmp50.not.1, label %for.inc56.1, label %if.then51.1
if.then51.1: ; preds = %land.lhs.true46.1
%arrayidx53.1 = getelementptr inbounds [110 x i32], ptr %b, i64 0, i64 %indvars.iv.next134
%44 = load i32, ptr %arrayidx53.1, align 4, !tbaa !5
%inc54.1 = add nsw i32 %44, 1
store i32 %inc54.1, ptr %arrayidx53.1, align 4, !tbaa !5
br label %for.inc56.1
for.inc56.1: ; preds = %if.then51.1, %land.lhs.true46.1, %for.inc56
%indvars.iv.next134.1 = add nuw nsw i64 %indvars.iv133, 2
%niter153.next.1 = add i64 %niter153, 2
%niter153.ncmp.1 = icmp eq i64 %niter153.next.1, %unroll_iter152
br i1 %niter153.ncmp.1, label %while.cond35.loopexit.loopexit.unr-lcssa, label %for.body41, !llvm.loop !16
while.end60: ; preds = %while.cond30.loopexit, %while.end28
store i32 0, ptr %m, align 4, !tbaa !5
%45 = load i32, ptr %n, align 4, !tbaa !5
%cmp62126 = icmp sgt i32 %45, 0
br i1 %cmp62126, label %for.body63.preheader, label %for.end75
for.body63.preheader: ; preds = %while.end60
%wide.trip.count141 = zext i32 %45 to i64
%min.iters.check = icmp ult i32 %45, 8
br i1 %min.iters.check, label %for.body63.preheader147, label %vector.ph
vector.ph: ; preds = %for.body63.preheader
%n.vec = and i64 %wide.trip.count141, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %52, %vector.body ]
%vec.phi143 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %53, %vector.body ]
%46 = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %46, align 16, !tbaa !5
%47 = getelementptr inbounds i32, ptr %46, i64 4
%wide.load144 = load <4 x i32>, ptr %47, align 16, !tbaa !5
%48 = getelementptr inbounds [110 x i32], ptr %b, i64 0, i64 %index
%wide.load145 = load <4 x i32>, ptr %48, align 16, !tbaa !5
%49 = getelementptr inbounds i32, ptr %48, i64 4
%wide.load146 = load <4 x i32>, ptr %49, align 16, !tbaa !5
%50 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load145)
%51 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load144, <4 x i32> %wide.load146)
%52 = add <4 x i32> %vec.phi, %50
%53 = add <4 x i32> %vec.phi143, %51
%index.next = add nuw i64 %index, 8
%54 = icmp eq i64 %index.next, %n.vec
br i1 %54, label %middle.block, label %vector.body, !llvm.loop !17
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %53, %52
%55 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count141
br i1 %cmp.n, label %for.cond61.for.end75_crit_edge, label %for.body63.preheader147
for.body63.preheader147: ; preds = %for.body63.preheader, %middle.block
%indvars.iv138.ph = phi i64 [ 0, %for.body63.preheader ], [ %n.vec, %middle.block ]
%add125127.ph = phi i32 [ 0, %for.body63.preheader ], [ %55, %middle.block ]
br label %for.body63
for.body63: ; preds = %for.body63.preheader147, %for.body63
%indvars.iv138 = phi i64 [ %indvars.iv.next139, %for.body63 ], [ %indvars.iv138.ph, %for.body63.preheader147 ]
%add125127 = phi i32 [ %add, %for.body63 ], [ %add125127.ph, %for.body63.preheader147 ]
%arrayidx65 = getelementptr inbounds [110 x i32], ptr %a, i64 0, i64 %indvars.iv138
%56 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%arrayidx67 = getelementptr inbounds [110 x i32], ptr %b, i64 0, i64 %indvars.iv138
%57 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%. = call i32 @llvm.smin.i32(i32 %56, i32 %57)
%add = add nsw i32 %add125127, %.
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count141
br i1 %exitcond142.not, label %for.cond61.for.end75_crit_edge, label %for.body63, !llvm.loop !20
for.cond61.for.end75_crit_edge: ; preds = %for.body63, %middle.block
%add.lcssa = phi i32 [ %55, %middle.block ], [ %add, %for.body63 ]
store i32 %add.lcssa, ptr %m, align 4, !tbaa !5
br label %for.end75
for.end75: ; preds = %for.cond61.for.end75_crit_edge, %while.end60
%58 = phi i32 [ %add.lcssa, %for.cond61.for.end75_crit_edge ], [ 0, %while.end60 ]
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %58)
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 880, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !10, !19, !18}
|
#include<stdio.h>
int main(void){
int a[4] = {0};
int b[4] = {0};
int i,j,k;
int counthit = 0;
int countblow = 0;
i = 0;
while(scanf("%d",&a[i]) != EOF){
for(j = 1;j < 4;j++){
scanf("%d",&a[j]);
}
for(j = 0;j < 4;j++){
scanf("%d",&b[j]);
}
for(j = 0;j < 4;j++){
if(a[j] == b[j]){
counthit++;
}
}
printf("%d ",counthit);
for(j = 0;j < 4;j++){
for(k = 0;k < 4;k++){
if(a[j] == b[k]){
countblow++;
break;
}
}
}
printf("%d\n",countblow - counthit);
counthit = 0;
countblow = 0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231605/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231605/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [4 x i32], align 16
%b = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %a, i8 0, i64 16, i1 false)
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %b) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %b, i8 0, i64 16, i1 false)
%call72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not73 = icmp eq i32 %call72, -1
br i1 %cmp.not73, label %while.end, label %for.cond.preheader.preheader
for.cond.preheader.preheader: ; preds = %entry
%arrayidx3 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%arrayidx3.1 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%arrayidx3.2 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 3
%arrayidx9.1 = getelementptr inbounds [4 x i32], ptr %b, i64 0, i64 1
%arrayidx9.2 = getelementptr inbounds [4 x i32], ptr %b, i64 0, i64 2
%arrayidx9.3 = getelementptr inbounds [4 x i32], ptr %b, i64 0, i64 3
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.preheader, %for.cond.preheader
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3)
%call4.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.1)
%call4.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.2)
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call10.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9.1)
%call10.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9.2)
%call10.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9.3)
%0 = load <4 x i32>, ptr %a, align 16, !tbaa !5
%1 = load <4 x i32>, ptr %b, align 16, !tbaa !5
%2 = icmp eq <4 x i32> %0, %1
%3 = bitcast <4 x i1> %2 to i4
%4 = call i4 @llvm.ctpop.i4(i4 %3), !range !9
%5 = zext i4 %4 to i32
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%6 = load i32, ptr %a, align 16, !tbaa !5
%7 = load i32, ptr %arrayidx9.1, align 4
%cmp37.1 = icmp eq i32 %6, %7
%8 = load i32, ptr %arrayidx9.2, align 8
%cmp37.2 = icmp eq i32 %6, %8
%9 = load i32, ptr %arrayidx9.3, align 4
%cmp37.3 = icmp eq i32 %6, %9
%10 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx9.1, align 4
%cmp37.1.1 = icmp eq i32 %10, %11
%12 = load i32, ptr %arrayidx9.2, align 8
%cmp37.2.1 = icmp eq i32 %10, %12
%13 = load i32, ptr %arrayidx9.3, align 4
%cmp37.3.1 = icmp eq i32 %10, %13
%14 = load i32, ptr %arrayidx3.1, align 8, !tbaa !5
%15 = load i32, ptr %arrayidx9.1, align 4
%cmp37.1.2 = icmp eq i32 %14, %15
%16 = load i32, ptr %arrayidx9.2, align 8
%cmp37.2.2 = icmp eq i32 %14, %16
%17 = load i32, ptr %arrayidx9.3, align 4
%cmp37.3.2 = icmp eq i32 %14, %17
%18 = load <4 x i32>, ptr %a, align 16
%19 = load <4 x i32>, ptr %b, align 16
%20 = extractelement <4 x i32> %19, i64 0
%cmp37 = icmp eq i32 %6, %20
%or.cond = select i1 %cmp37, i1 true, i1 %cmp37.1
%or.cond85 = select i1 %or.cond, i1 true, i1 %cmp37.2
%or.cond86 = select i1 %or.cond85, i1 true, i1 %cmp37.3
%countblow.2 = zext i1 %or.cond86 to i32
%cmp37.179 = icmp eq i32 %10, %20
%or.cond87 = select i1 %cmp37.179, i1 true, i1 %cmp37.1.1
%or.cond88 = select i1 %or.cond87, i1 true, i1 %cmp37.2.1
%or.cond89 = select i1 %or.cond88, i1 true, i1 %cmp37.3.1
%inc39.1 = select i1 %or.cond86, i32 2, i32 1
%countblow.2.1 = select i1 %or.cond89, i32 %inc39.1, i32 %countblow.2
%cmp37.281 = icmp eq i32 %14, %20
%or.cond90 = select i1 %cmp37.281, i1 true, i1 %cmp37.1.2
%or.cond91 = select i1 %or.cond90, i1 true, i1 %cmp37.2.2
%or.cond92 = select i1 %or.cond91, i1 true, i1 %cmp37.3.2
%inc39.2 = zext i1 %or.cond92 to i32
%countblow.2.2 = add nuw nsw i32 %countblow.2.1, %inc39.2
%21 = shufflevector <4 x i32> %18, <4 x i32> poison, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
%22 = icmp eq <4 x i32> %21, %19
%23 = freeze <4 x i1> %22
%24 = bitcast <4 x i1> %23 to i4
%25 = icmp ne i4 %24, 0
%inc39.3 = zext i1 %25 to i32
%countblow.2.3 = add nuw nsw i32 %countblow.2.2, %inc39.3
%sub = sub nsw i32 %countblow.2.3, %5
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !10
while.end: ; preds = %for.cond.preheader, %entry
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i4 @llvm.ctpop.i4(i4) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i4 0, i4 5}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(){
int a[4],b[4],hit,blow,i,k;
while(0<=scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]) & 0<=scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3])){
hit=0;
blow=0;
for(i=0;i<=3;i++){
if(a[i]==b[i]){
++hit;
}
for(k=0;k<=3;k++){
if(a[i]==b[k]){
++blow;
}
}
}
blow=blow-hit;
printf("%d %d\n",hit,blow);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231649/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231649/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %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 [4 x i32], align 16
%b = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %b) #4
%arrayidx1 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 3
%call53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3)
%arrayidx5 = getelementptr inbounds [4 x i32], ptr %b, i64 0, i64 1
%arrayidx6 = getelementptr inbounds [4 x i32], ptr %b, i64 0, i64 2
%arrayidx7 = getelementptr inbounds [4 x i32], ptr %b, i64 0, i64 3
%call854 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7)
%0 = or i32 %call854, %call53
%and4655 = icmp sgt i32 %0, -1
br i1 %and4655, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.cond.preheader
%1 = load <4 x i32>, ptr %b, align 16, !tbaa !5
%2 = shufflevector <4 x i32> %1, <4 x i32> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
%3 = load <4 x i32>, ptr %a, align 16, !tbaa !5
%4 = shufflevector <4 x i32> %3, <4 x i32> poison, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 3, i32 3, i32 3, i32 3>
%5 = icmp eq <16 x i32> %4, %2
%6 = zext <16 x i1> %5 to <16 x i32>
%7 = extractelement <16 x i32> %6, i64 0
%8 = extractelement <16 x i32> %6, i64 5
%spec.select.1 = add nuw nsw i32 %7, %8
%9 = extractelement <16 x i32> %6, i64 10
%spec.select.2 = add nuw nsw i32 %spec.select.1, %9
%10 = bitcast <16 x i1> %5 to i16
%11 = call i16 @llvm.ctpop.i16(i16 %10), !range !9
%12 = zext i16 %11 to i32
%13 = extractelement <16 x i32> %6, i64 15
%spec.select.3 = add nuw nsw i32 %spec.select.2, %13
%sub = sub nsw i32 %12, %spec.select.3
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.3, i32 noundef %sub)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3)
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7)
%14 = or i32 %call8, %call
%and46 = icmp sgt i32 %14, -1
br i1 %and46, label %for.cond.preheader, label %while.end, !llvm.loop !10
while.end: ; preds = %for.cond.preheader, %entry
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 16, 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 i16 @llvm.ctpop.i16(i16) #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 = !{i16 0, i16 17}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main()
{
int i,n,val;
scanf("%d",&n);
char str[n];
scanf("%s",&str);
int len=strlen(str),count[3]={0};
for(i=0;i<len;i++)
{
count[str[i]-48]++;
}
int equal;
equal=n/3;
int count0,count1,count2;
count0=count[0]-equal;
count1=count[1]-equal;
count2=count[2]-equal;
if(count0<0)
{
if(count1>0 && count2>0)
{
for(i=0;i<len && count0<0;i++)
{
if(str[i]=='1' && count1>0)
{
str[i]='0';
count0++;
count1--;
}
else if(str[i]=='2' && count2>0)
{
str[i]='0';
count0++;
count2--;
}
}
}
else if(count1<=0)
{
for(i=0;i<len && count0<0;i++)
{
if(str[i]=='2' && count2>0)
{
str[i]='0';
count0++;
count2--;
}
}
}
else if(count2<=0)
{
for(i=0;i<len && count0<0;i++)
{
if(str[i]=='1' && count1>0)
{
str[i]='0';
count0++;
count1--;
}
}
}
}
if(count2<0)
{
if(count0<=0)
{
for(i=len-1;i>=0 && count2<0;i--)
{
if(str[i]=='1' && count1>0)
{
str[i]='2';
count2++;
count1--;
}
}
}
else if(count1<=0)
{
for(i=len-1;i>=0 && count2<0;i--)
{
if(str[i]=='0' && count0>0)
{
str[i]='2';
count2++;
count0--;
}
}
}
else if(count0>0 && count1>0)
{
for(i=len-1;i>=0 && count2<0;i--)
{
if(str[i]=='0' && count0>0)
{
str[i]='2';
count2++;
count0--;
}
else if(str[i]=='1' && count1>0)
{
str[i]='2';
count2++;
count1--;
}
}
}
}
if(count1<0)
{
val=0;
for(i=0;i<len && count1<0;i++)
{
if(str[i]=='2' && count2>0)
{
str[i]='1';
count1++;
count2--;
}
else if(str[i]=='0' && val<equal)
{
val++;
}
else if(val==equal && str[i]=='0')
{
str[i]='1';
count1++;
count0--;
}
}
}
printf("%s",str);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2317/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2317/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%count = alloca [3 x 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 i8, i64 %1, align 16
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %vla) #7
%conv = trunc i64 %call2 to i32
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %count) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %count, i8 0, i64 12, i1 false)
%cmp406 = icmp sgt i32 %conv, 0
br i1 %cmp406, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%xtraiter = and i64 %call2, 1
%3 = icmp eq i64 %wide.trip.count, 1
br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%4 = load i8, ptr %arrayidx, align 2, !tbaa !9
%conv4 = sext i8 %4 to i64
%sub = add nsw i64 %conv4, -48
%arrayidx6 = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 %sub
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%inc = add nsw i32 %5, 1
store i32 %inc, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.next
%6 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%conv4.1 = sext i8 %6 to i64
%sub.1 = add nsw i64 %conv4.1, -48
%arrayidx6.1 = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 %sub.1
%7 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%inc.1 = add nsw i32 %7, 1
store i32 %inc.1, ptr %arrayidx6.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.unr
%8 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
%conv4.epil = sext i8 %8 to i64
%sub.epil = add nsw i64 %conv4.epil, -48
%arrayidx6.epil = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 %sub.epil
%9 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%inc.epil = add nsw i32 %9, 1
store i32 %inc.epil, ptr %arrayidx6.epil, align 4, !tbaa !5
br label %for.end.loopexit
for.end.loopexit: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%.pre = load i32, ptr %count, align 4, !tbaa !5
%arrayidx10.phi.trans.insert = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 1
%.pre492 = load i32, ptr %arrayidx10.phi.trans.insert, align 4, !tbaa !5
%arrayidx12.phi.trans.insert = getelementptr inbounds [3 x i32], ptr %count, i64 0, i64 2
%.pre493 = load i32, ptr %arrayidx12.phi.trans.insert, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%10 = phi i32 [ %.pre493, %for.end.loopexit ], [ 0, %entry ]
%11 = phi i32 [ %.pre492, %for.end.loopexit ], [ 0, %entry ]
%12 = phi i32 [ %.pre, %for.end.loopexit ], [ 0, %entry ]
%13 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %13, 3
%sub9 = sub nsw i32 %12, %div
%sub11 = sub nsw i32 %11, %div
%sub13 = sub nsw i32 %10, %div
%cmp14 = icmp slt i32 %sub9, 0
br i1 %cmp14, label %if.then, label %if.end117
if.then: ; preds = %for.end
%cmp16 = icmp sgt i32 %sub11, 0
%cmp18 = icmp sgt i32 %sub13, 0
%or.cond = select i1 %cmp16, i1 %cmp18, i1 false
br i1 %or.cond, label %for.cond21.preheader, label %if.else56
for.cond21.preheader: ; preds = %if.then
br i1 %cmp406, label %for.body26.preheader, label %if.end287
for.body26.preheader: ; preds = %for.cond21.preheader
%sext495 = shl i64 %call2, 32
%14 = ashr exact i64 %sext495, 32
br label %for.body26
for.body26: ; preds = %for.body26.preheader, %for.inc53
%indvars.iv474 = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next475, %for.inc53 ]
%count2.0426 = phi i32 [ %sub13, %for.body26.preheader ], [ %count2.1, %for.inc53 ]
%count1.0425 = phi i32 [ %sub11, %for.body26.preheader ], [ %count1.1, %for.inc53 ]
%count0.0424 = phi i32 [ %sub9, %for.body26.preheader ], [ %count0.1, %for.inc53 ]
%arrayidx28 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv474
%15 = load i8, ptr %arrayidx28, align 1, !tbaa !9
%cmp30 = icmp eq i8 %15, 49
%cmp33 = icmp sgt i32 %count1.0425, 0
%or.cond289 = select i1 %cmp30, i1 %cmp33, i1 false
br i1 %or.cond289, label %if.then35, label %if.else
if.then35: ; preds = %for.body26
store i8 48, ptr %arrayidx28, align 1, !tbaa !9
%inc38 = add nsw i32 %count0.0424, 1
%dec = add nsw i32 %count1.0425, -1
br label %for.inc53
if.else: ; preds = %for.body26
%cmp42 = icmp eq i8 %15, 50
%cmp45 = icmp sgt i32 %count2.0426, 0
%or.cond290 = select i1 %cmp42, i1 %cmp45, i1 false
br i1 %or.cond290, label %if.then47, label %for.inc53
if.then47: ; preds = %if.else
store i8 48, ptr %arrayidx28, align 1, !tbaa !9
%inc50 = add nsw i32 %count0.0424, 1
%dec51 = add nsw i32 %count2.0426, -1
br label %for.inc53
for.inc53: ; preds = %if.then35, %if.then47, %if.else
%count0.1 = phi i32 [ %inc38, %if.then35 ], [ %inc50, %if.then47 ], [ %count0.0424, %if.else ]
%count1.1 = phi i32 [ %dec, %if.then35 ], [ %count1.0425, %if.then47 ], [ %count1.0425, %if.else ]
%count2.1 = phi i32 [ %count2.0426, %if.then35 ], [ %dec51, %if.then47 ], [ %count2.0426, %if.else ]
%indvars.iv.next475 = add nuw nsw i64 %indvars.iv474, 1
%cmp22 = icmp slt i64 %indvars.iv.next475, %14
%cmp24 = icmp slt i32 %count0.1, 0
%16 = select i1 %cmp22, i1 %cmp24, i1 false
br i1 %16, label %for.body26, label %if.end117, !llvm.loop !12
if.else56: ; preds = %if.then
%cmp57 = icmp slt i32 %sub11, 1
br i1 %cmp57, label %for.cond60.preheader, label %if.else85
for.cond60.preheader: ; preds = %if.else56
br i1 %cmp406, label %for.body67.preheader, label %if.end117
for.body67.preheader: ; preds = %for.cond60.preheader
%sext494 = shl i64 %call2, 32
%17 = ashr exact i64 %sext494, 32
br label %for.body67
for.body67: ; preds = %for.body67.preheader, %for.inc82
%indvars.iv471 = phi i64 [ 0, %for.body67.preheader ], [ %indvars.iv.next472, %for.inc82 ]
%count2.2418 = phi i32 [ %sub13, %for.body67.preheader ], [ %count2.3, %for.inc82 ]
%count0.2417 = phi i32 [ %sub9, %for.body67.preheader ], [ %count0.3, %for.inc82 ]
%arrayidx69 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv471
%18 = load i8, ptr %arrayidx69, align 1, !tbaa !9
%cmp71 = icmp eq i8 %18, 50
%cmp74 = icmp sgt i32 %count2.2418, 0
%or.cond291 = select i1 %cmp71, i1 %cmp74, i1 false
br i1 %or.cond291, label %if.then76, label %for.inc82
if.then76: ; preds = %for.body67
store i8 48, ptr %arrayidx69, align 1, !tbaa !9
%inc79 = add nsw i32 %count0.2417, 1
%dec80 = add nsw i32 %count2.2418, -1
br label %for.inc82
for.inc82: ; preds = %for.body67, %if.then76
%count0.3 = phi i32 [ %inc79, %if.then76 ], [ %count0.2417, %for.body67 ]
%count2.3 = phi i32 [ %dec80, %if.then76 ], [ %count2.2418, %for.body67 ]
%indvars.iv.next472 = add nuw nsw i64 %indvars.iv471, 1
%cmp61 = icmp slt i64 %indvars.iv.next472, %17
%cmp64 = icmp slt i32 %count0.3, 0
%19 = select i1 %cmp61, i1 %cmp64, i1 false
br i1 %19, label %for.body67, label %if.end117, !llvm.loop !13
if.else85: ; preds = %if.else56
%cmp86 = icmp slt i32 %sub13, 1
br i1 %cmp86, label %for.cond89.preheader, label %if.end287
for.cond89.preheader: ; preds = %if.else85
br i1 %cmp406, label %for.body96.preheader, label %if.end117
for.body96.preheader: ; preds = %for.cond89.preheader
%sext = shl i64 %call2, 32
%20 = ashr exact i64 %sext, 32
br label %for.body96
for.body96: ; preds = %for.body96.preheader, %for.inc111
%indvars.iv468 = phi i64 [ 0, %for.body96.preheader ], [ %indvars.iv.next469, %for.inc111 ]
%count1.2412 = phi i32 [ %sub11, %for.body96.preheader ], [ %count1.3, %for.inc111 ]
%count0.4411 = phi i32 [ %sub9, %for.body96.preheader ], [ %count0.5, %for.inc111 ]
%arrayidx98 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv468
%21 = load i8, ptr %arrayidx98, align 1, !tbaa !9
%cmp100 = icmp eq i8 %21, 49
%cmp103 = icmp sgt i32 %count1.2412, 0
%or.cond292 = select i1 %cmp100, i1 %cmp103, i1 false
br i1 %or.cond292, label %if.then105, label %for.inc111
if.then105: ; preds = %for.body96
store i8 48, ptr %arrayidx98, align 1, !tbaa !9
%inc108 = add nsw i32 %count0.4411, 1
%dec109 = add nsw i32 %count1.2412, -1
br label %for.inc111
for.inc111: ; preds = %for.body96, %if.then105
%count0.5 = phi i32 [ %inc108, %if.then105 ], [ %count0.4411, %for.body96 ]
%count1.3 = phi i32 [ %dec109, %if.then105 ], [ %count1.2412, %for.body96 ]
%indvars.iv.next469 = add nuw nsw i64 %indvars.iv468, 1
%cmp90 = icmp slt i64 %indvars.iv.next469, %20
%cmp93 = icmp slt i32 %count0.5, 0
%22 = select i1 %cmp90, i1 %cmp93, i1 false
br i1 %22, label %for.body96, label %if.end117, !llvm.loop !14
if.end117: ; preds = %for.inc111, %for.inc82, %for.inc53, %for.cond89.preheader, %for.cond60.preheader, %for.end
%count0.6 = phi i32 [ %sub9, %for.end ], [ %sub9, %for.cond60.preheader ], [ %sub9, %for.cond89.preheader ], [ %count0.1, %for.inc53 ], [ %count0.3, %for.inc82 ], [ %count0.5, %for.inc111 ]
%count1.4 = phi i32 [ %sub11, %for.end ], [ %sub11, %for.cond60.preheader ], [ %sub11, %for.cond89.preheader ], [ %count1.1, %for.inc53 ], [ %sub11, %for.inc82 ], [ %count1.3, %for.inc111 ]
%count2.4 = phi i32 [ %sub13, %for.end ], [ %sub13, %for.cond60.preheader ], [ %sub13, %for.cond89.preheader ], [ %count2.1, %for.inc53 ], [ %count2.3, %for.inc82 ], [ %sub13, %for.inc111 ]
%cmp118 = icmp slt i32 %count2.4, 0
br i1 %cmp118, label %if.then120, label %if.end231
if.then120: ; preds = %if.end117
%cmp121 = icmp slt i32 %count0.6, 1
br i1 %cmp121, label %for.cond125.preheader, label %if.else150
for.cond125.preheader: ; preds = %if.then120
br i1 %cmp406, label %for.body132.preheader, label %if.end287
for.body132.preheader: ; preds = %for.cond125.preheader
%23 = and i64 %call2, 4294967295
br label %for.body132
for.body132: ; preds = %for.body132.preheader, %for.inc147
%indvars.iv484 = phi i64 [ %23, %for.body132.preheader ], [ %indvars.iv.next485, %for.inc147 ]
%count2.5452 = phi i32 [ %count2.4, %for.body132.preheader ], [ %count2.6, %for.inc147 ]
%count1.5451 = phi i32 [ %count1.4, %for.body132.preheader ], [ %count1.6, %for.inc147 ]
%indvars.iv.next485 = add nsw i64 %indvars.iv484, -1
%idxprom133 = and i64 %indvars.iv.next485, 4294967295
%arrayidx134 = getelementptr inbounds i8, ptr %vla, i64 %idxprom133
%24 = load i8, ptr %arrayidx134, align 1, !tbaa !9
%cmp136 = icmp eq i8 %24, 49
%cmp139 = icmp sgt i32 %count1.5451, 0
%or.cond293 = select i1 %cmp136, i1 %cmp139, i1 false
br i1 %or.cond293, label %if.then141, label %for.inc147
if.then141: ; preds = %for.body132
store i8 50, ptr %arrayidx134, align 1, !tbaa !9
%inc144 = add nsw i32 %count2.5452, 1
%dec145 = add nsw i32 %count1.5451, -1
br label %for.inc147
for.inc147: ; preds = %for.body132, %if.then141
%count1.6 = phi i32 [ %dec145, %if.then141 ], [ %count1.5451, %for.body132 ]
%count2.6 = phi i32 [ %inc144, %if.then141 ], [ %count2.5452, %for.body132 ]
%cmp126 = icmp ugt i64 %indvars.iv484, 1
%cmp129 = icmp slt i32 %count2.6, 0
%25 = select i1 %cmp126, i1 %cmp129, i1 false
br i1 %25, label %for.body132, label %if.end231, !llvm.loop !15
if.else150: ; preds = %if.then120
%cmp151 = icmp slt i32 %count1.4, 1
br i1 %cmp151, label %for.cond155.preheader, label %for.cond188.preheader
for.cond188.preheader: ; preds = %if.else150
br i1 %cmp406, label %for.body195.preheader, label %if.end287
for.body195.preheader: ; preds = %for.cond188.preheader
%26 = and i64 %call2, 4294967295
br label %for.body195
for.cond155.preheader: ; preds = %if.else150
br i1 %cmp406, label %for.body162.preheader, label %if.end287
for.body162.preheader: ; preds = %for.cond155.preheader
%27 = and i64 %call2, 4294967295
br label %for.body162
for.body162: ; preds = %for.body162.preheader, %for.inc177
%indvars.iv480 = phi i64 [ %27, %for.body162.preheader ], [ %indvars.iv.next481, %for.inc177 ]
%count2.7444 = phi i32 [ %count2.4, %for.body162.preheader ], [ %count2.8, %for.inc177 ]
%count0.7443 = phi i32 [ %count0.6, %for.body162.preheader ], [ %count0.8, %for.inc177 ]
%indvars.iv.next481 = add nsw i64 %indvars.iv480, -1
%idxprom163 = and i64 %indvars.iv.next481, 4294967295
%arrayidx164 = getelementptr inbounds i8, ptr %vla, i64 %idxprom163
%28 = load i8, ptr %arrayidx164, align 1, !tbaa !9
%cmp166 = icmp eq i8 %28, 48
%cmp169 = icmp sgt i32 %count0.7443, 0
%or.cond294 = select i1 %cmp166, i1 %cmp169, i1 false
br i1 %or.cond294, label %if.then171, label %for.inc177
if.then171: ; preds = %for.body162
store i8 50, ptr %arrayidx164, align 1, !tbaa !9
%inc174 = add nsw i32 %count2.7444, 1
%dec175 = add nsw i32 %count0.7443, -1
br label %for.inc177
for.inc177: ; preds = %for.body162, %if.then171
%count0.8 = phi i32 [ %dec175, %if.then171 ], [ %count0.7443, %for.body162 ]
%count2.8 = phi i32 [ %inc174, %if.then171 ], [ %count2.7444, %for.body162 ]
%cmp156 = icmp ugt i64 %indvars.iv480, 1
%cmp159 = icmp slt i32 %count2.8, 0
%29 = select i1 %cmp156, i1 %cmp159, i1 false
br i1 %29, label %for.body162, label %if.end231, !llvm.loop !16
for.body195: ; preds = %for.body195.preheader, %for.inc225
%indvars.iv477 = phi i64 [ %26, %for.body195.preheader ], [ %indvars.iv.next478, %for.inc225 ]
%count2.9435 = phi i32 [ %count2.4, %for.body195.preheader ], [ %count2.10, %for.inc225 ]
%count1.7434 = phi i32 [ %count1.4, %for.body195.preheader ], [ %count1.8, %for.inc225 ]
%count0.9433 = phi i32 [ %count0.6, %for.body195.preheader ], [ %count0.10, %for.inc225 ]
%indvars.iv.next478 = add nsw i64 %indvars.iv477, -1
%idxprom196 = and i64 %indvars.iv.next478, 4294967295
%arrayidx197 = getelementptr inbounds i8, ptr %vla, i64 %idxprom196
%30 = load i8, ptr %arrayidx197, align 1, !tbaa !9
%cmp199 = icmp eq i8 %30, 48
%cmp202 = icmp sgt i32 %count0.9433, 0
%or.cond296 = select i1 %cmp199, i1 %cmp202, i1 false
br i1 %or.cond296, label %if.then204, label %if.else209
if.then204: ; preds = %for.body195
store i8 50, ptr %arrayidx197, align 1, !tbaa !9
%inc207 = add nsw i32 %count2.9435, 1
%dec208 = add nsw i32 %count0.9433, -1
br label %for.inc225
if.else209: ; preds = %for.body195
%cmp213 = icmp eq i8 %30, 49
%cmp216 = icmp sgt i32 %count1.7434, 0
%or.cond297 = select i1 %cmp213, i1 %cmp216, i1 false
br i1 %or.cond297, label %if.then218, label %for.inc225
if.then218: ; preds = %if.else209
store i8 50, ptr %arrayidx197, align 1, !tbaa !9
%inc221 = add nsw i32 %count2.9435, 1
%dec222 = add nsw i32 %count1.7434, -1
br label %for.inc225
for.inc225: ; preds = %if.then204, %if.then218, %if.else209
%count0.10 = phi i32 [ %dec208, %if.then204 ], [ %count0.9433, %if.then218 ], [ %count0.9433, %if.else209 ]
%count1.8 = phi i32 [ %count1.7434, %if.then204 ], [ %dec222, %if.then218 ], [ %count1.7434, %if.else209 ]
%count2.10 = phi i32 [ %inc207, %if.then204 ], [ %inc221, %if.then218 ], [ %count2.9435, %if.else209 ]
%cmp189 = icmp ugt i64 %indvars.iv477, 1
%cmp192 = icmp slt i32 %count2.10, 0
%31 = select i1 %cmp189, i1 %cmp192, i1 false
br i1 %31, label %for.body195, label %if.end231, !llvm.loop !17
if.end231: ; preds = %for.inc225, %for.inc177, %for.inc147, %if.end117
%count1.9 = phi i32 [ %count1.4, %if.end117 ], [ %count1.6, %for.inc147 ], [ %count1.4, %for.inc177 ], [ %count1.8, %for.inc225 ]
%count2.11 = phi i32 [ %count2.4, %if.end117 ], [ %count2.6, %for.inc147 ], [ %count2.8, %for.inc177 ], [ %count2.10, %for.inc225 ]
%cmp232 = icmp slt i32 %count1.9, 0
%or.cond462 = and i1 %cmp232, %cmp406
br i1 %or.cond462, label %for.body242.preheader, label %if.end287
for.body242.preheader: ; preds = %if.end231
%sext496 = shl i64 %call2, 32
%32 = ashr exact i64 %sext496, 32
br label %for.body242
for.body242: ; preds = %for.body242.preheader, %for.inc284
%indvars.iv488 = phi i64 [ 0, %for.body242.preheader ], [ %indvars.iv.next489, %for.inc284 ]
%count2.12461 = phi i32 [ %count2.11, %for.body242.preheader ], [ %count2.13, %for.inc284 ]
%count1.10460 = phi i32 [ %count1.9, %for.body242.preheader ], [ %count1.11, %for.inc284 ]
%val.0457 = phi i32 [ 0, %for.body242.preheader ], [ %val.1, %for.inc284 ]
%arrayidx244 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv488
%33 = load i8, ptr %arrayidx244, align 1, !tbaa !9
%cmp246 = icmp eq i8 %33, 50
%cmp249 = icmp sgt i32 %count2.12461, 0
%or.cond298 = select i1 %cmp246, i1 %cmp249, i1 false
br i1 %or.cond298, label %if.then251, label %if.else256
if.then251: ; preds = %for.body242
store i8 49, ptr %arrayidx244, align 1, !tbaa !9
%inc254 = add nsw i32 %count1.10460, 1
%dec255 = add nsw i32 %count2.12461, -1
br label %for.inc284
if.else256: ; preds = %for.body242
%cmp260 = icmp eq i8 %33, 48
%cmp263 = icmp slt i32 %val.0457, %div
%or.cond393 = select i1 %cmp260, i1 %cmp263, i1 false
br i1 %or.cond393, label %if.then265, label %if.else267
if.then265: ; preds = %if.else256
%inc266 = add nsw i32 %val.0457, 1
br label %for.inc284
if.else267: ; preds = %if.else256
%cmp268 = icmp eq i32 %val.0457, %div
%brmerge.not = and i1 %cmp268, %cmp260
br i1 %brmerge.not, label %if.then276, label %for.inc284
if.then276: ; preds = %if.else267
store i8 49, ptr %arrayidx244, align 1, !tbaa !9
%inc279 = add nsw i32 %count1.10460, 1
br label %for.inc284
for.inc284: ; preds = %if.else267, %if.then251, %if.then276, %if.then265
%val.1 = phi i32 [ %val.0457, %if.then251 ], [ %inc266, %if.then265 ], [ %div, %if.then276 ], [ %val.0457, %if.else267 ]
%count1.11 = phi i32 [ %inc254, %if.then251 ], [ %count1.10460, %if.then265 ], [ %inc279, %if.then276 ], [ %count1.10460, %if.else267 ]
%count2.13 = phi i32 [ %dec255, %if.then251 ], [ %count2.12461, %if.then265 ], [ %count2.12461, %if.then276 ], [ %count2.12461, %if.else267 ]
%indvars.iv.next489 = add nuw nsw i64 %indvars.iv488, 1
%cmp236 = icmp slt i64 %indvars.iv.next489, %32
%cmp239 = icmp slt i32 %count1.11, 0
%34 = select i1 %cmp236, i1 %cmp239, i1 false
br i1 %34, label %for.body242, label %if.end287, !llvm.loop !18
if.end287: ; preds = %for.inc284, %for.cond21.preheader, %for.cond125.preheader, %for.cond155.preheader, %for.cond188.preheader, %if.else85, %if.end231
%call288 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %vla)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %count) #6
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
|
#include <stdio.h>
int main(){
int a1,a2,a3,a4;
int b1,b2,b3,b4;
int i;
int hit,blow;
while(scanf("%d %d %d %d ",&a1,&a2,&a3,&a4)!=EOF){
scanf("%d %d %d %d ",&b1,&b2,&b3,&b4);
hit=0;blow=0;
if(a1==b1)hit++;
if(a2==b2)hit++;
if(a3==b3)hit++;
if(a4==b4)hit++;
if(a1==b2)blow++;
if(a1==b3)blow++;
if(a1==b4)blow++;
if(a2==b1)blow++;
if(a2==b3)blow++;
if(a2==b4)blow++;
if(a3==b1)blow++;
if(a3==b2)blow++;
if(a3==b4)blow++;
if(a4==b1)blow++;
if(a4==b2)blow++;
if(a4==b3)blow++;
printf("%d %d\n",hit,blow);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231757/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231757/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%d %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:
%a1 = alloca i32, align 4
%a2 = alloca i32, align 4
%a3 = alloca i32, align 4
%a4 = alloca i32, align 4
%b1 = alloca i32, align 4
%b2 = alloca i32, align 4
%b3 = alloca i32, align 4
%b4 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a3) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a4) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b3) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b4) #3
%call80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a1, ptr noundef nonnull %a2, ptr noundef nonnull %a3, ptr noundef nonnull %a4)
%cmp.not81 = icmp eq i32 %call80, -1
br i1 %cmp.not81, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b1, ptr noundef nonnull %b2, ptr noundef nonnull %b3, ptr noundef nonnull %b4)
%0 = load i32, ptr %a1, align 4, !tbaa !5
%1 = load i32, ptr %b1, align 4, !tbaa !5
%cmp2 = icmp eq i32 %0, %1
%spec.select = zext i1 %cmp2 to i32
%2 = load i32, ptr %a2, align 4, !tbaa !5
%3 = load i32, ptr %b2, align 4, !tbaa !5
%cmp3 = icmp eq i32 %2, %3
%inc5 = select i1 %cmp2, i32 2, i32 1
%hit.1 = select i1 %cmp3, i32 %inc5, i32 %spec.select
%4 = load i32, ptr %a3, align 4, !tbaa !5
%5 = load i32, ptr %b3, align 4, !tbaa !5
%cmp7 = icmp eq i32 %4, %5
%inc9 = zext i1 %cmp7 to i32
%hit.2 = add nuw nsw i32 %hit.1, %inc9
%6 = load i32, ptr %a4, align 4, !tbaa !5
%7 = load i32, ptr %b4, align 4, !tbaa !5
%cmp11 = icmp eq i32 %6, %7
%inc13 = zext i1 %cmp11 to i32
%hit.3 = add nuw nsw i32 %hit.2, %inc13
%cmp15 = icmp eq i32 %0, %3
%blow.0 = zext i1 %cmp15 to i32
%cmp19 = icmp eq i32 %0, %5
%inc21 = select i1 %cmp15, i32 2, i32 1
%blow.1 = select i1 %cmp19, i32 %inc21, i32 %blow.0
%cmp23 = icmp eq i32 %0, %7
%inc25 = zext i1 %cmp23 to i32
%cmp27 = icmp eq i32 %2, %1
%inc29 = zext i1 %cmp27 to i32
%cmp31 = icmp eq i32 %2, %5
%inc33 = zext i1 %cmp31 to i32
%cmp35 = icmp eq i32 %2, %7
%inc37 = zext i1 %cmp35 to i32
%cmp39 = icmp eq i32 %4, %1
%inc41 = zext i1 %cmp39 to i32
%cmp43 = icmp eq i32 %4, %3
%inc45 = zext i1 %cmp43 to i32
%cmp47 = icmp eq i32 %4, %7
%inc49 = zext i1 %cmp47 to i32
%cmp51 = icmp eq i32 %6, %1
%inc53 = zext i1 %cmp51 to i32
%cmp55 = icmp eq i32 %6, %3
%inc57 = zext i1 %cmp55 to i32
%cmp59 = icmp eq i32 %6, %5
%inc61 = zext i1 %cmp59 to i32
%blow.2 = add nuw nsw i32 %inc41, %inc29
%blow.3 = add nuw nsw i32 %blow.2, %inc45
%blow.4 = add nuw nsw i32 %blow.3, %blow.1
%blow.5 = add nuw nsw i32 %blow.4, %inc33
%blow.6 = add nuw nsw i32 %blow.5, %inc53
%blow.7 = add nuw nsw i32 %blow.6, %inc57
%blow.8 = add nuw nsw i32 %blow.7, %inc61
%blow.9 = add nuw nsw i32 %blow.8, %inc25
%blow.10 = add nuw nsw i32 %blow.9, %inc37
%blow.11 = add nuw nsw i32 %blow.10, %inc49
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %hit.3, i32 noundef %blow.11)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a1, ptr noundef nonnull %a2, ptr noundef nonnull %a3, ptr noundef nonnull %a4)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b4) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b3) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a4) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a3) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a1) #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 gcd(int a, int b){
if(a>b) return gcd(b,a);
if(!a) return b;
return gcd(b%a,a);
}
int main(){
int x,y,a,b,lcm;
scanf("%d %d %d %d",&x,&y,&a,&b);
lcm = x*y/gcd(x,y);
int ans = b/lcm - a/lcm;
if(a%lcm==0) ans++;
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23180/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23180/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%a.tr = phi i32 [ %a, %entry ], [ %a.tr.be, %tailrecurse.backedge ]
%b.tr = phi i32 [ %b, %entry ], [ %a.tr, %tailrecurse.backedge ]
%cmp = icmp sgt i32 %a.tr, %b.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.end
if.end: ; preds = %tailrecurse
%tobool.not = icmp eq i32 %a.tr, 0
br i1 %tobool.not, label %return, label %if.end2
if.end2: ; preds = %if.end
%rem = srem i32 %b.tr, %a.tr
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.end2, %tailrecurse
%a.tr.be = phi i32 [ %rem, %if.end2 ], [ %b.tr, %tailrecurse ]
br label %tailrecurse
return: ; preds = %if.end
ret i32 %b.tr
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i.backedge, %entry
%a.tr.i = phi i32 [ %0, %entry ], [ %a.tr.i.be, %tailrecurse.i.backedge ]
%b.tr.i = phi i32 [ %1, %entry ], [ %a.tr.i, %tailrecurse.i.backedge ]
%cmp.i = icmp sgt i32 %a.tr.i, %b.tr.i
br i1 %cmp.i, label %tailrecurse.i.backedge, label %if.end.i
if.end.i: ; preds = %tailrecurse.i
%tobool.not.i = icmp eq i32 %a.tr.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %if.end2.i
if.end2.i: ; preds = %if.end.i
%rem.i = srem i32 %b.tr.i, %a.tr.i
br label %tailrecurse.i.backedge
tailrecurse.i.backedge: ; preds = %if.end2.i, %tailrecurse.i
%a.tr.i.be = phi i32 [ %rem.i, %if.end2.i ], [ %b.tr.i, %tailrecurse.i ]
br label %tailrecurse.i
gcd.exit: ; preds = %if.end.i
%mul = mul nsw i32 %1, %0
%div = sdiv i32 %mul, %b.tr.i
%2 = load i32, ptr %b, align 4, !tbaa !5
%div2 = sdiv i32 %2, %div
%3 = load i32, ptr %a, align 4, !tbaa !5
%div3 = sdiv i32 %3, %div
%sub = sub i32 %div2, %div3
%rem = srem i32 %3, %div
%cmp = icmp eq i32 %rem, 0
%inc = zext i1 %cmp to i32
%spec.select = add nsw i32 %sub, %inc
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
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"}
|
#include <stdio.h>
int main(void){
long long L,R,i,j;
int min=2020;
scanf("%lld %lld",&L,&R);
if(R-L>=2019){
printf("0\n");
return 0;
}
for(i=L;i<=R;i++){
for(j=i+1;j<=R;j++){
if(min>(i*j)%2019) min=(i*j)%2019;
}
}
printf("%d\n",min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231843/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%L = alloca i64, align 8
%R = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %L) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %R) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L, ptr noundef nonnull %R)
%0 = load i64, ptr %R, align 8, !tbaa !5
%1 = load i64, ptr %L, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%cmp = icmp sgt i64 %sub, 2018
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp2.not32 = icmp sgt i64 %1, %0
br i1 %cmp2.not32, label %for.end15, label %for.body
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
for.cond.loopexit: ; preds = %for.body5, %for.body
%min.1.lcssa = phi i32 [ %min.034, %for.body ], [ %spec.select, %for.body5 ]
%exitcond.not = icmp eq i64 %i.033, %0
br i1 %exitcond.not, label %for.end15, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.cond.loopexit
%min.034 = phi i32 [ %min.1.lcssa, %for.cond.loopexit ], [ 2020, %for.cond.preheader ]
%i.033 = phi i64 [ %add, %for.cond.loopexit ], [ %1, %for.cond.preheader ]
%add = add i64 %i.033, 1
%cmp4.not29.not = icmp slt i64 %i.033, %0
br i1 %cmp4.not29.not, label %for.body5, label %for.cond.loopexit
for.body5: ; preds = %for.body, %for.body5
%min.131 = phi i32 [ %spec.select, %for.body5 ], [ %min.034, %for.body ]
%j.030 = phi i64 [ %inc, %for.body5 ], [ %add, %for.body ]
%conv = sext i32 %min.131 to i64
%mul = mul nsw i64 %j.030, %i.033
%rem = srem i64 %mul, 2019
%cmp6 = icmp slt i64 %rem, %conv
%conv11 = trunc i64 %rem to i32
%spec.select = select i1 %cmp6, i32 %conv11, i32 %min.131
%inc = add nsw i64 %j.030, 1
%cmp4.not.not = icmp slt i64 %j.030, %0
br i1 %cmp4.not.not, label %for.body5, label %for.cond.loopexit, !llvm.loop !11
for.end15: ; preds = %for.cond.loopexit, %for.cond.preheader
%min.0.lcssa = phi i32 [ 2020, %for.cond.preheader ], [ %min.1.lcssa, %for.cond.loopexit ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.end15, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %R) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %L) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 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<string.h>
#include<stdlib.h>
#include<math.h>
int main(){
int l, r;
scanf("%d%d", &l, &r);
int ser=2019;
int agr, boon, cannon;
if(r-l>2019) printf("0");
else{
for(int i=l; i<=r-1; i++){
for(int j=i+1; j<=r; j++){
agr = i%2019;
boon = j%2019;
cannon = (agr*boon)%2019;
if(ser>cannon) ser = cannon;
}
}
printf("%d", ser);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231900/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231900/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%0 = load i32, ptr %r, align 4, !tbaa !5
%1 = load i32, ptr %l, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%cmp = icmp sgt i32 %sub, 2019
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp3.not.not27 = icmp slt i32 %1, %0
br i1 %cmp3.not.not27, label %for.body7.lr.ph.preheader, label %for.cond.cleanup
for.body7.lr.ph.preheader: ; preds = %for.cond.preheader
%2 = add i32 %1, 1
br label %for.body7.lr.ph
if.then: ; preds = %entry
%putchar = call i32 @putchar(i32 48)
br label %if.end16
for.cond.loopexit: ; preds = %for.body7, %middle.block
%spec.select.lcssa = phi i32 [ %15, %middle.block ], [ %spec.select, %for.body7 ]
%exitcond.not = icmp eq i32 %add, %0
%indvar.next = add i32 %indvar, 1
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body7.lr.ph, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.loopexit, %for.cond.preheader
%ser.0.lcssa = phi i32 [ 2019, %for.cond.preheader ], [ %spec.select.lcssa, %for.cond.loopexit ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ser.0.lcssa)
br label %if.end16
for.body7.lr.ph: ; preds = %for.body7.lr.ph.preheader, %for.cond.loopexit
%indvar = phi i32 [ 0, %for.body7.lr.ph.preheader ], [ %indvar.next, %for.cond.loopexit ]
%i.029 = phi i32 [ %1, %for.body7.lr.ph.preheader ], [ %add, %for.cond.loopexit ]
%ser.028 = phi i32 [ 2019, %for.body7.lr.ph.preheader ], [ %spec.select.lcssa, %for.cond.loopexit ]
%3 = add i32 %2, %indvar
%smax = call i32 @llvm.smax.i32(i32 %0, i32 %3)
%4 = add i32 %1, %indvar
%5 = sub i32 %smax, %4
%add = add nsw i32 %i.029, 1
%rem = srem i32 %i.029, 2019
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i32 %5, -8
%ind.end = add i32 %add, %n.vec
%.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%induction = add <4 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3>
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %ser.028, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %rem, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %12, %vector.body ]
%vec.phi32 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %13, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%6 = srem <4 x i32> %vec.ind, <i32 2019, i32 2019, i32 2019, i32 2019>
%7 = srem <4 x i32> %step.add, <i32 2019, i32 2019, i32 2019, i32 2019>
%8 = mul nsw <4 x i32> %6, %broadcast.splat
%9 = mul nsw <4 x i32> %7, %broadcast.splat
%10 = srem <4 x i32> %8, <i32 2019, i32 2019, i32 2019, i32 2019>
%11 = srem <4 x i32> %9, <i32 2019, i32 2019, i32 2019, i32 2019>
%12 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %10)
%13 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi32, <4 x i32> %11)
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%14 = icmp eq i32 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %12, <4 x i32> %13)
%15 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i32 %5, %n.vec
br i1 %cmp.n, label %for.cond.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%j.026.ph = phi i32 [ %add, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%ser.125.ph = phi i32 [ %ser.028, %for.body7.lr.ph ], [ %15, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%j.026 = phi i32 [ %inc, %for.body7 ], [ %j.026.ph, %for.body7.preheader ]
%ser.125 = phi i32 [ %spec.select, %for.body7 ], [ %ser.125.ph, %for.body7.preheader ]
%rem8 = srem i32 %j.026, 2019
%mul = mul nsw i32 %rem8, %rem
%rem9 = srem i32 %mul, 2019
%spec.select = call i32 @llvm.smin.i32(i32 %ser.125, i32 %rem9)
%inc = add nsw i32 %j.026, 1
%cmp5.not.not = icmp slt i32 %j.026, %0
br i1 %cmp5.not.not, label %for.body7, label %for.cond.loopexit, !llvm.loop !14
if.end16: ; preds = %for.cond.cleanup, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include<stdio.h>
int main(){
int i, j, cal, min = 2018;
int L, R;
scanf("%d %d", &L, &R);
if(R-L>=2019)
{ min=0;
}
else
{
for(i = L; i < R; i++){
for(j = i+1; j <= R; j++){
cal = (i%2019)*(j%2019)% 2019;
if(cal < min){
min = cal;
}
}
}
}
printf("%d", min);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231944/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231944/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%L = alloca i32, align 4
%R = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %R) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L, ptr noundef nonnull %R)
%0 = load i32, ptr %R, align 4, !tbaa !5
%1 = load i32, ptr %L, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%cmp = icmp sgt i32 %sub, 2018
br i1 %cmp, label %if.end12, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp124 = icmp slt i32 %1, %0
br i1 %cmp124, label %for.body4.lr.ph.preheader, label %if.end12
for.body4.lr.ph.preheader: ; preds = %for.cond.preheader
%2 = add i32 %1, 1
br label %for.body4.lr.ph
for.cond.loopexit: ; preds = %for.body4, %middle.block
%spec.select.lcssa = phi i32 [ %15, %middle.block ], [ %spec.select, %for.body4 ]
%exitcond.not = icmp eq i32 %add, %0
%indvar.next = add i32 %indvar, 1
br i1 %exitcond.not, label %if.end12, label %for.body4.lr.ph, !llvm.loop !9
for.body4.lr.ph: ; preds = %for.body4.lr.ph.preheader, %for.cond.loopexit
%indvar = phi i32 [ 0, %for.body4.lr.ph.preheader ], [ %indvar.next, %for.cond.loopexit ]
%min.026 = phi i32 [ 2018, %for.body4.lr.ph.preheader ], [ %spec.select.lcssa, %for.cond.loopexit ]
%i.025 = phi i32 [ %1, %for.body4.lr.ph.preheader ], [ %add, %for.cond.loopexit ]
%3 = add i32 %2, %indvar
%smax = call i32 @llvm.smax.i32(i32 %0, i32 %3)
%4 = add i32 %1, %indvar
%5 = sub i32 %smax, %4
%add = add nsw i32 %i.025, 1
%rem = srem i32 %i.025, 2019
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.body4.lr.ph
%n.vec = and i32 %5, -8
%ind.end = add i32 %add, %n.vec
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %min.026, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%induction = add <4 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3>
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %rem, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %12, %vector.body ]
%vec.phi28 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %13, %vector.body ]
%vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%6 = srem <4 x i32> %vec.ind, <i32 2019, i32 2019, i32 2019, i32 2019>
%7 = srem <4 x i32> %step.add, <i32 2019, i32 2019, i32 2019, i32 2019>
%8 = mul nsw <4 x i32> %6, %broadcast.splat
%9 = mul nsw <4 x i32> %7, %broadcast.splat
%10 = srem <4 x i32> %8, <i32 2019, i32 2019, i32 2019, i32 2019>
%11 = srem <4 x i32> %9, <i32 2019, i32 2019, i32 2019, i32 2019>
%12 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %10, <4 x i32> %vec.phi)
%13 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %11, <4 x i32> %vec.phi28)
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%14 = icmp eq i32 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %12, <4 x i32> %13)
%15 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i32 %5, %n.vec
br i1 %cmp.n, label %for.cond.loopexit, label %for.body4.preheader
for.body4.preheader: ; preds = %for.body4.lr.ph, %middle.block
%min.123.ph = phi i32 [ %min.026, %for.body4.lr.ph ], [ %15, %middle.block ]
%j.022.ph = phi i32 [ %add, %for.body4.lr.ph ], [ %ind.end, %middle.block ]
br label %for.body4
for.body4: ; preds = %for.body4.preheader, %for.body4
%min.123 = phi i32 [ %spec.select, %for.body4 ], [ %min.123.ph, %for.body4.preheader ]
%j.022 = phi i32 [ %inc, %for.body4 ], [ %j.022.ph, %for.body4.preheader ]
%rem5 = srem i32 %j.022, 2019
%mul = mul nsw i32 %rem5, %rem
%rem6 = srem i32 %mul, 2019
%spec.select = call i32 @llvm.smin.i32(i32 %rem6, i32 %min.123)
%inc = add nsw i32 %j.022, 1
%cmp3.not.not = icmp slt i32 %j.022, %0
br i1 %cmp3.not.not, label %for.body4, label %for.cond.loopexit, !llvm.loop !14
if.end12: ; preds = %for.cond.loopexit, %for.cond.preheader, %entry
%min.3 = phi i32 [ 0, %entry ], [ 2018, %for.cond.preheader ], [ %spec.select.lcssa, %for.cond.loopexit ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %R) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
long long int L,R;
scanf("%lld %lld",&L,&R);
if(R-L>3000){
printf("0\n");
}else{
//L=L%2019;
//R=R%2019;
long long int min=2018;
for(long long int i=L;i<R;i++){
for(long long int j=L+1;j<R+1;j++){
if(min > ((i*j)%2019))min=((i*j)%2019);
}
}
printf("%d",min);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_231988/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_231988/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%L = alloca i64, align 8
%R = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %L) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %R) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L, ptr noundef nonnull %R)
%0 = load i64, ptr %R, align 8, !tbaa !5
%1 = load i64, ptr %L, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%cmp = icmp sgt i64 %sub, 3000
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp227 = icmp slt i64 %1, %0
br i1 %cmp227, label %for.cond3.preheader.us.preheader, label %for.cond.cleanup
for.cond3.preheader.us.preheader: ; preds = %for.cond.preheader
%.neg = add i64 %1, 1
%xtraiter = and i64 %sub, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%j.0.us.prol = add nsw i64 %1, 1
%2 = icmp eq i64 %0, %.neg
br label %for.cond3.preheader.us
for.cond3.preheader.us: ; preds = %for.cond3.preheader.us.preheader, %for.cond3.for.cond.cleanup6_crit_edge.us
%i.029.us = phi i64 [ %inc13.us, %for.cond3.for.cond.cleanup6_crit_edge.us ], [ %1, %for.cond3.preheader.us.preheader ]
%min.028.us = phi i64 [ %spec.select.us.lcssa, %for.cond3.for.cond.cleanup6_crit_edge.us ], [ 2018, %for.cond3.preheader.us.preheader ]
br i1 %lcmp.mod.not, label %for.body7.us.prol.loopexit, label %for.body7.us.prol
for.body7.us.prol: ; preds = %for.cond3.preheader.us
%mul.us.prol = mul nsw i64 %j.0.us.prol, %i.029.us
%rem.us.prol = srem i64 %mul.us.prol, 2019
%spec.select.us.prol = call i64 @llvm.smin.i64(i64 %min.028.us, i64 %rem.us.prol)
br label %for.body7.us.prol.loopexit
for.body7.us.prol.loopexit: ; preds = %for.body7.us.prol, %for.cond3.preheader.us
%spec.select.us.lcssa.unr = phi i64 [ undef, %for.cond3.preheader.us ], [ %spec.select.us.prol, %for.body7.us.prol ]
%j.0.in26.us.unr = phi i64 [ %1, %for.cond3.preheader.us ], [ %j.0.us.prol, %for.body7.us.prol ]
%min.125.us.unr = phi i64 [ %min.028.us, %for.cond3.preheader.us ], [ %spec.select.us.prol, %for.body7.us.prol ]
br i1 %2, label %for.cond3.for.cond.cleanup6_crit_edge.us, label %for.body7.us
for.body7.us: ; preds = %for.body7.us.prol.loopexit, %for.body7.us
%j.0.in26.us = phi i64 [ %j.0.us.1, %for.body7.us ], [ %j.0.in26.us.unr, %for.body7.us.prol.loopexit ]
%min.125.us = phi i64 [ %spec.select.us.1, %for.body7.us ], [ %min.125.us.unr, %for.body7.us.prol.loopexit ]
%j.0.us = add nsw i64 %j.0.in26.us, 1
%mul.us = mul nsw i64 %j.0.us, %i.029.us
%rem.us = srem i64 %mul.us, 2019
%spec.select.us = call i64 @llvm.smin.i64(i64 %min.125.us, i64 %rem.us)
%j.0.us.1 = add nsw i64 %j.0.in26.us, 2
%mul.us.1 = mul nsw i64 %j.0.us.1, %i.029.us
%rem.us.1 = srem i64 %mul.us.1, 2019
%spec.select.us.1 = call i64 @llvm.smin.i64(i64 %spec.select.us, i64 %rem.us.1)
%exitcond.not.1 = icmp eq i64 %j.0.us.1, %0
br i1 %exitcond.not.1, label %for.cond3.for.cond.cleanup6_crit_edge.us, label %for.body7.us, !llvm.loop !9
for.cond3.for.cond.cleanup6_crit_edge.us: ; preds = %for.body7.us, %for.body7.us.prol.loopexit
%spec.select.us.lcssa = phi i64 [ %spec.select.us.lcssa.unr, %for.body7.us.prol.loopexit ], [ %spec.select.us.1, %for.body7.us ]
%inc13.us = add nsw i64 %i.029.us, 1
%exitcond31.not = icmp eq i64 %inc13.us, %0
br i1 %exitcond31.not, label %for.cond.cleanup, label %for.cond3.preheader.us, !llvm.loop !11
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end16
for.cond.cleanup: ; preds = %for.cond3.for.cond.cleanup6_crit_edge.us, %for.cond.preheader
%min.0.lcssa = phi i64 [ 2018, %for.cond.preheader ], [ %spec.select.us.lcssa, %for.cond3.for.cond.cleanup6_crit_edge.us ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %min.0.lcssa)
br label %if.end16
if.end16: ; preds = %for.cond.cleanup, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %R) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %L) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind 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 = !{!"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 gcd_recurse(int a, int b)
{
int temp;
temp = a % b;
if (temp == 0)
{
return(b);
}
else
{
return(gcd_recurse(b, temp));
}
}
int main()
{
long long int x,y,a,b;
long long int ans=0;
long long int min,i,l;
int flag=0,flag1=0;
scanf("%lld%lld%lld%lld",&x,&y,&a,&b);
min=(x*y)/gcd_recurse(x,y);
// printf("%lld\n",min);
for(i=a;i<=b;i++)
if(i%min==0)
{
flag=1;
break;
}
int t1,t2;
if(flag==1)
{
t1=i;
}
else
{
flag1=1;
}
flag=0;
for(i=b;i>=a;i--)
if(i%min==0)
{
flag=1;
break;
}
if(flag==1)
{
t2=i;
}
else
{
flag1=1;
}
if(flag1==1)
printf("0\n");
else
printf("%lld\n",((t2-t1)/min)+1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23203/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23203/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd_recurse(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%a.tr = phi i32 [ %a, %entry ], [ %b.tr, %tailrecurse ]
%b.tr = phi i32 [ %b, %entry ], [ %rem, %tailrecurse ]
%rem = srem i32 %a.tr, %b.tr
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %cleanup, label %tailrecurse
cleanup: ; preds = %tailrecurse
ret i32 %b.tr
}
; 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:
%x = alloca i64, align 8
%y = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %x, align 8, !tbaa !5
%1 = load i64, ptr %y, align 8, !tbaa !5
%conv = trunc i64 %0 to i32
%conv1 = trunc i64 %1 to i32
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i, %entry
%a.tr.i = phi i32 [ %conv, %entry ], [ %b.tr.i, %tailrecurse.i ]
%b.tr.i = phi i32 [ %conv1, %entry ], [ %rem.i, %tailrecurse.i ]
%rem.i = srem i32 %a.tr.i, %b.tr.i
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %gcd_recurse.exit, label %tailrecurse.i
gcd_recurse.exit: ; preds = %tailrecurse.i
%mul = mul nsw i64 %1, %0
%conv3 = sext i32 %b.tr.i to i64
%div = sdiv i64 %mul, %conv3
%2 = load i64, ptr %a, align 8, !tbaa !5
%3 = load i64, ptr %b, align 8, !tbaa !5
%cmp.not.not51 = icmp sgt i64 %2, %3
br i1 %cmp.not.not51, label %if.then31, label %for.body.preheader
for.body.preheader: ; preds = %gcd_recurse.exit
%rem66 = srem i64 %2, %div
%cmp567 = icmp eq i64 %rem66, 0
br i1 %cmp567, label %for.end, label %for.inc
for.body: ; preds = %for.inc
%inc = add i64 %i.05268, 1
%rem = srem i64 %inc, %div
%cmp5 = icmp eq i64 %rem, 0
br i1 %cmp5, label %for.end.loopexit, label %for.inc, !llvm.loop !9
for.inc: ; preds = %for.body.preheader, %for.body
%i.05268 = phi i64 [ %inc, %for.body ], [ %2, %for.body.preheader ]
%exitcond = icmp eq i64 %i.05268, %3
br i1 %exitcond, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc, %for.body
%.i.0.ph = phi i64 [ %inc, %for.body ], [ 0, %for.inc ]
%cmp.not.not.le = icmp sge i64 %i.05268, %3
br label %for.end
for.end: ; preds = %for.end.loopexit, %for.body.preheader
%cmp.not.not.lcssa = phi i1 [ false, %for.body.preheader ], [ %cmp.not.not.le, %for.end.loopexit ]
%.i.0 = phi i64 [ %2, %for.body.preheader ], [ %.i.0.ph, %for.end.loopexit ]
br i1 %cmp.not.not51, label %if.then31, label %for.body15
for.body15: ; preds = %for.end, %for.inc21
%i.160 = phi i64 [ %dec, %for.inc21 ], [ %3, %for.end ]
%rem16 = srem i64 %i.160, %div
%cmp17 = icmp eq i64 %rem16, 0
br i1 %cmp17, label %for.end22, label %for.inc21
for.inc21: ; preds = %for.body15
%dec = add nsw i64 %i.160, -1
%cmp13.not.not.not = icmp sgt i64 %i.160, %2
br i1 %cmp13.not.not.not, label %for.body15, label %if.then31, !llvm.loop !11
for.end22: ; preds = %for.body15
br i1 %cmp.not.not.lcssa, label %if.then31, label %if.else33
if.then31: ; preds = %for.inc21, %gcd_recurse.exit, %for.end, %for.end22
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end37
if.else33: ; preds = %for.end22
%sub = sub i64 %i.160, %.i.0
%sext = shl i64 %sub, 32
%conv34 = ashr exact i64 %sext, 32
%div35 = sdiv i64 %conv34, %div
%add = add nsw i64 %div35, 1
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add)
br label %if.end37
if.end37: ; preds = %if.else33, %if.then31
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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}
|
#pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define c_cin(X) scanf("%c",&X);
#define ll_cin(X) scanf("%lld", &X)
#define ull_cin(X) scanf("%llu", &X)
#define lf_cin(X) scanf("%lf", &X)
#define i_cout(X) printf("%d\n",X)
#define f_cout(X) printf("%g\n",X)
#define i_cout2(X,Y) printf("%d %d\n",X,Y)
#define l_cout(X) printf("%ld\n",X)
#define s_cout(X) printf("%s\n",X)
#define s_coutc(X) printf("%s",X)
#define c_cout(X) printf("%c",X)
#define ll_cout(X) printf("%lld\n",X)
#define ull_cout(X) printf("%llu\n",X)
typedef long long ll;
typedef unsigned long long ull;
#define rept(x, s, n) for (int x = s; x < n; x++)
#define S_RTN(S) s_cout(S);return 0
#define _itoa(A,N) sprintf(A, "%d", N);
int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
int _gcd(int a, int b);
int _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
int s_asorts(const void* a, const void* b);
int s_dsorts(const void* a, const void* b);
//昇順
int s_asorts(const void* a, const void* b) {
return(strcmp((char*)a, (char*)b));
}
int s_dsorts(const void* a, const void* b) {
return(strcmp((char*)b, (char*)a));
}
int s_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
int i;
rept(i, 0, n) {
l_cin2(*(a + i), *(b + i));
}
return 0;
}
int i_cins(int n, int* a) {
int i;
for (i = 0; i < n; i++) {
i_cin(*(a + i));
}
return 0;
}
int _gcd(int a, int b) {
int r, tmp;
if (a < b) { tmp = a; a = b; b = tmp; }
r = a % b;
while (r) {
if (!r) break;
a = b; b = r;
r = a % b;
}
return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数2つで得る
//#define pai 3.1415926535
#define deg_rad(X) (X*(M_PI/180))
long _max(long a, long b) {
return a > b ? a : b;
}
long _min(long a, long b) {
return a < b ? a : b;
}
int _swp(int* a, int* b)
{
int tmp;
tmp = *b; *b = *a; *a = tmp;
return 0;
}
int _cknum(char* a, int n) {
int i;
char t = '0';
for (i = 0; i < n; i++) {
if (a[i] < '0' || a[i]>'9') return 1;
}
return 0;
}
int _atoi(char* s, int len) {
char tmp[20];
memcpy(tmp, s, len);
tmp[len] = 0x00;
return (atoi(tmp));
}
//素因数分解 pf素数が入る pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;
ll _pfact(ll a) {
long i, r;
if (a % 2 == 0) {
pf[pc] = 2; pc++;
return(_pfact(a / 2));
}
r = sqrt(a);
for (i = 3; i <= r; i += 2) {
if (a % i == 0) {
pf[pc] = i; pc++;
return(_pfact(a / i));
}
}
if (a != 1) {
pf[pc] = a; pc++;
}
return 0;
}
#pragma endregion
//ABC 95-C Half and Half
//int main(void) {
// long a, b, c, x, y;
// long tmp;
// scanf("%ld %ld %ld %ld %ld", &a, &b, &c, &x, &y);
// c *= 2;
//
// /*if (a >= c) {
// tmp=(long)x * c + ((y - x < 0) ? 0 :(long)(y - x) * b);
// printf("%ld",tmp);
// return 0;
// }
// if (b >= c) {
// tmp =(long)y * c + ((x - y < 0) ? 0 : (long)(x - y) * b);
// printf("%ld\n", tmp);
// return 0;
// }*/
//
// if ((a + b) <= c) {
// printf("%ld\n",a * x + b * y);
// return 0;
// }
//
// tmp = a * x + b * y;
// if (c * _max(x, y) < tmp) {
// printf("%ld\n",c* _max(x, y)); return 0;
// }
//
// tmp = c * _min(x, y);
// tmp += ((x < y) ? (y - x) * b :(x - y) * a);
// printf("%ld\n", tmp);
// return 0;
//}
// 162 D-RGB Triplets
static char s[4001];
int main(void)
{
int n, i, j;
long rc = 0, gc = 0, bc = 0;
i_cin(n);
s_cin(s);
for (i = 0; i < n; i++) {
switch (s[i]) {
case 'R':rc++; break;
case 'G':gc++; break;
case 'B':bc++; break;
}
}
int lcnt;
long cnt = 0;
lcnt = n;
for (i = 1;i < lcnt; i++) {
int lc;
lc = n;
for (j = 0; j < lc; j++) {
if ((j+i*2) >= n)break;
if (s[j] != s[j + i] &&
s[j+i] != s[j+i*2] &&
s[j] != s[j+i*2]) {
cnt++;
// printf("%d %d %d ::", j, j + i, j + i * 2);
//printf("%ld r:%c g:%c b:%c\n",cnt,s[j],s[j + i],s[j + i*2]);
}
}
}
/// printf("%d %d %d\n", rc, gc, bc);
// l_cout(cnt);
// l_cout(rc * gc * bc);
l_cout(rc*gc*bc-cnt);
return 0;
}
//066-B
//157-C
//int main(void) {
// int n, m;
// int s, c;
// int a[3] = { -1,-1,-1 };
// int i, ans=0;
//
// i_cin2(n, m);
//
// if (m == 0 && n!=1) { i_cout(-1); return 0; } //???2つ目の条件なし
//
// for (i = 0; i < m; i++) {
// i_cin2(s, c);
// if ((a[s - 1] != -1) && //矛盾はないか
// (a[s - 1] != c) ) { i_cout(-1); return 0; }
// switch (n) {
// case 1:if (s != 3) { i_cout(-1); return 0; }
// break;
// case 2:if (s == 1) { i_cout(-1); return 0; }
// if (s == 2 && c == 0)
// {i_cout(-1); return 0;}
// break;
// case 3:
// if (s == 1 && c == 0)
// {i_cout(-1); return 0;}
// break;
// }
// a[s - 1] = c;
// }
//
// for (i = 0; i < 3; i++) {
// if (a[i] == -1) a[i] = 0;
// }
// ans = a[0] * 100 + a[1] * 10 + a[2];
//
// i_cout(ans);
// return 0;
//}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232073/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232073/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"%d\00", align 1
@pc = internal unnamed_addr global i64 0, align 8
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@s = internal global [4001 x i8] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asorts(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsorts(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @l_cins2(i32 noundef %n, ptr noundef %a, ptr noundef %b) local_unnamed_addr #3 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret i32 0
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%add.ptr = getelementptr inbounds i64, ptr %a, i64 %indvars.iv
%add.ptr3 = getelementptr inbounds i64, ptr %b, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr, ptr noundef %add.ptr3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @i_cins(i32 noundef %n, ptr noundef %a) local_unnamed_addr #3 {
entry:
%cmp3 = icmp sgt i32 %n, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %add.ptr)
%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 !11
for.end: ; preds = %for.body, %entry
ret i32 0
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @_gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #6 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%spec.select15 = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%rem = srem i32 %spec.select15, %spec.select
%tobool.not16 = icmp eq i32 %rem, 0
br i1 %tobool.not16, label %while.end, label %if.end3
if.end3: ; preds = %entry, %if.end3
%r.018 = phi i32 [ %rem4, %if.end3 ], [ %rem, %entry ]
%b.addr.117 = phi i32 [ %r.018, %if.end3 ], [ %spec.select, %entry ]
%rem4 = srem i32 %b.addr.117, %r.018
%tobool.not = icmp eq i32 %rem4, 0
br i1 %tobool.not, label %while.end, label %if.end3, !llvm.loop !12
while.end: ; preds = %if.end3, %entry
%b.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %r.018, %if.end3 ]
ret i32 %b.addr.1.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @_max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @_min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_swp(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #8 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !5
ret i32 0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @_cknum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #9 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !13
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%1 = add i8 %0, -58
%or.cond = icmp ult i8 %1, -10
br i1 %or.cond, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i32 @_atoi(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #10 {
entry:
%tmp = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %tmp) #17
%conv = sext i32 %len to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr align 1 %s, i64 %conv, i1 false)
%arrayidx = getelementptr inbounds [20 x i8], ptr %tmp, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !14
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #17
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %tmp) #17
ret i32 %conv.i
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #11
; Function Attrs: nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable
define dso_local i64 @_pfact(i64 noundef %a) local_unnamed_addr #12 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%a.tr = phi i64 [ %a, %entry ], [ %div, %tailrecurse.backedge ]
%0 = and i64 %a.tr, 1
%cmp = icmp eq i64 %0, 0
br i1 %cmp, label %tailrecurse.backedge, label %if.end
tailrecurse.backedge: ; preds = %for.body, %tailrecurse
%.sink = phi i64 [ 2, %tailrecurse ], [ %i.035, %for.body ]
%1 = load i64, ptr @pc, align 8, !tbaa !15
%inc = add nsw i64 %1, 1
store i64 %inc, ptr @pc, align 8, !tbaa !15
%div = sdiv i64 %a.tr, %.sink
br label %tailrecurse
if.end: ; preds = %tailrecurse
%conv = sitofp i64 %a.tr to double
%call1 = tail call double @sqrt(double noundef %conv) #17
%conv2 = fptosi double %call1 to i64
%cmp3.not34 = icmp slt i64 %conv2, 3
br i1 %cmp3.not34, label %for.end, label %for.body
for.body: ; preds = %if.end, %for.inc
%i.035 = phi i64 [ %add, %for.inc ], [ 3, %if.end ]
%rem5 = srem i64 %a.tr, %i.035
%cmp6 = icmp eq i64 %rem5, 0
br i1 %cmp6, label %tailrecurse.backedge, label %for.inc
for.inc: ; preds = %for.body
%add = add nuw nsw i64 %i.035, 2
%cmp3.not = icmp sgt i64 %add, %conv2
br i1 %cmp3.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %if.end, %for.inc
%cmp14.not = icmp eq i64 %a.tr, 1
br i1 %cmp14.not, label %cleanup, label %if.then16
if.then16: ; preds = %for.end
%2 = load i64, ptr @pc, align 8, !tbaa !15
%inc18 = add nsw i64 %2, 1
store i64 %inc18, ptr @pc, align 8, !tbaa !15
br label %cleanup
cleanup: ; preds = %for.end, %if.then16
ret i64 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #13
; 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) #17
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp81 = icmp sgt i32 %0, 0
br i1 %cmp81, label %for.body.preheader, label %for.end56
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %for.cond7.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.cond7.preheader.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%rc.1.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rc.1.1, %for.inc.1 ]
%gc.1.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %gc.1.1, %for.inc.1 ]
%bc.1.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %bc.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%bc.084.unr = phi i64 [ 0, %for.body.preheader ], [ %bc.1.1, %for.inc.1 ]
%gc.083.unr = phi i64 [ 0, %for.body.preheader ], [ %gc.1.1, %for.inc.1 ]
%rc.082.unr = phi i64 [ 0, %for.body.preheader ], [ %rc.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond7.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond7.preheader.unr-lcssa
%arrayidx.epil = getelementptr inbounds [4001 x i8], ptr @s, i64 0, i64 %indvars.iv.unr
%2 = load i8, ptr %arrayidx.epil, align 1, !tbaa !14
%conv.epil = sext i8 %2 to i32
switch i32 %conv.epil, label %for.cond7.preheader [
i32 82, label %sw.bb.epil
i32 71, label %sw.bb2.epil
i32 66, label %sw.bb4.epil
]
sw.bb4.epil: ; preds = %for.body.epil
%inc5.epil = add nsw i64 %bc.084.unr, 1
br label %for.cond7.preheader
sw.bb2.epil: ; preds = %for.body.epil
%inc3.epil = add nsw i64 %gc.083.unr, 1
br label %for.cond7.preheader
sw.bb.epil: ; preds = %for.body.epil
%inc.epil = add nsw i64 %rc.082.unr, 1
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.epil, %sw.bb4.epil, %sw.bb2.epil, %sw.bb.epil, %for.cond7.preheader.unr-lcssa
%rc.1.lcssa = phi i64 [ %rc.1.lcssa.ph, %for.cond7.preheader.unr-lcssa ], [ %rc.082.unr, %for.body.epil ], [ %rc.082.unr, %sw.bb4.epil ], [ %rc.082.unr, %sw.bb2.epil ], [ %inc.epil, %sw.bb.epil ]
%gc.1.lcssa = phi i64 [ %gc.1.lcssa.ph, %for.cond7.preheader.unr-lcssa ], [ %gc.083.unr, %for.body.epil ], [ %gc.083.unr, %sw.bb4.epil ], [ %inc3.epil, %sw.bb2.epil ], [ %gc.083.unr, %sw.bb.epil ]
%bc.1.lcssa = phi i64 [ %bc.1.lcssa.ph, %for.cond7.preheader.unr-lcssa ], [ %bc.084.unr, %for.body.epil ], [ %inc5.epil, %sw.bb4.epil ], [ %bc.084.unr, %sw.bb2.epil ], [ %bc.084.unr, %sw.bb.epil ]
%cmp894 = icmp sgt i32 %0, 1
br i1 %cmp894, label %for.cond11.preheader.us.preheader, label %for.end56
for.cond11.preheader.us.preheader: ; preds = %for.cond7.preheader
%3 = zext i32 %0 to i64
%wide.trip.count111 = zext i32 %0 to i64
br label %for.cond11.preheader.us
for.cond11.preheader.us: ; preds = %for.cond11.preheader.us.preheader, %for.end53.us
%indvars.iv107 = phi i64 [ 1, %for.cond11.preheader.us.preheader ], [ %indvars.iv.next108, %for.end53.us ]
%cnt.095.us = phi i64 [ 0, %for.cond11.preheader.us.preheader ], [ %cnt.1.lcssa.us, %for.end53.us ]
%4 = shl nuw nsw i64 %indvars.iv107, 1
br label %for.body14.us
for.body14.us: ; preds = %for.cond11.preheader.us, %for.inc51.us
%indvars.iv100 = phi i64 [ 0, %for.cond11.preheader.us ], [ %indvars.iv.next101, %for.inc51.us ]
%cnt.191.us = phi i64 [ %cnt.095.us, %for.cond11.preheader.us ], [ %cnt.2.us, %for.inc51.us ]
%5 = add nuw nsw i64 %indvars.iv100, %4
%cmp15.not.us = icmp ult i64 %5, %3
br i1 %cmp15.not.us, label %if.end.us, label %for.end53.us
for.end53.us: ; preds = %for.inc51.us, %for.body14.us
%cnt.1.lcssa.us = phi i64 [ %cnt.191.us, %for.body14.us ], [ %cnt.2.us, %for.inc51.us ]
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%exitcond112.not = icmp eq i64 %indvars.iv.next108, %wide.trip.count111
br i1 %exitcond112.not, label %for.end56, label %for.cond11.preheader.us, !llvm.loop !18
if.end.us: ; preds = %for.body14.us
%arrayidx18.us = getelementptr inbounds [4001 x i8], ptr @s, i64 0, i64 %indvars.iv100
%6 = load i8, ptr %arrayidx18.us, align 1, !tbaa !14
%7 = add nuw nsw i64 %indvars.iv100, %indvars.iv107
%arrayidx22.us = getelementptr inbounds [4001 x i8], ptr @s, i64 0, i64 %7
%8 = load i8, ptr %arrayidx22.us, align 1, !tbaa !14
%cmp24.not.us = icmp eq i8 %6, %8
br i1 %cmp24.not.us, label %for.inc51.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %if.end.us
%arrayidx33.us = getelementptr inbounds [4001 x i8], ptr @s, i64 0, i64 %5
%9 = load i8, ptr %arrayidx33.us, align 1, !tbaa !14
%cmp35.not.us = icmp ne i8 %8, %9
%cmp46.not.us = icmp ne i8 %6, %9
%or.cond.not.us = and i1 %cmp35.not.us, %cmp46.not.us
%inc49.us = zext i1 %or.cond.not.us to i64
%spec.select.us = add nsw i64 %cnt.191.us, %inc49.us
br label %for.inc51.us
for.inc51.us: ; preds = %land.lhs.true.us, %if.end.us
%cnt.2.us = phi i64 [ %cnt.191.us, %if.end.us ], [ %spec.select.us, %land.lhs.true.us ]
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%exitcond106.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count111
br i1 %exitcond106.not, label %for.end53.us, label %for.body14.us, !llvm.loop !19
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%bc.084 = phi i64 [ 0, %for.body.preheader.new ], [ %bc.1.1, %for.inc.1 ]
%gc.083 = phi i64 [ 0, %for.body.preheader.new ], [ %gc.1.1, %for.inc.1 ]
%rc.082 = phi i64 [ 0, %for.body.preheader.new ], [ %rc.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [4001 x i8], ptr @s, i64 0, i64 %indvars.iv
%10 = load i8, ptr %arrayidx, align 2, !tbaa !14
%conv = sext i8 %10 to i32
switch i32 %conv, label %for.inc [
i32 82, label %sw.bb
i32 71, label %sw.bb2
i32 66, label %sw.bb4
]
sw.bb: ; preds = %for.body
%inc = add nsw i64 %rc.082, 1
br label %for.inc
sw.bb2: ; preds = %for.body
%inc3 = add nsw i64 %gc.083, 1
br label %for.inc
sw.bb4: ; preds = %for.body
%inc5 = add nsw i64 %bc.084, 1
br label %for.inc
for.inc: ; preds = %sw.bb, %sw.bb2, %sw.bb4, %for.body
%rc.1 = phi i64 [ %rc.082, %for.body ], [ %rc.082, %sw.bb4 ], [ %rc.082, %sw.bb2 ], [ %inc, %sw.bb ]
%gc.1 = phi i64 [ %gc.083, %for.body ], [ %gc.083, %sw.bb4 ], [ %inc3, %sw.bb2 ], [ %gc.083, %sw.bb ]
%bc.1 = phi i64 [ %bc.084, %for.body ], [ %inc5, %sw.bb4 ], [ %bc.084, %sw.bb2 ], [ %bc.084, %sw.bb ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [4001 x i8], ptr @s, i64 0, i64 %indvars.iv.next
%11 = load i8, ptr %arrayidx.1, align 1, !tbaa !14
%conv.1 = sext i8 %11 to i32
switch i32 %conv.1, label %for.inc.1 [
i32 82, label %sw.bb.1
i32 71, label %sw.bb2.1
i32 66, label %sw.bb4.1
]
sw.bb4.1: ; preds = %for.inc
%inc5.1 = add nsw i64 %bc.1, 1
br label %for.inc.1
sw.bb2.1: ; preds = %for.inc
%inc3.1 = add nsw i64 %gc.1, 1
br label %for.inc.1
sw.bb.1: ; preds = %for.inc
%inc.1 = add nsw i64 %rc.1, 1
br label %for.inc.1
for.inc.1: ; preds = %sw.bb.1, %sw.bb2.1, %sw.bb4.1, %for.inc
%rc.1.1 = phi i64 [ %rc.1, %for.inc ], [ %rc.1, %sw.bb4.1 ], [ %rc.1, %sw.bb2.1 ], [ %inc.1, %sw.bb.1 ]
%gc.1.1 = phi i64 [ %gc.1, %for.inc ], [ %gc.1, %sw.bb4.1 ], [ %inc3.1, %sw.bb2.1 ], [ %gc.1, %sw.bb.1 ]
%bc.1.1 = phi i64 [ %bc.1, %for.inc ], [ %inc5.1, %sw.bb4.1 ], [ %bc.1, %sw.bb2.1 ], [ %bc.1, %sw.bb.1 ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond7.preheader.unr-lcssa, label %for.body, !llvm.loop !20
for.end56: ; preds = %for.end53.us, %entry, %for.cond7.preheader
%bc.0.lcssa119 = phi i64 [ %bc.1.lcssa, %for.cond7.preheader ], [ 0, %entry ], [ %bc.1.lcssa, %for.end53.us ]
%gc.0.lcssa118 = phi i64 [ %gc.1.lcssa, %for.cond7.preheader ], [ 0, %entry ], [ %gc.1.lcssa, %for.end53.us ]
%rc.0.lcssa117 = phi i64 [ %rc.1.lcssa, %for.cond7.preheader ], [ 0, %entry ], [ %rc.1.lcssa, %for.end53.us ]
%cnt.0.lcssa = phi i64 [ 0, %for.cond7.preheader ], [ 0, %entry ], [ %cnt.1.lcssa.us, %for.end53.us ]
%mul57 = mul nsw i64 %gc.0.lcssa118, %rc.0.lcssa117
%mul58 = mul nsw i64 %mul57, %bc.0.lcssa119
%sub = sub nsw i64 %mul58, %cnt.0.lcssa
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #17
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #15
attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress 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 #8 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #12 = { nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: 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 #13 = { 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 #14 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #15 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #16 = { nounwind willreturn memory(read) }
attributes #17 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
#define rep(i,r) for(int i=0;i<r;i++)
int main() {
int N;
scanf("%d", &N);
char S[N];
scanf("%s", &S);
int rgb[3] = {0};
rep(i,N) rgb[S[i] == 'R' ? 0 : (S[i] == 'G' ? 1 : 2)]++;
long count = (long)rgb[0] * rgb[1] * rgb[2];
for (int i = 0; i < N - 2; i++) {
for (int j = 1; i + j * 2 < N; j++) {
if (S[i] != S[i + j]
&& S[i] != S[i + j * 2]
&& S[i + j] != S[i + j * 2]) count--;
}
}
printf("%ld", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232116/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232116/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%rgb = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %1, align 16
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %rgb) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %rgb, i8 0, i64 12, i1 false)
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp87 = icmp sgt i32 %3, 0
br i1 %cmp87, label %for.body.preheader, label %for.cond.cleanup24
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %3 to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %3, 1
br i1 %4, label %for.cond.cleanup.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.cond.cleanup.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.unr
%5 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
%cmp2.epil = icmp eq i8 %5, 82
%cmp7.epil = icmp eq i8 %5, 71
%cond.epil = select i1 %cmp7.epil, i64 1, i64 2
%cond9.epil = select i1 %cmp2.epil, i64 0, i64 %cond.epil
%arrayidx11.epil = getelementptr inbounds [3 x i32], ptr %rgb, i64 0, i64 %cond9.epil
%6 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%inc.epil = add nsw i32 %6, 1
store i32 %inc.epil, ptr %arrayidx11.epil, align 4, !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.unr-lcssa, %for.body.epil
%.pre = load i32, ptr %rgb, align 4, !tbaa !5
%arrayidx15.phi.trans.insert = getelementptr inbounds [3 x i32], ptr %rgb, i64 0, i64 1
%.pre112 = load i32, ptr %arrayidx15.phi.trans.insert, align 4, !tbaa !5
%arrayidx17.phi.trans.insert = getelementptr inbounds [3 x i32], ptr %rgb, i64 0, i64 2
%.pre113 = load i32, ptr %arrayidx17.phi.trans.insert, align 4, !tbaa !5
%7 = sext i32 %.pre to i64
%8 = sext i32 %.pre112 to i64
%9 = mul nsw i64 %8, %7
%10 = sext i32 %.pre113 to i64
%11 = mul nsw i64 %9, %10
%cmp2295 = icmp sgt i32 %3, 2
br i1 %cmp2295, label %for.cond26.preheader.preheader, label %for.cond.cleanup24
for.cond26.preheader.preheader: ; preds = %for.cond.cleanup
%sub = add nsw i32 %3, -2
%12 = zext i32 %3 to i64
%wide.trip.count110 = zext i32 %sub to i64
br label %for.cond26.preheader
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%13 = load i8, ptr %arrayidx, align 2, !tbaa !9
%cmp2 = icmp eq i8 %13, 82
%cmp7 = icmp eq i8 %13, 71
%cond = select i1 %cmp7, i64 1, i64 2
%cond9 = select i1 %cmp2, i64 0, i64 %cond
%arrayidx11 = getelementptr inbounds [3 x i32], ptr %rgb, i64 0, i64 %cond9
%14 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%inc = add nsw i32 %14, 1
store i32 %inc, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.next
%15 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%cmp2.1 = icmp eq i8 %15, 82
%cmp7.1 = icmp eq i8 %15, 71
%cond.1 = select i1 %cmp7.1, i64 1, i64 2
%cond9.1 = select i1 %cmp2.1, i64 0, i64 %cond.1
%arrayidx11.1 = getelementptr inbounds [3 x i32], ptr %rgb, i64 0, i64 %cond9.1
%16 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%inc.1 = add nsw i32 %16, 1
store i32 %inc.1, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.unr-lcssa, label %for.body, !llvm.loop !10
for.cond26.preheader: ; preds = %for.cond26.preheader.preheader, %for.cond.cleanup30
%indvars.iv106 = phi i64 [ 0, %for.cond26.preheader.preheader ], [ %indvars.iv.next107, %for.cond.cleanup30 ]
%count.096 = phi i64 [ %11, %for.cond26.preheader.preheader ], [ %count.1.lcssa, %for.cond.cleanup30 ]
%17 = add nuw nsw i64 %indvars.iv106, 2
%cmp2890 = icmp ult i64 %17, %12
br i1 %cmp2890, label %for.body31.lr.ph, label %for.cond.cleanup30
for.body31.lr.ph: ; preds = %for.cond26.preheader
%arrayidx33 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv106
%18 = load i8, ptr %arrayidx33, align 1, !tbaa !9
%invariant.gep = getelementptr i8, ptr %vla, i64 %indvars.iv106
br label %for.body31
for.cond.cleanup24: ; preds = %for.cond.cleanup30, %entry, %for.cond.cleanup
%count.0.lcssa = phi i64 [ %11, %for.cond.cleanup ], [ 0, %entry ], [ %count.1.lcssa, %for.cond.cleanup30 ]
%call69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %rgb) #5
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
for.cond.cleanup30: ; preds = %for.inc63, %for.cond26.preheader
%count.1.lcssa = phi i64 [ %count.096, %for.cond26.preheader ], [ %count.2, %for.inc63 ]
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
%exitcond111.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count110
br i1 %exitcond111.not, label %for.cond.cleanup24, label %for.cond26.preheader, !llvm.loop !12
for.body31: ; preds = %for.body31.lr.ph, %for.inc63
%indvars.iv100 = phi i64 [ 1, %for.body31.lr.ph ], [ %indvars.iv.next101, %for.inc63 ]
%add93 = phi i64 [ %17, %for.body31.lr.ph ], [ %22, %for.inc63 ]
%count.191 = phi i64 [ %count.096, %for.body31.lr.ph ], [ %count.2, %for.inc63 ]
%gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv100
%19 = load i8, ptr %gep, align 1, !tbaa !9
%cmp39.not = icmp eq i8 %18, %19
br i1 %cmp39.not, label %for.inc63, label %land.lhs.true
land.lhs.true: ; preds = %for.body31
%idxprom46 = and i64 %add93, 4294967295
%arrayidx47 = getelementptr inbounds i8, ptr %vla, i64 %idxprom46
%20 = load i8, ptr %arrayidx47, align 1, !tbaa !9
%cmp49.not = icmp ne i8 %18, %20
%cmp61.not = icmp ne i8 %19, %20
%or.cond.not = and i1 %cmp49.not, %cmp61.not
%dec = sext i1 %or.cond.not to i64
%spec.select = add nsw i64 %count.191, %dec
br label %for.inc63
for.inc63: ; preds = %land.lhs.true, %for.body31
%count.2 = phi i64 [ %count.191, %for.body31 ], [ %spec.select, %land.lhs.true ]
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%21 = shl nuw nsw i64 %indvars.iv.next101, 1
%22 = add nuw nsw i64 %21, %indvars.iv106
%23 = trunc i64 %22 to i32
%cmp28 = icmp sgt i32 %3, %23
br i1 %cmp28, label %for.body31, label %for.cond.cleanup30, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
#include <stdio.h>
int readB(char S[4001], int i, int j, int N)
{
int k;
k = j + (j - i);
if(0 <= k && k < N)
{
if(S[k] == 'B')
return (1);
}
return (0);
}
int readR(char S[4001], int i, int j, int N)
{
int k;
k = j + (j - i);
if(0 <= k && k < N)
{
if(S[k] == 'R')
return (1);
}
return (0);
}
int readG(char S[4001], int i, int j, int N)
{
int k;
k = j + (j - i);
if(0 <= k && k < N)
{
if(S[k] == 'G')
return (1);
}
return (0);
}
long long readBG(char S[4001], int i, int N)
{
int j;
long long sum;
sum = 0;
for(j=i+1; j<N; j++)
{
if(S[j] == 'B')
sum += readG(S, i, j, N);
else if(S[j] == 'G')
sum += readB(S, i, j, N);
}
return (sum);
}
long long readRB(char S[4001], int i, int N)
{
int j;
long long sum;
sum = 0;
for(j=i+1; j<N; j++)
{
if(S[j] == 'R')
sum += readB(S, i, j, N);
else if(S[j] == 'B')
sum += readR(S, i, j, N);
}
return (sum);
}
long long readRG(char S[4001], int i, int N)
{
int j;
long long sum;
sum = 0;
for(j=i+1; j<N; j++)
{
if(S[j] == 'R')
sum += readG(S, i, j, N);
else if(S[j] == 'G')
sum += readR(S, i, j, N);
}
return (sum);
}
int main(void)
{
int N;
char S[4001];
int i;
long long sum;
long long R;
long long G;
long long B;
scanf("%d", &N);
scanf("%s", S);
R = 0;
G = 0;
B = 0;
sum = 0;
for(i=0; i<N; i++)
{
if(S[i] == 'R')
{
R++;
sum += readBG(S, i, N);
}
else if(S[i] == 'G')
{
G++;
sum += readRB(S, i, N);
}
else
{
B++;
sum += readRG(S, i, N);
}
}
printf("%lld", R * G * B - sum);
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232167/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232167/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @readB(ptr nocapture noundef readonly %S, i32 noundef %i, i32 noundef %j, i32 noundef %N) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %j, %i
%add = add nsw i32 %sub, %j
%cmp = icmp sgt i32 %add, -1
%cmp1 = icmp slt i32 %add, %N
%or.cond = and i1 %cmp, %cmp1
br i1 %or.cond, label %if.then, label %if.end5
if.then: ; preds = %entry
%idxprom = zext i32 %add to i64
%arrayidx = getelementptr inbounds i8, ptr %S, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp2 = icmp eq i8 %0, 66
br i1 %cmp2, label %cleanup, label %if.end5
if.end5: ; preds = %if.then, %entry
br label %cleanup
cleanup: ; preds = %if.then, %if.end5
%retval.0 = phi i32 [ 0, %if.end5 ], [ 1, %if.then ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @readR(ptr nocapture noundef readonly %S, i32 noundef %i, i32 noundef %j, i32 noundef %N) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %j, %i
%add = add nsw i32 %sub, %j
%cmp = icmp sgt i32 %add, -1
%cmp1 = icmp slt i32 %add, %N
%or.cond = and i1 %cmp, %cmp1
br i1 %or.cond, label %if.then, label %if.end5
if.then: ; preds = %entry
%idxprom = zext i32 %add to i64
%arrayidx = getelementptr inbounds i8, ptr %S, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp2 = icmp eq i8 %0, 82
br i1 %cmp2, label %cleanup, label %if.end5
if.end5: ; preds = %if.then, %entry
br label %cleanup
cleanup: ; preds = %if.then, %if.end5
%retval.0 = phi i32 [ 0, %if.end5 ], [ 1, %if.then ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @readG(ptr nocapture noundef readonly %S, i32 noundef %i, i32 noundef %j, i32 noundef %N) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %j, %i
%add = add nsw i32 %sub, %j
%cmp = icmp sgt i32 %add, -1
%cmp1 = icmp slt i32 %add, %N
%or.cond = and i1 %cmp, %cmp1
br i1 %or.cond, label %if.then, label %if.end5
if.then: ; preds = %entry
%idxprom = zext i32 %add to i64
%arrayidx = getelementptr inbounds i8, ptr %S, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp2 = icmp eq i8 %0, 71
br i1 %cmp2, label %cleanup, label %if.end5
if.end5: ; preds = %if.then, %entry
br label %cleanup
cleanup: ; preds = %if.then, %if.end5
%retval.0 = phi i32 [ 0, %if.end5 ], [ 1, %if.then ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @readBG(ptr nocapture noundef readonly %S, i32 noundef %i, i32 noundef %N) local_unnamed_addr #2 {
entry:
%j.040 = add nsw i32 %i, 1
%cmp41 = icmp slt i32 %j.040, %N
br i1 %cmp41, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %i to i64
%1 = add nsw i64 %0, 1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%sum.042 = phi i64 [ 0, %for.body.preheader ], [ %sum.1, %for.inc ]
%indvars46 = trunc i64 %indvars.iv to i32
%arrayidx = getelementptr inbounds i8, ptr %S, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %2, label %for.inc [
i8 66, label %if.then
i8 71, label %if.then10
]
if.then: ; preds = %for.body
%sub.i = sub nsw i32 %indvars46, %i
%add.i = add nsw i32 %sub.i, %indvars46
%cmp.i = icmp sgt i32 %add.i, -1
%cmp1.i = icmp slt i32 %add.i, %N
%or.cond.i = and i1 %cmp.i, %cmp1.i
br i1 %or.cond.i, label %if.then.i, label %if.end5.i
if.then.i: ; preds = %if.then
%idxprom.i = zext i32 %add.i to i64
%arrayidx.i = getelementptr inbounds i8, ptr %S, i64 %idxprom.i
%3 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp2.i = icmp eq i8 %3, 71
br i1 %cmp2.i, label %readG.exit, label %if.end5.i
if.end5.i: ; preds = %if.then.i, %if.then
br label %readG.exit
readG.exit: ; preds = %if.then.i, %if.end5.i
%retval.0.i = phi i64 [ 0, %if.end5.i ], [ 1, %if.then.i ]
%add4 = add nsw i64 %retval.0.i, %sum.042
br label %for.inc
if.then10: ; preds = %for.body
%sub.i29 = sub nsw i32 %indvars46, %i
%add.i30 = add nsw i32 %sub.i29, %indvars46
%cmp.i31 = icmp sgt i32 %add.i30, -1
%cmp1.i32 = icmp slt i32 %add.i30, %N
%or.cond.i33 = and i1 %cmp.i31, %cmp1.i32
br i1 %or.cond.i33, label %if.then.i36, label %if.end5.i34
if.then.i36: ; preds = %if.then10
%idxprom.i37 = zext i32 %add.i30 to i64
%arrayidx.i38 = getelementptr inbounds i8, ptr %S, i64 %idxprom.i37
%4 = load i8, ptr %arrayidx.i38, align 1, !tbaa !5
%cmp2.i39 = icmp eq i8 %4, 66
br i1 %cmp2.i39, label %readB.exit, label %if.end5.i34
if.end5.i34: ; preds = %if.then.i36, %if.then10
br label %readB.exit
readB.exit: ; preds = %if.then.i36, %if.end5.i34
%retval.0.i35 = phi i64 [ 0, %if.end5.i34 ], [ 1, %if.then.i36 ]
%add13 = add nsw i64 %retval.0.i35, %sum.042
br label %for.inc
for.inc: ; preds = %for.body, %readG.exit, %readB.exit
%sum.1 = phi i64 [ %add4, %readG.exit ], [ %add13, %readB.exit ], [ %sum.042, %for.body ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %lftr.wideiv, %N
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.inc, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %sum.1, %for.inc ]
ret i64 %sum.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @readRB(ptr nocapture noundef readonly %S, i32 noundef %i, i32 noundef %N) local_unnamed_addr #2 {
entry:
%j.040 = add nsw i32 %i, 1
%cmp41 = icmp slt i32 %j.040, %N
br i1 %cmp41, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %i to i64
%1 = add nsw i64 %0, 1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%sum.042 = phi i64 [ 0, %for.body.preheader ], [ %sum.1, %for.inc ]
%indvars46 = trunc i64 %indvars.iv to i32
%arrayidx = getelementptr inbounds i8, ptr %S, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %2, label %for.inc [
i8 82, label %if.then
i8 66, label %if.then10
]
if.then: ; preds = %for.body
%sub.i = sub nsw i32 %indvars46, %i
%add.i = add nsw i32 %sub.i, %indvars46
%cmp.i = icmp sgt i32 %add.i, -1
%cmp1.i = icmp slt i32 %add.i, %N
%or.cond.i = and i1 %cmp.i, %cmp1.i
br i1 %or.cond.i, label %if.then.i, label %if.end5.i
if.then.i: ; preds = %if.then
%idxprom.i = zext i32 %add.i to i64
%arrayidx.i = getelementptr inbounds i8, ptr %S, i64 %idxprom.i
%3 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp2.i = icmp eq i8 %3, 66
br i1 %cmp2.i, label %readB.exit, label %if.end5.i
if.end5.i: ; preds = %if.then.i, %if.then
br label %readB.exit
readB.exit: ; preds = %if.then.i, %if.end5.i
%retval.0.i = phi i64 [ 0, %if.end5.i ], [ 1, %if.then.i ]
%add4 = add nsw i64 %retval.0.i, %sum.042
br label %for.inc
if.then10: ; preds = %for.body
%sub.i29 = sub nsw i32 %indvars46, %i
%add.i30 = add nsw i32 %sub.i29, %indvars46
%cmp.i31 = icmp sgt i32 %add.i30, -1
%cmp1.i32 = icmp slt i32 %add.i30, %N
%or.cond.i33 = and i1 %cmp.i31, %cmp1.i32
br i1 %or.cond.i33, label %if.then.i36, label %if.end5.i34
if.then.i36: ; preds = %if.then10
%idxprom.i37 = zext i32 %add.i30 to i64
%arrayidx.i38 = getelementptr inbounds i8, ptr %S, i64 %idxprom.i37
%4 = load i8, ptr %arrayidx.i38, align 1, !tbaa !5
%cmp2.i39 = icmp eq i8 %4, 82
br i1 %cmp2.i39, label %readR.exit, label %if.end5.i34
if.end5.i34: ; preds = %if.then.i36, %if.then10
br label %readR.exit
readR.exit: ; preds = %if.then.i36, %if.end5.i34
%retval.0.i35 = phi i64 [ 0, %if.end5.i34 ], [ 1, %if.then.i36 ]
%add13 = add nsw i64 %retval.0.i35, %sum.042
br label %for.inc
for.inc: ; preds = %for.body, %readB.exit, %readR.exit
%sum.1 = phi i64 [ %add4, %readB.exit ], [ %add13, %readR.exit ], [ %sum.042, %for.body ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %lftr.wideiv, %N
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.inc, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %sum.1, %for.inc ]
ret i64 %sum.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @readRG(ptr nocapture noundef readonly %S, i32 noundef %i, i32 noundef %N) local_unnamed_addr #2 {
entry:
%j.040 = add nsw i32 %i, 1
%cmp41 = icmp slt i32 %j.040, %N
br i1 %cmp41, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %i to i64
%1 = add nsw i64 %0, 1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%sum.042 = phi i64 [ 0, %for.body.preheader ], [ %sum.1, %for.inc ]
%indvars46 = trunc i64 %indvars.iv to i32
%arrayidx = getelementptr inbounds i8, ptr %S, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %2, label %for.inc [
i8 82, label %if.then
i8 71, label %if.then10
]
if.then: ; preds = %for.body
%sub.i = sub nsw i32 %indvars46, %i
%add.i = add nsw i32 %sub.i, %indvars46
%cmp.i = icmp sgt i32 %add.i, -1
%cmp1.i = icmp slt i32 %add.i, %N
%or.cond.i = and i1 %cmp.i, %cmp1.i
br i1 %or.cond.i, label %if.then.i, label %if.end5.i
if.then.i: ; preds = %if.then
%idxprom.i = zext i32 %add.i to i64
%arrayidx.i = getelementptr inbounds i8, ptr %S, i64 %idxprom.i
%3 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp2.i = icmp eq i8 %3, 71
br i1 %cmp2.i, label %readG.exit, label %if.end5.i
if.end5.i: ; preds = %if.then.i, %if.then
br label %readG.exit
readG.exit: ; preds = %if.then.i, %if.end5.i
%retval.0.i = phi i64 [ 0, %if.end5.i ], [ 1, %if.then.i ]
%add4 = add nsw i64 %retval.0.i, %sum.042
br label %for.inc
if.then10: ; preds = %for.body
%sub.i29 = sub nsw i32 %indvars46, %i
%add.i30 = add nsw i32 %sub.i29, %indvars46
%cmp.i31 = icmp sgt i32 %add.i30, -1
%cmp1.i32 = icmp slt i32 %add.i30, %N
%or.cond.i33 = and i1 %cmp.i31, %cmp1.i32
br i1 %or.cond.i33, label %if.then.i36, label %if.end5.i34
if.then.i36: ; preds = %if.then10
%idxprom.i37 = zext i32 %add.i30 to i64
%arrayidx.i38 = getelementptr inbounds i8, ptr %S, i64 %idxprom.i37
%4 = load i8, ptr %arrayidx.i38, align 1, !tbaa !5
%cmp2.i39 = icmp eq i8 %4, 82
br i1 %cmp2.i39, label %readR.exit, label %if.end5.i34
if.end5.i34: ; preds = %if.then.i36, %if.then10
br label %readR.exit
readR.exit: ; preds = %if.then.i36, %if.end5.i34
%retval.0.i35 = phi i64 [ 0, %if.end5.i34 ], [ 1, %if.then.i36 ]
%add13 = add nsw i64 %retval.0.i35, %sum.042
br label %for.inc
for.inc: ; preds = %for.body, %readG.exit, %readR.exit
%sum.1 = phi i64 [ %add4, %readG.exit ], [ %add13, %readR.exit ], [ %sum.042, %for.body ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %lftr.wideiv, %N
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %sum.1, %for.inc ]
ret i64 %sum.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
%S = alloca [4001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4001, ptr nonnull %S) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i32, ptr %N, align 4, !tbaa !12
%cmp124 = icmp sgt i32 %0, 0
br i1 %cmp124, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %3, %for.inc ]
%B.0129 = phi i64 [ 0, %for.body.preheader ], [ %B.1, %for.inc ]
%G.0128 = phi i64 [ 0, %for.body.preheader ], [ %G.1, %for.inc ]
%R.0127 = phi i64 [ 0, %for.body.preheader ], [ %R.1, %for.inc ]
%sum.0126 = phi i64 [ 0, %for.body.preheader ], [ %sum.1, %for.inc ]
%arrayidx = getelementptr inbounds [4001 x i8], ptr %S, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%3 = add nuw nsw i64 %indvars.iv, 1
%cmp41.i79 = icmp ult i64 %3, %1
switch i8 %2, label %if.else16 [
i8 82, label %if.then
i8 71, label %if.then11
]
if.then: ; preds = %for.body
%inc = add nsw i64 %R.0127, 1
br i1 %cmp41.i79, label %for.body.preheader.i, label %for.inc
for.body.preheader.i: ; preds = %if.then
%4 = trunc i64 %indvars.iv to i32
%5 = trunc i64 %indvars.iv to i32
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ %3, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%sum.042.i = phi i64 [ 0, %for.body.preheader.i ], [ %sum.1.i, %for.inc.i ]
%indvars46.i = trunc i64 %indvars.iv.i to i32
%arrayidx.i = getelementptr inbounds i8, ptr %S, i64 %indvars.iv.i
%6 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
switch i8 %6, label %for.inc.i [
i8 66, label %if.then.i
i8 71, label %if.then10.i
]
if.then.i: ; preds = %for.body.i
%sub.i.i = sub nsw i32 %indvars46.i, %5
%add.i.i = add nsw i32 %sub.i.i, %indvars46.i
%cmp.i.i = icmp sgt i32 %add.i.i, -1
%cmp1.i.i = icmp slt i32 %add.i.i, %0
%or.cond.i.i = and i1 %cmp.i.i, %cmp1.i.i
br i1 %or.cond.i.i, label %if.then.i.i, label %if.end5.i.i
if.then.i.i: ; preds = %if.then.i
%idxprom.i.i = zext i32 %add.i.i to i64
%arrayidx.i.i = getelementptr inbounds i8, ptr %S, i64 %idxprom.i.i
%7 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !5
%cmp2.i.i = icmp eq i8 %7, 71
br i1 %cmp2.i.i, label %readG.exit.i, label %if.end5.i.i
if.end5.i.i: ; preds = %if.then.i.i, %if.then.i
br label %readG.exit.i
readG.exit.i: ; preds = %if.end5.i.i, %if.then.i.i
%retval.0.i.i = phi i64 [ 0, %if.end5.i.i ], [ 1, %if.then.i.i ]
%add4.i = add nsw i64 %retval.0.i.i, %sum.042.i
br label %for.inc.i
if.then10.i: ; preds = %for.body.i
%sub.i29.i = sub nsw i32 %indvars46.i, %4
%add.i30.i = add nsw i32 %sub.i29.i, %indvars46.i
%cmp.i31.i = icmp sgt i32 %add.i30.i, -1
%cmp1.i32.i = icmp slt i32 %add.i30.i, %0
%or.cond.i33.i = and i1 %cmp.i31.i, %cmp1.i32.i
br i1 %or.cond.i33.i, label %if.then.i36.i, label %if.end5.i34.i
if.then.i36.i: ; preds = %if.then10.i
%idxprom.i37.i = zext i32 %add.i30.i to i64
%arrayidx.i38.i = getelementptr inbounds i8, ptr %S, i64 %idxprom.i37.i
%8 = load i8, ptr %arrayidx.i38.i, align 1, !tbaa !5
%cmp2.i39.i = icmp eq i8 %8, 66
br i1 %cmp2.i39.i, label %readB.exit.i, label %if.end5.i34.i
if.end5.i34.i: ; preds = %if.then.i36.i, %if.then10.i
br label %readB.exit.i
readB.exit.i: ; preds = %if.end5.i34.i, %if.then.i36.i
%retval.0.i35.i = phi i64 [ 0, %if.end5.i34.i ], [ 1, %if.then.i36.i ]
%add13.i = add nsw i64 %retval.0.i35.i, %sum.042.i
br label %for.inc.i
for.inc.i: ; preds = %readB.exit.i, %readG.exit.i, %for.body.i
%sum.1.i = phi i64 [ %add4.i, %readG.exit.i ], [ %add13.i, %readB.exit.i ], [ %sum.042.i, %for.body.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%lftr.wideiv135 = trunc i64 %indvars.iv.next.i to i32
%exitcond136 = icmp eq i32 %0, %lftr.wideiv135
br i1 %exitcond136, label %for.inc, label %for.body.i, !llvm.loop !8
if.then11: ; preds = %for.body
%inc12 = add nsw i64 %G.0128, 1
br i1 %cmp41.i79, label %for.body.preheader.i40, label %for.inc
for.body.preheader.i40: ; preds = %if.then11
%9 = trunc i64 %indvars.iv to i32
%10 = trunc i64 %indvars.iv to i32
br label %for.body.i41
for.body.i41: ; preds = %for.inc.i55, %for.body.preheader.i40
%indvars.iv.i42 = phi i64 [ %3, %for.body.preheader.i40 ], [ %indvars.iv.next.i57, %for.inc.i55 ]
%sum.042.i43 = phi i64 [ 0, %for.body.preheader.i40 ], [ %sum.1.i56, %for.inc.i55 ]
%indvars46.i44 = trunc i64 %indvars.iv.i42 to i32
%arrayidx.i45 = getelementptr inbounds i8, ptr %S, i64 %indvars.iv.i42
%11 = load i8, ptr %arrayidx.i45, align 1, !tbaa !5
switch i8 %11, label %for.inc.i55 [
i8 82, label %if.then.i64
i8 66, label %if.then10.i46
]
if.then.i64: ; preds = %for.body.i41
%sub.i.i65 = sub nsw i32 %indvars46.i44, %10
%add.i.i66 = add nsw i32 %sub.i.i65, %indvars46.i44
%cmp.i.i67 = icmp sgt i32 %add.i.i66, -1
%cmp1.i.i68 = icmp slt i32 %add.i.i66, %0
%or.cond.i.i69 = and i1 %cmp.i.i67, %cmp1.i.i68
br i1 %or.cond.i.i69, label %if.then.i.i74, label %if.end5.i.i70
if.then.i.i74: ; preds = %if.then.i64
%idxprom.i.i75 = zext i32 %add.i.i66 to i64
%arrayidx.i.i76 = getelementptr inbounds i8, ptr %S, i64 %idxprom.i.i75
%12 = load i8, ptr %arrayidx.i.i76, align 1, !tbaa !5
%cmp2.i.i77 = icmp eq i8 %12, 66
br i1 %cmp2.i.i77, label %readB.exit.i71, label %if.end5.i.i70
if.end5.i.i70: ; preds = %if.then.i.i74, %if.then.i64
br label %readB.exit.i71
readB.exit.i71: ; preds = %if.end5.i.i70, %if.then.i.i74
%retval.0.i.i72 = phi i64 [ 0, %if.end5.i.i70 ], [ 1, %if.then.i.i74 ]
%add4.i73 = add nsw i64 %retval.0.i.i72, %sum.042.i43
br label %for.inc.i55
if.then10.i46: ; preds = %for.body.i41
%sub.i29.i47 = sub nsw i32 %indvars46.i44, %9
%add.i30.i48 = add nsw i32 %sub.i29.i47, %indvars46.i44
%cmp.i31.i49 = icmp sgt i32 %add.i30.i48, -1
%cmp1.i32.i50 = icmp slt i32 %add.i30.i48, %0
%or.cond.i33.i51 = and i1 %cmp.i31.i49, %cmp1.i32.i50
br i1 %or.cond.i33.i51, label %if.then.i36.i60, label %if.end5.i34.i52
if.then.i36.i60: ; preds = %if.then10.i46
%idxprom.i37.i61 = zext i32 %add.i30.i48 to i64
%arrayidx.i38.i62 = getelementptr inbounds i8, ptr %S, i64 %idxprom.i37.i61
%13 = load i8, ptr %arrayidx.i38.i62, align 1, !tbaa !5
%cmp2.i39.i63 = icmp eq i8 %13, 82
br i1 %cmp2.i39.i63, label %readR.exit.i, label %if.end5.i34.i52
if.end5.i34.i52: ; preds = %if.then.i36.i60, %if.then10.i46
br label %readR.exit.i
readR.exit.i: ; preds = %if.end5.i34.i52, %if.then.i36.i60
%retval.0.i35.i53 = phi i64 [ 0, %if.end5.i34.i52 ], [ 1, %if.then.i36.i60 ]
%add13.i54 = add nsw i64 %retval.0.i35.i53, %sum.042.i43
br label %for.inc.i55
for.inc.i55: ; preds = %readR.exit.i, %readB.exit.i71, %for.body.i41
%sum.1.i56 = phi i64 [ %add4.i73, %readB.exit.i71 ], [ %add13.i54, %readR.exit.i ], [ %sum.042.i43, %for.body.i41 ]
%indvars.iv.next.i57 = add nuw nsw i64 %indvars.iv.i42, 1
%lftr.wideiv = trunc i64 %indvars.iv.next.i57 to i32
%exitcond = icmp eq i32 %0, %lftr.wideiv
br i1 %exitcond, label %for.inc, label %for.body.i41, !llvm.loop !10
if.else16: ; preds = %for.body
%inc17 = add nsw i64 %B.0129, 1
br i1 %cmp41.i79, label %for.body.preheader.i81, label %for.inc
for.body.preheader.i81: ; preds = %if.else16
%14 = trunc i64 %indvars.iv to i32
%15 = trunc i64 %indvars.iv to i32
br label %for.body.i82
for.body.i82: ; preds = %for.inc.i97, %for.body.preheader.i81
%indvars.iv.i83 = phi i64 [ %3, %for.body.preheader.i81 ], [ %indvars.iv.next.i99, %for.inc.i97 ]
%sum.042.i84 = phi i64 [ 0, %for.body.preheader.i81 ], [ %sum.1.i98, %for.inc.i97 ]
%indvars46.i85 = trunc i64 %indvars.iv.i83 to i32
%arrayidx.i86 = getelementptr inbounds i8, ptr %S, i64 %indvars.iv.i83
%16 = load i8, ptr %arrayidx.i86, align 1, !tbaa !5
switch i8 %16, label %for.inc.i97 [
i8 82, label %if.then.i106
i8 71, label %if.then10.i87
]
if.then.i106: ; preds = %for.body.i82
%sub.i.i107 = sub nsw i32 %indvars46.i85, %15
%add.i.i108 = add nsw i32 %sub.i.i107, %indvars46.i85
%cmp.i.i109 = icmp sgt i32 %add.i.i108, -1
%cmp1.i.i110 = icmp slt i32 %add.i.i108, %0
%or.cond.i.i111 = and i1 %cmp.i.i109, %cmp1.i.i110
br i1 %or.cond.i.i111, label %if.then.i.i116, label %if.end5.i.i112
if.then.i.i116: ; preds = %if.then.i106
%idxprom.i.i117 = zext i32 %add.i.i108 to i64
%arrayidx.i.i118 = getelementptr inbounds i8, ptr %S, i64 %idxprom.i.i117
%17 = load i8, ptr %arrayidx.i.i118, align 1, !tbaa !5
%cmp2.i.i119 = icmp eq i8 %17, 71
br i1 %cmp2.i.i119, label %readG.exit.i113, label %if.end5.i.i112
if.end5.i.i112: ; preds = %if.then.i.i116, %if.then.i106
br label %readG.exit.i113
readG.exit.i113: ; preds = %if.end5.i.i112, %if.then.i.i116
%retval.0.i.i114 = phi i64 [ 0, %if.end5.i.i112 ], [ 1, %if.then.i.i116 ]
%add4.i115 = add nsw i64 %retval.0.i.i114, %sum.042.i84
br label %for.inc.i97
if.then10.i87: ; preds = %for.body.i82
%sub.i29.i88 = sub nsw i32 %indvars46.i85, %14
%add.i30.i89 = add nsw i32 %sub.i29.i88, %indvars46.i85
%cmp.i31.i90 = icmp sgt i32 %add.i30.i89, -1
%cmp1.i32.i91 = icmp slt i32 %add.i30.i89, %0
%or.cond.i33.i92 = and i1 %cmp.i31.i90, %cmp1.i32.i91
br i1 %or.cond.i33.i92, label %if.then.i36.i102, label %if.end5.i34.i93
if.then.i36.i102: ; preds = %if.then10.i87
%idxprom.i37.i103 = zext i32 %add.i30.i89 to i64
%arrayidx.i38.i104 = getelementptr inbounds i8, ptr %S, i64 %idxprom.i37.i103
%18 = load i8, ptr %arrayidx.i38.i104, align 1, !tbaa !5
%cmp2.i39.i105 = icmp eq i8 %18, 82
br i1 %cmp2.i39.i105, label %readR.exit.i94, label %if.end5.i34.i93
if.end5.i34.i93: ; preds = %if.then.i36.i102, %if.then10.i87
br label %readR.exit.i94
readR.exit.i94: ; preds = %if.end5.i34.i93, %if.then.i36.i102
%retval.0.i35.i95 = phi i64 [ 0, %if.end5.i34.i93 ], [ 1, %if.then.i36.i102 ]
%add13.i96 = add nsw i64 %retval.0.i35.i95, %sum.042.i84
br label %for.inc.i97
for.inc.i97: ; preds = %readR.exit.i94, %readG.exit.i113, %for.body.i82
%sum.1.i98 = phi i64 [ %add4.i115, %readG.exit.i113 ], [ %add13.i96, %readR.exit.i94 ], [ %sum.042.i84, %for.body.i82 ]
%indvars.iv.next.i99 = add nuw nsw i64 %indvars.iv.i83, 1
%lftr.wideiv137 = trunc i64 %indvars.iv.next.i99 to i32
%exitcond138 = icmp eq i32 %0, %lftr.wideiv137
br i1 %exitcond138, label %for.inc, label %for.body.i82, !llvm.loop !11
for.inc: ; preds = %for.inc.i55, %for.inc.i, %for.inc.i97, %if.else16, %if.then11, %if.then
%call5.pn = phi i64 [ 0, %if.else16 ], [ 0, %if.then11 ], [ 0, %if.then ], [ %sum.1.i98, %for.inc.i97 ], [ %sum.1.i, %for.inc.i ], [ %sum.1.i56, %for.inc.i55 ]
%R.1 = phi i64 [ %R.0127, %if.else16 ], [ %R.0127, %if.then11 ], [ %inc, %if.then ], [ %R.0127, %for.inc.i97 ], [ %inc, %for.inc.i ], [ %R.0127, %for.inc.i55 ]
%G.1 = phi i64 [ %G.0128, %if.else16 ], [ %inc12, %if.then11 ], [ %G.0128, %if.then ], [ %G.0128, %for.inc.i97 ], [ %G.0128, %for.inc.i ], [ %inc12, %for.inc.i55 ]
%B.1 = phi i64 [ %inc17, %if.else16 ], [ %B.0129, %if.then11 ], [ %B.0129, %if.then ], [ %inc17, %for.inc.i97 ], [ %B.0129, %for.inc.i ], [ %B.0129, %for.inc.i55 ]
%sum.1 = add nsw i64 %call5.pn, %sum.0126
%exitcond146.not = icmp eq i64 %3, %wide.trip.count
br i1 %exitcond146.not, label %for.end.loopexit, label %for.body, !llvm.loop !14
for.end.loopexit: ; preds = %for.inc
%19 = mul nsw i64 %G.1, %R.1
%20 = mul nsw i64 %19, %B.1
%21 = sub nsw i64 %20, %sum.1
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%sub = phi i64 [ 0, %entry ], [ %21, %for.end.loopexit ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4001, ptr nonnull %S) #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 = { 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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
int main()
{
int n,i,a;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
if(360%(180-a)==0)printf("YES\n");
else printf("NO\n");
}
// scanf("%d",&n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23221/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23221/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, 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
%i.08 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 180, %1
%rem = srem i32 360, %sub
%cmp2 = icmp eq i32 %rem, 0
%str.3.str = select i1 %cmp2, ptr @str.3, ptr @str
%puts6 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
%inc = add nuw nsw i32 %i.08, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.08, %2
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 %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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>
struct t{
int p,s; //??£?§£??°
int lank;
};
int main(void){
struct t team[100];
int lank[100];
int ti=1,li=1,j,k;
scanf("%d,%d",&team[0].p,&team[0].s);
team[0].lank=1;
lank[0]=team[0].s;
//printf("%d %d %d\n",team[0].p,team[0].s,team[0].lank);
while(scanf("%d,%d",&team[ti].p,&team[ti].s)){
if(team[ti].p==0&&team[ti].s==0) break;
else{
//???????¢????
for(j=0;j<li;j++){
if(lank[j]<team[ti].s){
//printf("a\n");
for(k=li;k>j;k--){
lank[k]=lank[k-1];
}
lank[j]=team[ti].s;
li++;
team[ti].lank=j+1;
for(k=0;k<ti;k++){
if(j+1<=team[k].lank) team[k].lank++;
}
break;
}else if(lank[j]==team[ti].s){
//printf("b\n");
team[ti].lank=j+1;
break;
}else if(j==li-1){
//printf("last\n");
lank[j+1]=team[ti].s;
li++;
team[ti].lank=j+2;
break;
}
}
ti++;
/*??¨??¨????????????
printf("team:%d lank:%d\n",ti,li);
for(j=0;j<ti;j++){
printf("/team[%d]\n",j);
printf("p=%d s=%d lank=%d\n",team[j].p,team[j].s,team[j].lank);
}
for(j=0;j<li;j++){
printf("%d???:%d\n",j+1,lank[j]);
}
*/
}
}
int q;
while(scanf("%d",&q)!=EOF){
for(j=0;j<ti;j++){
if(q==team[j].p){
printf("%d\n",team[j].lank);
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232260/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232260/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.t = type { i32, i32, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%team = alloca [100 x %struct.t], align 16
%lank = alloca [100 x i32], align 16
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %team) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %lank) #3
%s = getelementptr inbounds %struct.t, ptr %team, i64 0, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %team, ptr noundef nonnull %s)
%lank3 = getelementptr inbounds %struct.t, ptr %team, i64 0, i32 2
store i32 1, ptr %lank3, align 8, !tbaa !5
%0 = load i32, ptr %s, align 4, !tbaa !10
store i32 %0, ptr %lank, align 16, !tbaa !11
%arrayidx7169 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 1
%s11170 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 1, i32 1
%call12171 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7169, ptr noundef nonnull %s11170)
%tobool.not172 = icmp eq i32 %call12171, 0
br i1 %tobool.not172, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end91
%indvar = phi i64 [ %indvar.next, %for.end91 ], [ 0, %entry ]
%indvars.iv205 = phi i64 [ %indvars.iv.next206, %for.end91 ], [ 1, %entry ]
%s11178 = phi ptr [ %s11, %for.end91 ], [ %s11170, %entry ]
%arrayidx7177 = phi ptr [ %arrayidx7, %for.end91 ], [ %arrayidx7169, %entry ]
%li.0175 = phi i32 [ %li.1, %for.end91 ], [ 1, %entry ]
%1 = load i32, ptr %arrayidx7177, align 4, !tbaa !12
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %while.body
%2 = load i32, ptr %s11178, align 4, !tbaa !10
%cmp19 = icmp eq i32 %2, 0
br i1 %cmp19, label %while.end.loopexit, label %if.else
if.else: ; preds = %land.lhs.true, %while.body
%cmp20164 = icmp sgt i32 %li.0175, 0
br i1 %cmp20164, label %for.body.lr.ph, label %for.end91
for.body.lr.ph: ; preds = %if.else
%3 = load i32, ptr %s11178, align 4, !tbaa !10
%sub72 = add nsw i32 %li.0175, -1
%4 = zext i32 %sub72 to i64
%5 = load i32, ptr %lank, align 16, !tbaa !11
%cmp26222 = icmp slt i32 %5, %3
br i1 %cmp26222, label %for.cond28.preheader, label %if.else59
for.cond28.preheader: ; preds = %for.inc89, %for.body.lr.ph
%indvars.iv.lcssa = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc89 ]
%arrayidx22.le = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.lcssa
%6 = trunc i64 %indvars.iv.lcssa to i32
%cmp29166 = icmp sgt i32 %li.0175, %6
br i1 %cmp29166, label %for.body30.preheader, label %for.end
for.body30.preheader: ; preds = %for.cond28.preheader
%7 = sext i32 %li.0175 to i64
%sext = shl i64 %indvars.iv.lcssa, 32
%8 = ashr exact i64 %sext, 32
%9 = sub i64 %7, %indvars.iv.lcssa
%10 = xor i64 %indvars.iv.lcssa, -1
%11 = add i64 %10, %7
%xtraiter = and i64 %9, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body30.prol.loopexit, label %for.body30.prol
for.body30.prol: ; preds = %for.body30.preheader, %for.body30.prol
%indvars.iv199.prol = phi i64 [ %indvars.iv.next200.prol, %for.body30.prol ], [ %7, %for.body30.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body30.prol ], [ 0, %for.body30.preheader ]
%indvars.iv.next200.prol = add nsw i64 %indvars.iv199.prol, -1
%arrayidx32.prol = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next200.prol
%12 = load i32, ptr %arrayidx32.prol, align 4, !tbaa !11
%arrayidx34.prol = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv199.prol
store i32 %12, ptr %arrayidx34.prol, align 4, !tbaa !11
%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.body30.prol.loopexit, label %for.body30.prol, !llvm.loop !13
for.body30.prol.loopexit: ; preds = %for.body30.prol, %for.body30.preheader
%indvars.iv199.unr = phi i64 [ %7, %for.body30.preheader ], [ %indvars.iv.next200.prol, %for.body30.prol ]
%13 = icmp ult i64 %11, 3
br i1 %13, label %for.end, label %for.body30
for.body30: ; preds = %for.body30.prol.loopexit, %for.body30
%indvars.iv199 = phi i64 [ %indvars.iv.next200.3, %for.body30 ], [ %indvars.iv199.unr, %for.body30.prol.loopexit ]
%indvars.iv.next200 = add nsw i64 %indvars.iv199, -1
%arrayidx32 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next200
%14 = load i32, ptr %arrayidx32, align 4, !tbaa !11
%arrayidx34 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv199
store i32 %14, ptr %arrayidx34, align 4, !tbaa !11
%indvars.iv.next200.1 = add nsw i64 %indvars.iv199, -2
%arrayidx32.1 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next200.1
%15 = load i32, ptr %arrayidx32.1, align 4, !tbaa !11
%arrayidx34.1 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next200
store i32 %15, ptr %arrayidx34.1, align 4, !tbaa !11
%indvars.iv.next200.2 = add nsw i64 %indvars.iv199, -3
%arrayidx32.2 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next200.2
%16 = load i32, ptr %arrayidx32.2, align 4, !tbaa !11
%arrayidx34.2 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next200.1
store i32 %16, ptr %arrayidx34.2, align 4, !tbaa !11
%indvars.iv.next200.3 = add nsw i64 %indvars.iv199, -4
%arrayidx32.3 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next200.3
%17 = load i32, ptr %arrayidx32.3, align 4, !tbaa !11
%arrayidx34.3 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next200.2
store i32 %17, ptr %arrayidx34.3, align 4, !tbaa !11
%cmp29.3 = icmp sgt i64 %indvars.iv.next200.3, %8
br i1 %cmp29.3, label %for.body30, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body30.prol.loopexit, %for.body30, %for.cond28.preheader
store i32 %3, ptr %arrayidx22.le, align 4, !tbaa !11
%add = add nuw nsw i32 %6, 1
%lank42 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv205, i32 2
store i32 %add, ptr %lank42, align 4, !tbaa !5
%xtraiter227 = and i64 %indvars.iv205, 1
%18 = icmp eq i64 %indvar, 0
br i1 %18, label %for.end91.loopexit.unr-lcssa, label %for.end.new
for.end.new: ; preds = %for.end
%unroll_iter = and i64 %indvars.iv205, -2
br label %for.body45
for.body45: ; preds = %for.inc56.1, %for.end.new
%indvars.iv202 = phi i64 [ 0, %for.end.new ], [ %indvars.iv.next203.1, %for.inc56.1 ]
%niter = phi i64 [ 0, %for.end.new ], [ %niter.next.1, %for.inc56.1 ]
%lank49 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv202, i32 2
%19 = load i32, ptr %lank49, align 8, !tbaa !5
%cmp50.not.not = icmp sgt i32 %19, %6
br i1 %cmp50.not.not, label %if.then51, label %for.inc56
if.then51: ; preds = %for.body45
%inc55 = add nsw i32 %19, 1
store i32 %inc55, ptr %lank49, align 8, !tbaa !5
br label %for.inc56
for.inc56: ; preds = %for.body45, %if.then51
%indvars.iv.next203 = or i64 %indvars.iv202, 1
%lank49.1 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv.next203, i32 2
%20 = load i32, ptr %lank49.1, align 4, !tbaa !5
%cmp50.not.not.1 = icmp sgt i32 %20, %6
br i1 %cmp50.not.not.1, label %if.then51.1, label %for.inc56.1
if.then51.1: ; preds = %for.inc56
%inc55.1 = add nsw i32 %20, 1
store i32 %inc55.1, ptr %lank49.1, align 4, !tbaa !5
br label %for.inc56.1
for.inc56.1: ; preds = %if.then51.1, %for.inc56
%indvars.iv.next203.1 = add nuw nsw i64 %indvars.iv202, 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.end91.loopexit.unr-lcssa, label %for.body45, !llvm.loop !17
if.else59: ; preds = %for.body.lr.ph, %for.inc89
%21 = phi i32 [ %23, %for.inc89 ], [ %5, %for.body.lr.ph ]
%indvars.iv223 = phi i64 [ %indvars.iv.next, %for.inc89 ], [ 0, %for.body.lr.ph ]
%cmp65 = icmp eq i32 %21, %3
br i1 %cmp65, label %if.then66, label %if.else71
if.then66: ; preds = %if.else59
%22 = trunc i64 %indvars.iv223 to i32
%add67 = add nuw nsw i32 %22, 1
%lank70 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv205, i32 2
store i32 %add67, ptr %lank70, align 4, !tbaa !5
br label %for.end91
if.else71: ; preds = %if.else59
%cmp73 = icmp eq i64 %indvars.iv223, %4
br i1 %cmp73, label %if.then74, label %for.inc89
if.then74: ; preds = %if.else71
%idxprom79 = zext i32 %li.0175 to i64
%arrayidx80 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %idxprom79
store i32 %3, ptr %arrayidx80, align 4, !tbaa !11
%inc81 = add nuw nsw i32 %li.0175, 1
%add82 = add nsw i32 %li.0175, 1
%lank85 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv205, i32 2
store i32 %add82, ptr %lank85, align 4, !tbaa !5
br label %for.end91
for.inc89: ; preds = %if.else71
%indvars.iv.next = add nuw nsw i64 %indvars.iv223, 1
%arrayidx22 = getelementptr inbounds [100 x i32], ptr %lank, i64 0, i64 %indvars.iv.next
%23 = load i32, ptr %arrayidx22, align 4, !tbaa !11
%cmp26 = icmp slt i32 %23, %3
br i1 %cmp26, label %for.cond28.preheader, label %if.else59
for.end91.loopexit.unr-lcssa: ; preds = %for.inc56.1, %for.end
%indvars.iv202.unr = phi i64 [ 0, %for.end ], [ %indvars.iv.next203.1, %for.inc56.1 ]
%lcmp.mod228.not = icmp eq i64 %xtraiter227, 0
br i1 %lcmp.mod228.not, label %for.end91.loopexit, label %for.body45.epil
for.body45.epil: ; preds = %for.end91.loopexit.unr-lcssa
%lank49.epil = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv202.unr, i32 2
%24 = load i32, ptr %lank49.epil, align 4, !tbaa !5
%cmp50.not.not.epil = icmp sgt i32 %24, %6
br i1 %cmp50.not.not.epil, label %if.then51.epil, label %for.end91.loopexit
if.then51.epil: ; preds = %for.body45.epil
%inc55.epil = add nsw i32 %24, 1
store i32 %inc55.epil, ptr %lank49.epil, align 4, !tbaa !5
br label %for.end91.loopexit
for.end91.loopexit: ; preds = %for.body45.epil, %if.then51.epil, %for.end91.loopexit.unr-lcssa
%inc = add nsw i32 %li.0175, 1
br label %for.end91
for.end91: ; preds = %for.end91.loopexit, %if.else, %if.then74, %if.then66
%li.1 = phi i32 [ %li.0175, %if.then66 ], [ %inc81, %if.then74 ], [ %li.0175, %if.else ], [ %inc, %for.end91.loopexit ]
%indvars.iv.next206 = add nuw i64 %indvars.iv205, 1
%arrayidx7 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv.next206
%s11 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv.next206, i32 1
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %s11)
%tobool.not = icmp eq i32 %call12, 0
%indvar.next = add i64 %indvar, 1
br i1 %tobool.not, label %while.end.loopexit, label %while.body, !llvm.loop !18
while.end.loopexit: ; preds = %land.lhs.true, %for.end91
%ti.0.lcssa.ph.in = phi i64 [ %indvars.iv.next206, %for.end91 ], [ %indvars.iv205, %land.lhs.true ]
%25 = and i64 %ti.0.lcssa.ph.in, 4294967295
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%ti.0.lcssa = phi i64 [ 1, %entry ], [ %25, %while.end.loopexit ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
%call95181 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %q)
%cmp96.not182 = icmp eq i32 %call95181, -1
br i1 %cmp96.not182, label %while.end114, label %for.cond98.preheader
for.cond98.preheader: ; preds = %while.end, %for.end113
%26 = load i32, ptr %q, align 4, !tbaa !11
br label %for.body100
for.cond98: ; preds = %for.body100
%indvars.iv.next209 = add nuw nsw i64 %indvars.iv208, 1
%exitcond212.not = icmp eq i64 %indvars.iv.next209, %ti.0.lcssa
br i1 %exitcond212.not, label %for.end113, label %for.body100, !llvm.loop !19
for.body100: ; preds = %for.cond98.preheader, %for.cond98
%indvars.iv208 = phi i64 [ 0, %for.cond98.preheader ], [ %indvars.iv.next209, %for.cond98 ]
%arrayidx102 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv208
%27 = load i32, ptr %arrayidx102, align 4, !tbaa !12
%cmp104 = icmp eq i32 %26, %27
br i1 %cmp104, label %if.then105, label %for.cond98
if.then105: ; preds = %for.body100
%lank108 = getelementptr inbounds [100 x %struct.t], ptr %team, i64 0, i64 %indvars.iv208, i32 2
%28 = load i32, ptr %lank108, align 4, !tbaa !5
%call109 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
br label %for.end113
for.end113: ; preds = %for.cond98, %if.then105
%call95 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %q)
%cmp96.not = icmp eq i32 %call95, -1
br i1 %cmp96.not, label %while.end114, label %for.cond98.preheader, !llvm.loop !20
while.end114: ; preds = %for.end113, %while.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %lank) #3
call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %team) #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, !7, i64 8}
!6 = !{!"t", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
|
// AOJ 0633: Plush Toys
// 2017.12.5 bal4u@uu
#include <stdio.h>
#include <string.h>
int p[100002];
int f[22][100002], c[22];
int dp[1050000];
char buf[15], *bp;
int getInt()
{
int n = 0;
while (*bp >= '0') n = (n<<3) + (n<<1) + (*bp++ & 0xf);
return n;
}
int main()
{
int n, m, i, j, k, v, x, lim;
fgets(bp=buf, 15, stdin);
n = getInt(), bp++, m = getInt();
for (i = 0; i < n; i++) {
fgets(bp=buf, 15, stdin), v = getInt()-1;
f[v][i+1]++, c[v]++;
}
for (i = 0; i < m; i++) for (j = 0; j < n; j++) f[i][j+1] += f[i][j];
memset(dp, 0x55, sizeof(dp));
dp[0] = 0, lim = 1 << m;
for (i = 0; i < lim; i++){
for (v = 0, j = 0; j < m; j++) if (i & (1<<j)) v += c[j];
for (k = 1, j = 0; j < m; j++, k <<= 1) if (!(i & k)) {
x = dp[i] + c[j] - f[j][v + c[j]] + f[j][v];
if (dp[i+k] > x) dp[i+k] = x;
}
}
printf("%d\n",dp[lim-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232318/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232318/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@bp = dso_local local_unnamed_addr global ptr null, align 8
@buf = dso_local global [15 x i8] zeroinitializer, align 1
@stdin = external local_unnamed_addr global ptr, align 8
@f = dso_local local_unnamed_addr global [22 x [100002 x i32]] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [22 x i32] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [1050000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@p = dso_local local_unnamed_addr global [100002 x i32] zeroinitializer, align 16
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @getInt() local_unnamed_addr #0 {
entry:
%bp.promoted = load ptr, ptr @bp, align 8, !tbaa !5
%0 = load i8, ptr %bp.promoted, align 1, !tbaa !9
%cmp8 = icmp sgt i8 %0, 47
br i1 %cmp8, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%n.010 = phi i32 [ %add4, %while.body ], [ 0, %entry ]
%incdec.ptr79 = phi ptr [ %incdec.ptr, %while.body ], [ %bp.promoted, %entry ]
%add = mul i32 %n.010, 10
%incdec.ptr = getelementptr inbounds i8, ptr %incdec.ptr79, i64 1
store ptr %incdec.ptr, ptr @bp, align 8, !tbaa !5
%1 = load i8, ptr %incdec.ptr79, align 1, !tbaa !9
%2 = and i8 %1, 15
%and = zext i8 %2 to i32
%add4 = add nsw i32 %add, %and
%3 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%cmp = icmp sgt i8 %3, 47
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !10
while.end: ; preds = %while.body, %entry
%n.0.lcssa = phi i32 [ 0, %entry ], [ %add4, %while.body ]
ret i32 %n.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
store ptr @buf, ptr @bp, align 8, !tbaa !5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 15, ptr noundef %0)
%bp.promoted.i = load ptr, ptr @bp, align 8, !tbaa !5
%1 = load i8, ptr %bp.promoted.i, align 1, !tbaa !9
%cmp8.i = icmp sgt i8 %1, 47
br i1 %cmp8.i, label %while.body.i, label %getInt.exit.thread
while.body.i: ; preds = %entry, %while.body.i
%n.010.i = phi i32 [ %add4.i, %while.body.i ], [ 0, %entry ]
%incdec.ptr79.i = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %bp.promoted.i, %entry ]
%add.i = mul i32 %n.010.i, 10
%incdec.ptr.i = getelementptr inbounds i8, ptr %incdec.ptr79.i, i64 1
store ptr %incdec.ptr.i, ptr @bp, align 8, !tbaa !5
%2 = load i8, ptr %incdec.ptr79.i, align 1, !tbaa !9
%3 = and i8 %2, 15
%and.i = zext i8 %3 to i32
%add4.i = add nsw i32 %add.i, %and.i
%4 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !9
%cmp.i = icmp sgt i8 %4, 47
br i1 %cmp.i, label %while.body.i, label %getInt.exit, !llvm.loop !10
getInt.exit: ; preds = %while.body.i
%incdec.ptr = getelementptr inbounds i8, ptr %incdec.ptr79.i, i64 2
store ptr %incdec.ptr, ptr @bp, align 8, !tbaa !5
%5 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%cmp8.i131 = icmp sgt i8 %5, 47
br i1 %cmp8.i131, label %while.body.i133.preheader, label %getInt.exit141.thread
getInt.exit.thread: ; preds = %entry
%incdec.ptr218 = getelementptr inbounds i8, ptr %bp.promoted.i, i64 1
store ptr %incdec.ptr218, ptr @bp, align 8, !tbaa !5
%6 = load i8, ptr %incdec.ptr218, align 1, !tbaa !9
%cmp8.i131219 = icmp sgt i8 %6, 47
br i1 %cmp8.i131219, label %while.body.i133.preheader, label %for.end32.thread
while.body.i133.preheader: ; preds = %getInt.exit.thread, %getInt.exit
%incdec.ptr223 = phi ptr [ %incdec.ptr218, %getInt.exit.thread ], [ %incdec.ptr, %getInt.exit ]
%n.0.lcssa.i220 = phi i32 [ 0, %getInt.exit.thread ], [ %add4.i, %getInt.exit ]
br label %while.body.i133
while.body.i133: ; preds = %while.body.i133.preheader, %while.body.i133
%n.010.i134 = phi i32 [ %add4.i139, %while.body.i133 ], [ 0, %while.body.i133.preheader ]
%incdec.ptr79.i135 = phi ptr [ %incdec.ptr.i137, %while.body.i133 ], [ %incdec.ptr223, %while.body.i133.preheader ]
%add.i136 = mul i32 %n.010.i134, 10
%incdec.ptr.i137 = getelementptr inbounds i8, ptr %incdec.ptr79.i135, i64 1
store ptr %incdec.ptr.i137, ptr @bp, align 8, !tbaa !5
%7 = load i8, ptr %incdec.ptr79.i135, align 1, !tbaa !9
%8 = and i8 %7, 15
%and.i138 = zext i8 %8 to i32
%add4.i139 = add nsw i32 %add.i136, %and.i138
%9 = load i8, ptr %incdec.ptr.i137, align 1, !tbaa !9
%cmp.i140 = icmp sgt i8 %9, 47
br i1 %cmp.i140, label %while.body.i133, label %getInt.exit141, !llvm.loop !10
getInt.exit141: ; preds = %while.body.i133
%cmp154 = icmp sgt i32 %n.0.lcssa.i220, 0
br i1 %cmp154, label %for.body.preheader, label %for.cond11.preheader.thread
getInt.exit141.thread: ; preds = %getInt.exit
%cmp154208 = icmp sgt i32 %add4.i, 0
br i1 %cmp154208, label %for.body.preheader, label %for.end32.thread
for.body.preheader: ; preds = %getInt.exit141.thread, %getInt.exit141
%n.0.lcssa.i221 = phi i32 [ %add4.i, %getInt.exit141.thread ], [ %n.0.lcssa.i220, %getInt.exit141 ]
%n.0.lcssa.i132211 = phi i32 [ 0, %getInt.exit141.thread ], [ %add4.i139, %getInt.exit141 ]
%wide.trip.count = zext i32 %n.0.lcssa.i221 to i64
br label %for.body
for.cond11.preheader: ; preds = %getInt.exit153
%cmp12158 = icmp sgt i32 %n.0.lcssa.i132211, 0
br i1 %cmp12158, label %for.cond14.preheader.us.preheader, label %for.end32.thread
for.cond11.preheader.thread: ; preds = %getInt.exit141
%cmp12158195 = icmp sgt i32 %add4.i139, 0
br i1 %cmp12158195, label %for.end32, label %for.end32.thread
for.cond14.preheader.us.preheader: ; preds = %for.cond11.preheader
%wide.trip.count178 = zext i32 %n.0.lcssa.i132211 to i64
%xtraiter = and i64 %wide.trip.count, 3
%10 = icmp ult i32 %n.0.lcssa.i221, 4
%unroll_iter = and i64 %wide.trip.count, 2147483644
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond14.preheader.us
for.cond14.preheader.us: ; preds = %for.cond14.preheader.us.preheader, %for.cond14.for.inc30_crit_edge.us
%indvars.iv175 = phi i64 [ 0, %for.cond14.preheader.us.preheader ], [ %indvars.iv.next176, %for.cond14.for.inc30_crit_edge.us ]
%arrayidx20.us.phi.trans.insert = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %indvars.iv175, i64 0
%.pre = load i32, ptr %arrayidx20.us.phi.trans.insert, align 8, !tbaa !12
br i1 %10, label %for.cond14.for.inc30_crit_edge.us.unr-lcssa, label %for.body16.us
for.body16.us: ; preds = %for.cond14.preheader.us, %for.body16.us
%11 = phi i32 [ %add26.us.3, %for.body16.us ], [ %.pre, %for.cond14.preheader.us ]
%indvars.iv170 = phi i64 [ %indvars.iv.next171.3, %for.body16.us ], [ 0, %for.cond14.preheader.us ]
%niter = phi i64 [ %niter.next.3, %for.body16.us ], [ 0, %for.cond14.preheader.us ]
%indvars.iv.next171 = or i64 %indvars.iv170, 1
%arrayidx25.us = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %indvars.iv175, i64 %indvars.iv.next171
%12 = load i32, ptr %arrayidx25.us, align 4, !tbaa !12
%add26.us = add nsw i32 %12, %11
store i32 %add26.us, ptr %arrayidx25.us, align 4, !tbaa !12
%indvars.iv.next171.1 = or i64 %indvars.iv170, 2
%arrayidx25.us.1 = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %indvars.iv175, i64 %indvars.iv.next171.1
%13 = load i32, ptr %arrayidx25.us.1, align 8, !tbaa !12
%add26.us.1 = add nsw i32 %13, %add26.us
store i32 %add26.us.1, ptr %arrayidx25.us.1, align 8, !tbaa !12
%indvars.iv.next171.2 = or i64 %indvars.iv170, 3
%arrayidx25.us.2 = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %indvars.iv175, i64 %indvars.iv.next171.2
%14 = load i32, ptr %arrayidx25.us.2, align 4, !tbaa !12
%add26.us.2 = add nsw i32 %14, %add26.us.1
store i32 %add26.us.2, ptr %arrayidx25.us.2, align 4, !tbaa !12
%indvars.iv.next171.3 = add nuw nsw i64 %indvars.iv170, 4
%arrayidx25.us.3 = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %indvars.iv175, i64 %indvars.iv.next171.3
%15 = load i32, ptr %arrayidx25.us.3, align 8, !tbaa !12
%add26.us.3 = add nsw i32 %15, %add26.us.2
store i32 %add26.us.3, ptr %arrayidx25.us.3, align 8, !tbaa !12
%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.cond14.for.inc30_crit_edge.us.unr-lcssa, label %for.body16.us, !llvm.loop !14
for.cond14.for.inc30_crit_edge.us.unr-lcssa: ; preds = %for.body16.us, %for.cond14.preheader.us
%.unr = phi i32 [ %.pre, %for.cond14.preheader.us ], [ %add26.us.3, %for.body16.us ]
%indvars.iv170.unr = phi i64 [ 0, %for.cond14.preheader.us ], [ %indvars.iv.next171.3, %for.body16.us ]
br i1 %lcmp.mod.not, label %for.cond14.for.inc30_crit_edge.us, label %for.body16.us.epil
for.body16.us.epil: ; preds = %for.cond14.for.inc30_crit_edge.us.unr-lcssa, %for.body16.us.epil
%16 = phi i32 [ %add26.us.epil, %for.body16.us.epil ], [ %.unr, %for.cond14.for.inc30_crit_edge.us.unr-lcssa ]
%indvars.iv170.epil = phi i64 [ %indvars.iv.next171.epil, %for.body16.us.epil ], [ %indvars.iv170.unr, %for.cond14.for.inc30_crit_edge.us.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body16.us.epil ], [ 0, %for.cond14.for.inc30_crit_edge.us.unr-lcssa ]
%indvars.iv.next171.epil = add nuw nsw i64 %indvars.iv170.epil, 1
%arrayidx25.us.epil = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %indvars.iv175, i64 %indvars.iv.next171.epil
%17 = load i32, ptr %arrayidx25.us.epil, align 4, !tbaa !12
%add26.us.epil = add nsw i32 %17, %16
store i32 %add26.us.epil, ptr %arrayidx25.us.epil, align 4, !tbaa !12
%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.cond14.for.inc30_crit_edge.us, label %for.body16.us.epil, !llvm.loop !15
for.cond14.for.inc30_crit_edge.us: ; preds = %for.body16.us.epil, %for.cond14.for.inc30_crit_edge.us.unr-lcssa
%indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1
%exitcond179.not = icmp eq i64 %indvars.iv.next176, %wide.trip.count178
br i1 %exitcond179.not, label %for.end32, label %for.cond14.preheader.us, !llvm.loop !17
for.body: ; preds = %for.body.preheader, %getInt.exit153
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %getInt.exit153 ]
store ptr @buf, ptr @bp, align 8, !tbaa !5
%18 = load ptr, ptr @stdin, align 8, !tbaa !5
%call3 = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 15, ptr noundef %18)
%bp.promoted.i142 = load ptr, ptr @bp, align 8, !tbaa !5
%19 = load i8, ptr %bp.promoted.i142, align 1, !tbaa !9
%cmp8.i143 = icmp sgt i8 %19, 47
br i1 %cmp8.i143, label %while.body.i145, label %getInt.exit153
while.body.i145: ; preds = %for.body, %while.body.i145
%n.010.i146 = phi i32 [ %add4.i151, %while.body.i145 ], [ 0, %for.body ]
%incdec.ptr79.i147 = phi ptr [ %incdec.ptr.i149, %while.body.i145 ], [ %bp.promoted.i142, %for.body ]
%add.i148 = mul i32 %n.010.i146, 10
%incdec.ptr.i149 = getelementptr inbounds i8, ptr %incdec.ptr79.i147, i64 1
store ptr %incdec.ptr.i149, ptr @bp, align 8, !tbaa !5
%20 = load i8, ptr %incdec.ptr79.i147, align 1, !tbaa !9
%21 = and i8 %20, 15
%and.i150 = zext i8 %21 to i32
%add4.i151 = add nsw i32 %add.i148, %and.i150
%22 = load i8, ptr %incdec.ptr.i149, align 1, !tbaa !9
%cmp.i152 = icmp sgt i8 %22, 47
br i1 %cmp.i152, label %while.body.i145, label %getInt.exit153, !llvm.loop !10
getInt.exit153: ; preds = %while.body.i145, %for.body
%n.0.lcssa.i144 = phi i32 [ 0, %for.body ], [ %add4.i151, %while.body.i145 ]
%sub = add nsw i32 %n.0.lcssa.i144, -1
%idxprom = sext i32 %sub to i64
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx6 = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %idxprom, i64 %indvars.iv.next
%23 = load i32, ptr %arrayidx6, align 4, !tbaa !12
%inc = add nsw i32 %23, 1
store i32 %inc, ptr %arrayidx6, align 4, !tbaa !12
%arrayidx8 = getelementptr inbounds [22 x i32], ptr @c, i64 0, i64 %idxprom
%24 = load i32, ptr %arrayidx8, align 4, !tbaa !12
%inc9 = add nsw i32 %24, 1
store i32 %inc9, ptr %arrayidx8, align 4, !tbaa !12
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond11.preheader, label %for.body, !llvm.loop !18
for.end32.thread: ; preds = %getInt.exit.thread, %getInt.exit141.thread, %for.cond11.preheader.thread, %for.cond11.preheader
%n.0.lcssa.i132213 = phi i32 [ %n.0.lcssa.i132211, %for.cond11.preheader ], [ %add4.i139, %for.cond11.preheader.thread ], [ 0, %getInt.exit141.thread ], [ 0, %getInt.exit.thread ]
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4200000) @dp, i8 85, i64 4200000, i1 false)
store i32 0, ptr @dp, align 16, !tbaa !12
br label %for.cond36.preheader.lr.ph
for.end32: ; preds = %for.cond14.for.inc30_crit_edge.us, %for.cond11.preheader.thread
%n.0.lcssa.i132209 = phi i32 [ %add4.i139, %for.cond11.preheader.thread ], [ %n.0.lcssa.i132211, %for.cond14.for.inc30_crit_edge.us ]
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4200000) @dp, i8 85, i64 4200000, i1 false)
store i32 0, ptr @dp, align 16, !tbaa !12
%cmp34166.not = icmp eq i32 %n.0.lcssa.i132209, 31
br i1 %cmp34166.not, label %for.end86, label %for.cond36.preheader.lr.ph
for.cond36.preheader.lr.ph: ; preds = %for.end32.thread, %for.end32
%n.0.lcssa.i132212 = phi i32 [ %n.0.lcssa.i132213, %for.end32.thread ], [ %n.0.lcssa.i132209, %for.end32 ]
%cmp12158196203 = phi i1 [ false, %for.end32.thread ], [ true, %for.end32 ]
%shl204 = shl nuw i32 1, %n.0.lcssa.i132212
%smax = tail call i32 @llvm.smax.i32(i32 %shl204, i32 1)
%wide.trip.count193 = zext i32 %smax to i64
%wide.trip.count188 = zext i32 %n.0.lcssa.i132212 to i64
%xtraiter226 = and i64 %wide.trip.count188, 1
%25 = icmp eq i32 %n.0.lcssa.i132212, 1
%unroll_iter230 = and i64 %wide.trip.count188, 4294967294
%lcmp.mod228.not = icmp eq i64 %xtraiter226, 0
br label %for.cond36.preheader
for.cond36.preheader: ; preds = %for.cond36.preheader.lr.ph, %for.inc84
%indvars.iv190 = phi i64 [ 0, %for.cond36.preheader.lr.ph ], [ %indvars.iv.next191, %for.inc84 ]
br i1 %cmp12158196203, label %for.body38.preheader, label %for.inc84
for.body38.preheader: ; preds = %for.cond36.preheader
%26 = trunc i64 %indvars.iv190 to i32
br i1 %25, label %for.cond46.preheader.unr-lcssa, label %for.body38
for.cond46.preheader.unr-lcssa: ; preds = %for.inc43.1, %for.body38.preheader
%v.1.lcssa.ph = phi i32 [ undef, %for.body38.preheader ], [ %v.1.1, %for.inc43.1 ]
%indvars.iv180.unr = phi i64 [ 0, %for.body38.preheader ], [ %indvars.iv.next181.1, %for.inc43.1 ]
%v.0161.unr = phi i32 [ 0, %for.body38.preheader ], [ %v.1.1, %for.inc43.1 ]
br i1 %lcmp.mod228.not, label %for.cond46.preheader, label %for.body38.epil
for.body38.epil: ; preds = %for.cond46.preheader.unr-lcssa
%27 = trunc i64 %indvars.iv180.unr to i32
%shl39.epil = shl nuw i32 1, %27
%and.epil = and i32 %shl39.epil, %26
%tobool.not.epil = icmp eq i32 %and.epil, 0
br i1 %tobool.not.epil, label %for.cond46.preheader, label %if.then.epil
if.then.epil: ; preds = %for.body38.epil
%arrayidx41.epil = getelementptr inbounds [22 x i32], ptr @c, i64 0, i64 %indvars.iv180.unr
%28 = load i32, ptr %arrayidx41.epil, align 4, !tbaa !12
%add42.epil = add nsw i32 %28, %v.0161.unr
br label %for.cond46.preheader
for.cond46.preheader: ; preds = %for.body38.epil, %if.then.epil, %for.cond46.preheader.unr-lcssa
%v.1.lcssa = phi i32 [ %v.1.lcssa.ph, %for.cond46.preheader.unr-lcssa ], [ %add42.epil, %if.then.epil ], [ %v.0161.unr, %for.body38.epil ]
br i1 %cmp12158196203, label %for.body48.lr.ph, label %for.inc84
for.body48.lr.ph: ; preds = %for.cond46.preheader
%arrayidx53 = getelementptr inbounds [1050000 x i32], ptr @dp, i64 0, i64 %indvars.iv190
%idxprom67 = sext i32 %v.1.lcssa to i64
%29 = trunc i64 %indvars.iv190 to i32
br label %for.body48
for.body38: ; preds = %for.body38.preheader, %for.inc43.1
%indvars.iv180 = phi i64 [ %indvars.iv.next181.1, %for.inc43.1 ], [ 0, %for.body38.preheader ]
%v.0161 = phi i32 [ %v.1.1, %for.inc43.1 ], [ 0, %for.body38.preheader ]
%niter231 = phi i64 [ %niter231.next.1, %for.inc43.1 ], [ 0, %for.body38.preheader ]
%30 = trunc i64 %indvars.iv180 to i32
%shl39 = shl nuw i32 1, %30
%and = and i32 %shl39, %26
%tobool.not = icmp eq i32 %and, 0
br i1 %tobool.not, label %for.inc43, label %if.then
if.then: ; preds = %for.body38
%arrayidx41 = getelementptr inbounds [22 x i32], ptr @c, i64 0, i64 %indvars.iv180
%31 = load i32, ptr %arrayidx41, align 8, !tbaa !12
%add42 = add nsw i32 %31, %v.0161
br label %for.inc43
for.inc43: ; preds = %for.body38, %if.then
%v.1 = phi i32 [ %add42, %if.then ], [ %v.0161, %for.body38 ]
%indvars.iv.next181 = or i64 %indvars.iv180, 1
%32 = trunc i64 %indvars.iv.next181 to i32
%shl39.1 = shl nuw i32 1, %32
%and.1 = and i32 %shl39.1, %26
%tobool.not.1 = icmp eq i32 %and.1, 0
br i1 %tobool.not.1, label %for.inc43.1, label %if.then.1
if.then.1: ; preds = %for.inc43
%arrayidx41.1 = getelementptr inbounds [22 x i32], ptr @c, i64 0, i64 %indvars.iv.next181
%33 = load i32, ptr %arrayidx41.1, align 4, !tbaa !12
%add42.1 = add nsw i32 %33, %v.1
br label %for.inc43.1
for.inc43.1: ; preds = %if.then.1, %for.inc43
%v.1.1 = phi i32 [ %add42.1, %if.then.1 ], [ %v.1, %for.inc43 ]
%indvars.iv.next181.1 = add nuw nsw i64 %indvars.iv180, 2
%niter231.next.1 = add i64 %niter231, 2
%niter231.ncmp.1 = icmp eq i64 %niter231.next.1, %unroll_iter230
br i1 %niter231.ncmp.1, label %for.cond46.preheader.unr-lcssa, label %for.body38, !llvm.loop !19
for.body48: ; preds = %for.body48.lr.ph, %for.inc80
%indvars.iv185 = phi i64 [ 0, %for.body48.lr.ph ], [ %indvars.iv.next186, %for.inc80 ]
%k.0164 = phi i32 [ 1, %for.body48.lr.ph ], [ %shl82, %for.inc80 ]
%and49 = and i32 %k.0164, %29
%tobool50.not = icmp eq i32 %and49, 0
br i1 %tobool50.not, label %if.then51, label %for.inc80
if.then51: ; preds = %for.body48
%34 = load i32, ptr %arrayidx53, align 4, !tbaa !12
%arrayidx55 = getelementptr inbounds [22 x i32], ptr @c, i64 0, i64 %indvars.iv185
%35 = load i32, ptr %arrayidx55, align 4, !tbaa !12
%add56 = add nsw i32 %35, %34
%add61 = add nsw i32 %35, %v.1.lcssa
%idxprom62 = sext i32 %add61 to i64
%arrayidx63 = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %indvars.iv185, i64 %idxprom62
%36 = load i32, ptr %arrayidx63, align 4, !tbaa !12
%sub64 = sub i32 %add56, %36
%arrayidx68 = getelementptr inbounds [22 x [100002 x i32]], ptr @f, i64 0, i64 %indvars.iv185, i64 %idxprom67
%37 = load i32, ptr %arrayidx68, align 4, !tbaa !12
%add69 = add nsw i32 %sub64, %37
%add70 = add nsw i32 %k.0164, %29
%idxprom71 = sext i32 %add70 to i64
%arrayidx72 = getelementptr inbounds [1050000 x i32], ptr @dp, i64 0, i64 %idxprom71
%38 = load i32, ptr %arrayidx72, align 4, !tbaa !12
%cmp73 = icmp sgt i32 %38, %add69
br i1 %cmp73, label %if.then74, label %for.inc80
if.then74: ; preds = %if.then51
store i32 %add69, ptr %arrayidx72, align 4, !tbaa !12
br label %for.inc80
for.inc80: ; preds = %for.body48, %if.then74, %if.then51
%indvars.iv.next186 = add nuw nsw i64 %indvars.iv185, 1
%shl82 = shl i32 %k.0164, 1
%exitcond189.not = icmp eq i64 %indvars.iv.next186, %wide.trip.count188
br i1 %exitcond189.not, label %for.inc84, label %for.body48, !llvm.loop !20
for.inc84: ; preds = %for.inc80, %for.cond36.preheader, %for.cond46.preheader
%indvars.iv.next191 = add nuw nsw i64 %indvars.iv190, 1
%exitcond194.not = icmp eq i64 %indvars.iv.next191, %wide.trip.count193
br i1 %exitcond194.not, label %for.end86.loopexit, label %for.cond36.preheader, !llvm.loop !21
for.end86.loopexit: ; preds = %for.inc84
%39 = add nsw i32 %shl204, -1
%40 = sext i32 %39 to i64
br label %for.end86
for.end86: ; preds = %for.end86.loopexit, %for.end32
%shl205 = phi i64 [ 2147483647, %for.end32 ], [ %40, %for.end86.loopexit ]
%arrayidx89 = getelementptr inbounds [1050000 x i32], ptr @dp, i64 0, i64 %shl205
%41 = load i32, ptr %arrayidx89, align 4, !tbaa !12
%call90 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %41)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
|
#include <stdio.h>
int K, T, a[112];
int max;
int main() {
scanf("%d%d", &K, &T);
for (int i = 0; i < T; ++i) { scanf("%d", &a[i]); }
if (T == 1) { printf("%d\n", a[0] - 1); }
else {
for (int i = 0; i < T; ++i) {
if (i == 0) { max = a[i]; }
else if (max < a[i]) { max = a[i]; }
}
if (max - (K - max) - 1 <= 0) { printf("0\n"); }
else { printf("%d\n", max - (K - max) - 1); }
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232361/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232361/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@K = dso_local global i32 0, align 4
@T = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global [112 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@max = dso_local local_unnamed_addr global i32 0, align 4
@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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @K, ptr noundef nonnull @T)
%0 = load i32, ptr @T, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.cond5.preheader.for.cond.cleanup7_crit_edge
for.cond.cleanup: ; preds = %for.body
%cmp2 = icmp eq i32 %4, 1
br i1 %cmp2, label %if.then, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.cond.cleanup
%cmp647 = icmp sgt i32 %4, 0
br i1 %cmp647, label %for.body8.peel.next, label %for.cond5.preheader.for.cond.cleanup7_crit_edge
for.cond5.preheader.for.cond.cleanup7_crit_edge: ; preds = %entry, %for.cond5.preheader
%.pre = load i32, ptr @max, align 4, !tbaa !5
br label %for.cond.cleanup7
for.body8.peel.next: ; preds = %for.cond5.preheader
%1 = load i32, ptr @a, align 16
%wide.trip.count = zext i32 %4 to i64
store i32 %1, ptr @max, align 4, !tbaa !5
%2 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %2, 1
%3 = icmp eq i32 %4, 2
br i1 %3, label %for.cond.cleanup7.loopexit.unr-lcssa, label %for.body8.peel.next.new
for.body8.peel.next.new: ; preds = %for.body8.peel.next
%unroll_iter = and i64 %2, -2
br label %if.else13
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [112 x i32], ptr @a, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr @T, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then: ; preds = %for.cond.cleanup
%6 = load i32, ptr @a, align 16, !tbaa !5
%sub = add nsw i32 %6, -1
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
br label %if.end36
for.cond.cleanup7.loopexit.unr-lcssa: ; preds = %for.inc21.1, %for.body8.peel.next
%.lcssa.ph = phi i32 [ undef, %for.body8.peel.next ], [ %16, %for.inc21.1 ]
%.unr = phi i32 [ %1, %for.body8.peel.next ], [ %16, %for.inc21.1 ]
%indvars.iv51.unr = phi i64 [ 1, %for.body8.peel.next ], [ %indvars.iv.next52.1, %for.inc21.1 ]
%.unr63 = phi i32 [ %1, %for.body8.peel.next ], [ %17, %for.inc21.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup7, label %if.else13.epil
if.else13.epil: ; preds = %for.cond.cleanup7.loopexit.unr-lcssa
%arrayidx15.epil = getelementptr inbounds [112 x i32], ptr @a, i64 0, i64 %indvars.iv51.unr
%7 = load i32, ptr %arrayidx15.epil, align 4, !tbaa !5
%cmp16.epil = icmp slt i32 %.unr63, %7
br i1 %cmp16.epil, label %if.then17.epil, label %for.cond.cleanup7
if.then17.epil: ; preds = %if.else13.epil
store i32 %7, ptr @max, align 4, !tbaa !5
br label %for.cond.cleanup7
for.cond.cleanup7: ; preds = %for.cond.cleanup7.loopexit.unr-lcssa, %if.then17.epil, %if.else13.epil, %for.cond5.preheader.for.cond.cleanup7_crit_edge
%8 = phi i32 [ %.pre, %for.cond5.preheader.for.cond.cleanup7_crit_edge ], [ %.lcssa.ph, %for.cond.cleanup7.loopexit.unr-lcssa ], [ %7, %if.then17.epil ], [ %.unr, %if.else13.epil ]
%9 = load i32, ptr @K, align 4, !tbaa !5
%sub24.neg = sub i32 %8, %9
%sub25 = add i32 %sub24.neg, %8
%cmp27 = icmp slt i32 %sub25, 2
br i1 %cmp27, label %if.then28, label %if.else30
if.else13: ; preds = %for.inc21.1, %for.body8.peel.next.new
%10 = phi i32 [ %1, %for.body8.peel.next.new ], [ %16, %for.inc21.1 ]
%indvars.iv51 = phi i64 [ 1, %for.body8.peel.next.new ], [ %indvars.iv.next52.1, %for.inc21.1 ]
%11 = phi i32 [ %1, %for.body8.peel.next.new ], [ %17, %for.inc21.1 ]
%niter = phi i64 [ 0, %for.body8.peel.next.new ], [ %niter.next.1, %for.inc21.1 ]
%arrayidx15 = getelementptr inbounds [112 x i32], ptr @a, i64 0, i64 %indvars.iv51
%12 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16 = icmp slt i32 %11, %12
br i1 %cmp16, label %if.then17, label %for.inc21
if.then17: ; preds = %if.else13
store i32 %12, ptr @max, align 4, !tbaa !5
br label %for.inc21
for.inc21: ; preds = %if.then17, %if.else13
%13 = phi i32 [ %12, %if.then17 ], [ %10, %if.else13 ]
%14 = phi i32 [ %12, %if.then17 ], [ %11, %if.else13 ]
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%arrayidx15.1 = getelementptr inbounds [112 x i32], ptr @a, i64 0, i64 %indvars.iv.next52
%15 = load i32, ptr %arrayidx15.1, align 4, !tbaa !5
%cmp16.1 = icmp slt i32 %14, %15
br i1 %cmp16.1, label %if.then17.1, label %for.inc21.1
if.then17.1: ; preds = %for.inc21
store i32 %15, ptr @max, align 4, !tbaa !5
br label %for.inc21.1
for.inc21.1: ; preds = %if.then17.1, %for.inc21
%16 = phi i32 [ %15, %if.then17.1 ], [ %13, %for.inc21 ]
%17 = phi i32 [ %15, %if.then17.1 ], [ %14, %for.inc21 ]
%indvars.iv.next52.1 = add nuw nsw i64 %indvars.iv51, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup7.loopexit.unr-lcssa, label %if.else13, !llvm.loop !11
if.then28: ; preds = %for.cond.cleanup7
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end36
if.else30: ; preds = %for.cond.cleanup7
%sub26 = add nsw i32 %sub25, -1
%call34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub26)
br label %if.end36
if.end36: ; preds = %if.then28, %if.else30, %if.then
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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}
|
#include <stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef unsigned long long ll;
int num[100000]={0};
char ch[100000];
int main(){
int N,sum=0,Q,K,i,l,r;
scanf("%d%d",&N,&Q);
scanf("%s",ch);
num[0] =0;
for(i=1;i<N;i++){
if(*(ch+i)=='C'&&*(ch+i-1)=='A'){
sum++;
}
*(num+i) = sum;
}
Q = Q-1;
for(i=Q;i>=0;i--){
scanf("%d%d",&l,&r);
printf("%d\n",*(num+r-1)-*(num+l-1));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232404/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232404/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@num = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@ch = dso_local global [100000 x i8] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%Q = alloca i32, align 4
%l = alloca i32, align 4
%r = 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 %Q) #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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %Q)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @ch)
store i32 0, ptr @num, align 16, !tbaa !5
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp35 = icmp sgt i32 %0, 1
br i1 %cmp35, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%1 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %1, 1
%2 = icmp eq i32 %0, 2
br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %1, -2
br label %for.body
for.body: ; preds = %if.end.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.1, %if.end.1 ]
%sum.036 = phi i32 [ 0, %for.body.preheader.new ], [ %sum.1.1, %if.end.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %if.end.1 ]
%add.ptr = getelementptr inbounds i8, ptr @ch, i64 %indvars.iv
%3 = load i8, ptr %add.ptr, align 1, !tbaa !9
%cmp2 = icmp eq i8 %3, 67
br i1 %cmp2, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %for.body
%add.ptr6 = getelementptr inbounds i8, ptr %add.ptr, i64 -1
%4 = load i8, ptr %add.ptr6, align 1, !tbaa !9
%cmp8 = icmp eq i8 %4, 65
%inc = zext i1 %cmp8 to i32
%spec.select = add nsw i32 %sum.036, %inc
br label %if.end
if.end: ; preds = %land.lhs.true, %for.body
%sum.1 = phi i32 [ %sum.036, %for.body ], [ %spec.select, %land.lhs.true ]
%add.ptr11 = getelementptr inbounds i32, ptr @num, i64 %indvars.iv
store i32 %sum.1, ptr %add.ptr11, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%add.ptr.1 = getelementptr inbounds i8, ptr @ch, i64 %indvars.iv.next
%5 = load i8, ptr %add.ptr.1, align 1, !tbaa !9
%cmp2.1 = icmp eq i8 %5, 67
br i1 %cmp2.1, label %land.lhs.true.1, label %if.end.1
land.lhs.true.1: ; preds = %if.end
%add.ptr6.1 = getelementptr inbounds i8, ptr @ch, i64 %indvars.iv
%6 = load i8, ptr %add.ptr6.1, align 1, !tbaa !9
%cmp8.1 = icmp eq i8 %6, 65
%inc.1 = zext i1 %cmp8.1 to i32
%spec.select.1 = add nsw i32 %sum.1, %inc.1
br label %if.end.1
if.end.1: ; preds = %land.lhs.true.1, %if.end
%sum.1.1 = phi i32 [ %sum.1, %if.end ], [ %spec.select.1, %land.lhs.true.1 ]
%add.ptr11.1 = getelementptr inbounds i32, ptr @num, i64 %indvars.iv.next
store i32 %sum.1.1, ptr %add.ptr11.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.end.loopexit.unr-lcssa: ; preds = %if.end.1, %for.body.preheader
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.1, %if.end.1 ]
%sum.036.unr = phi i32 [ 0, %for.body.preheader ], [ %sum.1.1, %if.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%add.ptr.epil = getelementptr inbounds i8, ptr @ch, i64 %indvars.iv.unr
%7 = load i8, ptr %add.ptr.epil, align 1, !tbaa !9
%cmp2.epil = icmp eq i8 %7, 67
br i1 %cmp2.epil, label %land.lhs.true.epil, label %if.end.epil
land.lhs.true.epil: ; preds = %for.body.epil
%add.ptr6.epil = getelementptr inbounds i8, ptr %add.ptr.epil, i64 -1
%8 = load i8, ptr %add.ptr6.epil, align 1, !tbaa !9
%cmp8.epil = icmp eq i8 %8, 65
%inc.epil = zext i1 %cmp8.epil to i32
%spec.select.epil = add nsw i32 %sum.036.unr, %inc.epil
br label %if.end.epil
if.end.epil: ; preds = %land.lhs.true.epil, %for.body.epil
%sum.1.epil = phi i32 [ %sum.036.unr, %for.body.epil ], [ %spec.select.epil, %land.lhs.true.epil ]
%add.ptr11.epil = getelementptr inbounds i32, ptr @num, i64 %indvars.iv.unr
store i32 %sum.1.epil, ptr %add.ptr11.epil, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %if.end.epil, %for.end.loopexit.unr-lcssa, %entry
%9 = load i32, ptr %Q, align 4, !tbaa !5
%sub = add nsw i32 %9, -1
store i32 %sub, ptr %Q, align 4, !tbaa !5
%cmp1439 = icmp sgt i32 %9, 0
br i1 %cmp1439, label %for.body16, label %for.end27
for.body16: ; preds = %for.end, %for.body16
%i.140 = phi i32 [ %dec, %for.body16 ], [ %sub, %for.end ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%10 = load i32, ptr %r, align 4, !tbaa !5
%idx.ext18 = sext i32 %10 to i64
%gep = getelementptr i32, ptr getelementptr ([100000 x i32], ptr @num, i64 -1, i64 99999), i64 %idx.ext18
%11 = load i32, ptr %gep, align 4, !tbaa !5
%12 = load i32, ptr %l, align 4, !tbaa !5
%idx.ext21 = sext i32 %12 to i64
%gep38 = getelementptr i32, ptr getelementptr ([100000 x i32], ptr @num, i64 -1, i64 99999), i64 %idx.ext21
%13 = load i32, ptr %gep38, align 4, !tbaa !5
%sub24 = sub nsw i32 %11, %13
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub24)
%dec = add nsw i32 %i.140, -1
%cmp14.not = icmp eq i32 %i.140, 0
br i1 %cmp14.not, label %for.end27, label %for.body16, !llvm.loop !12
for.end27: ; preds = %for.body16, %for.end
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 %Q) #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main(void)
{
int N, Q, i;
scanf("%d%d", &N, &Q);
char str[N + 1];
int sum[N], l[Q], r[Q];
scanf("%s", str);
sum[0] = 0, sum[1] = 0;
for (i = 1; i < N; i++)
{
sum[i + 1] = sum[i];
if(str[i - 1] == 'A' && str[i] == 'C'){
sum[i + 1]++;
}
}
for (i = 0; i < Q; i++)
scanf("%d %d", &l[i], &r[i]);
for (i = 0; i < Q; i++)
printf("%d\n", sum[r[i]] - sum[l[i]]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232448/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232448/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.3 = 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
%Q = 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 %Q) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %Q)
%0 = load i32, ptr %N, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%5 = load i32, ptr %Q, align 4, !tbaa !5
%6 = zext i32 %5 to i64
%vla2 = alloca i32, i64 %6, align 16
%vla3 = alloca i32, i64 %6, align 16
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
store i32 0, ptr %vla1, align 16, !tbaa !5
%arrayidx5 = getelementptr inbounds i32, ptr %vla1, i64 1
store i32 0, ptr %arrayidx5, align 4, !tbaa !5
%7 = load i32, ptr %N, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %7, 1
br i1 %cmp66, label %for.body.preheader, label %for.cond23.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %7 to i64
%invariant.gep = getelementptr i8, ptr %vla, i64 -1
%8 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %8, 1
%9 = icmp eq i32 %7, 2
br i1 %9, label %for.cond23.preheader.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %8, -2
br label %for.body
for.cond23.preheader.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%.unr = phi i32 [ 0, %for.body.preheader ], [ %20, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond23.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond23.preheader.loopexit.unr-lcssa
%10 = getelementptr i32, ptr %vla1, i64 %indvars.iv.unr
%arrayidx9.epil = getelementptr i32, ptr %10, i64 1
store i32 %.unr, ptr %arrayidx9.epil, align 4, !tbaa !5
%gep.epil = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv.unr
%11 = load i8, ptr %gep.epil, align 1, !tbaa !9
%cmp12.epil = icmp eq i8 %11, 65
br i1 %cmp12.epil, label %land.lhs.true.epil, label %for.cond23.preheader
land.lhs.true.epil: ; preds = %for.body.epil
%arrayidx15.epil = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.unr
%12 = load i8, ptr %arrayidx15.epil, align 1, !tbaa !9
%cmp17.epil = icmp eq i8 %12, 67
br i1 %cmp17.epil, label %if.then.epil, label %for.cond23.preheader
if.then.epil: ; preds = %land.lhs.true.epil
%inc.epil = add nsw i32 %.unr, 1
store i32 %inc.epil, ptr %arrayidx9.epil, align 4, !tbaa !5
br label %for.cond23.preheader
for.cond23.preheader: ; preds = %for.cond23.preheader.loopexit.unr-lcssa, %if.then.epil, %land.lhs.true.epil, %for.body.epil, %entry
%13 = load i32, ptr %Q, align 4, !tbaa !5
%cmp2468 = icmp sgt i32 %13, 0
br i1 %cmp2468, label %for.body26, label %for.end51
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%14 = phi i32 [ 0, %for.body.preheader.new ], [ %20, %for.inc.1 ]
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx9 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next
store i32 %14, ptr %arrayidx9, align 4, !tbaa !5
%gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv
%15 = load i8, ptr %gep, align 1, !tbaa !9
%cmp12 = icmp eq i8 %15, 65
br i1 %cmp12, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx15 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%16 = load i8, ptr %arrayidx15, align 1, !tbaa !9
%cmp17 = icmp eq i8 %16, 67
br i1 %cmp17, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%inc = add nsw i32 %14, 1
store i32 %inc, ptr %arrayidx9, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%17 = phi i32 [ %14, %for.body ], [ %14, %land.lhs.true ], [ %inc, %if.then ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx9.1 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next.1
store i32 %17, ptr %arrayidx9.1, align 4, !tbaa !5
%gep.1 = getelementptr i8, ptr %vla, i64 %indvars.iv
%18 = load i8, ptr %gep.1, align 1, !tbaa !9
%cmp12.1 = icmp eq i8 %18, 65
br i1 %cmp12.1, label %land.lhs.true.1, label %for.inc.1
land.lhs.true.1: ; preds = %for.inc
%arrayidx15.1 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.next
%19 = load i8, ptr %arrayidx15.1, align 1, !tbaa !9
%cmp17.1 = icmp eq i8 %19, 67
br i1 %cmp17.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %land.lhs.true.1
%inc.1 = add nsw i32 %17, 1
store i32 %inc.1, ptr %arrayidx9.1, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %land.lhs.true.1, %for.inc
%20 = phi i32 [ %17, %for.inc ], [ %17, %land.lhs.true.1 ], [ %inc.1, %if.then.1 ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond23.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.cond35.preheader: ; preds = %for.body26
%21 = icmp sgt i32 %22, 0
br i1 %21, label %for.body38, label %for.end51
for.body26: ; preds = %for.cond23.preheader, %for.body26
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.body26 ], [ 0, %for.cond23.preheader ]
%arrayidx28 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv74
%arrayidx30 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv74
%call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx28, ptr noundef nonnull %arrayidx30)
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%22 = load i32, ptr %Q, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp24 = icmp slt i64 %indvars.iv.next75, %23
br i1 %cmp24, label %for.body26, label %for.cond35.preheader, !llvm.loop !12
for.body38: ; preds = %for.cond35.preheader, %for.body38
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body38 ], [ 0, %for.cond35.preheader ]
%arrayidx40 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv77
%24 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%idxprom41 = sext i32 %24 to i64
%arrayidx42 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom41
%25 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%arrayidx44 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv77
%26 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%idxprom45 = sext i32 %26 to i64
%arrayidx46 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom45
%27 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%sub47 = sub nsw i32 %25, %27
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sub47)
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%28 = load i32, ptr %Q, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp36 = icmp slt i64 %indvars.iv.next78, %29
br i1 %cmp36, label %for.body38, label %for.end51, !llvm.loop !13
for.end51: ; preds = %for.body38, %for.cond23.preheader, %for.cond35.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
#include<stdio.h>
int main(void){
int n,q;
scanf("%d %d\n",&n,&q);
char s[n];
int l[2][q];
scanf("%s",s);
int i=0;
int h[n];
h[0]=0;
for(i=0;i<q;i++){
scanf("%d %d\n",&l[0][i],&l[1][i]);
}
for(i=0;i<n-1;i++){
if(s[i]=='A'&&s[i+1]=='C') h[i+1] = 1+h[i];
else h[i+1]=h[i];
}
for(i=0;i<q;i++){
printf("%d\n",h[l[1][i]-1]-h[l[0][i]-1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232491/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232491/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = 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 %q) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %1, align 16
%3 = load i32, ptr %q, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 1
%vla1 = alloca i32, i64 %5, align 16
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = zext i32 %6 to i64
%vla3 = alloca i32, i64 %7, align 16
store i32 0, ptr %vla3, align 16, !tbaa !5
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %8, 0
br i1 %cmp72, label %for.body.lr.ph, label %for.cond10.preheader
for.body.lr.ph: ; preds = %entry
%arrayidx6 = getelementptr inbounds i32, ptr %vla1, i64 %4
br label %for.body
for.cond10.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr %n, align 4, !tbaa !5
%9 = icmp sgt i32 %11, 0
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.cond10.preheader.loopexit, %entry
%cmp3777 = phi i1 [ %9, %for.cond10.preheader.loopexit ], [ false, %entry ]
%10 = phi i32 [ %.pre, %for.cond10.preheader.loopexit ], [ %6, %entry ]
%cmp1174 = icmp sgt i32 %10, 1
br i1 %cmp1174, label %for.body12.preheader, label %for.cond36.preheader
for.body12.preheader: ; preds = %for.cond10.preheader
%sub = add nsw i32 %10, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.body12
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%arrayidx5 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%arrayidx8 = getelementptr inbounds i32, ptr %arrayidx6, i64 %indvars.iv
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx8)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = load i32, ptr %q, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp, label %for.body, label %for.cond10.preheader.loopexit, !llvm.loop !9
for.cond36.preheader: ; preds = %for.inc33, %for.cond10.preheader
br i1 %cmp3777, label %for.body39.lr.ph, label %for.end56
for.body39.lr.ph: ; preds = %for.cond36.preheader
%arrayidx40 = getelementptr inbounds i32, ptr %vla1, i64 %4
br label %for.body39
for.body12: ; preds = %for.body12.preheader, %for.inc33
%indvars.iv80 = phi i64 [ 0, %for.body12.preheader ], [ %14, %for.inc33 ]
%arrayidx14 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv80
%13 = load i8, ptr %arrayidx14, align 1, !tbaa !11
%cmp15 = icmp eq i8 %13, 65
%14 = add nuw nsw i64 %indvars.iv80, 1
br i1 %cmp15, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %for.body12
%arrayidx18 = getelementptr inbounds i8, ptr %vla, i64 %14
%15 = load i8, ptr %arrayidx18, align 1, !tbaa !11
%cmp20 = icmp eq i8 %15, 67
br i1 %cmp20, label %if.then, label %if.else
if.then: ; preds = %land.lhs.true
%arrayidx23 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv80
%16 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%add24 = add nsw i32 %16, 1
br label %for.inc33
if.else: ; preds = %for.body12, %land.lhs.true
%arrayidx29 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv80
%17 = load i32, ptr %arrayidx29, align 4, !tbaa !5
br label %for.inc33
for.inc33: ; preds = %if.then, %if.else
%add24.sink = phi i32 [ %add24, %if.then ], [ %17, %if.else ]
%arrayidx27 = getelementptr inbounds i32, ptr %vla3, i64 %14
store i32 %add24.sink, ptr %arrayidx27, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %14, %wide.trip.count
br i1 %exitcond.not, label %for.cond36.preheader, label %for.body12, !llvm.loop !12
for.body39: ; preds = %for.body39.lr.ph, %for.body39
%indvars.iv85 = phi i64 [ 0, %for.body39.lr.ph ], [ %indvars.iv.next86, %for.body39 ]
%arrayidx42 = getelementptr inbounds i32, ptr %arrayidx40, i64 %indvars.iv85
%18 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%sub43 = add nsw i32 %18, -1
%idxprom44 = sext i32 %sub43 to i64
%arrayidx45 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom44
%19 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%arrayidx48 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv85
%20 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%sub49 = add nsw i32 %20, -1
%idxprom50 = sext i32 %sub49 to i64
%arrayidx51 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom50
%21 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%sub52 = sub nsw i32 %19, %21
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub52)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%22 = load i32, ptr %q, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp37 = icmp slt i64 %indvars.iv.next86, %23
br i1 %cmp37, label %for.body39, label %for.end56, !llvm.loop !13
for.end56: ; preds = %for.body39, %for.cond36.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main() {
int N, Q;
char S[1000000] = {0};
int C[1000000] = {0};
scanf("%d %d\n", &N, &Q);
scanf("%s\n", S);
for (int i = 0; i < N - 1; i++) {
int x = (S[i] == 'A' && S[i+1] == 'C');
C[i + 1] = C[i] + x;
}
// for (int i = 0; i < N - 1; i++) {
// printf("%d,", C[i+1]);
// }
// printf("\n");
for (int i = 0; i < Q; i++) {
int l, r;
scanf("%d %d\n", &l, &r);
int nl = C[l - 1];
int nr = C[r - 1];
// printf("l=%d, r=%d, %d %d %d\n", l, r, nl, nr, nr - nl);
printf("%d\n", nr - nl);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232534/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232534/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%s\0A\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
%Q = alloca i32, align 4
%S = alloca [1000000 x i8], align 16
%C = alloca [1000000 x i32], align 16
%l = alloca i32, align 4
%r = 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 %Q) #4
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %S) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000000) %S, i8 0, i64 1000000, i1 false)
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %C) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000000) %C, i8 0, i64 4000000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %Q)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 1
br i1 %cmp39, label %for.body.preheader, label %for.cond16.preheader
for.body.preheader: ; preds = %entry
%sub = add i32 %0, -1
%wide.trip.count = zext i32 %sub to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %sub, 1
br i1 %1, label %for.cond16.preheader.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.cond16.preheader.loopexit.unr-lcssa: ; preds = %land.end.1, %for.body.preheader
%.unr = phi i32 [ 0, %for.body.preheader ], [ %add11.1, %land.end.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %13, %land.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond16.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond16.preheader.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [1000000 x i8], ptr %S, i64 0, i64 %indvars.iv.unr
%2 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
%cmp2.epil = icmp eq i8 %2, 65
%3 = add nuw nsw i64 %indvars.iv.unr, 1
br i1 %cmp2.epil, label %land.rhs.epil, label %land.end.epil
land.rhs.epil: ; preds = %for.body.epil
%arrayidx5.epil = getelementptr inbounds [1000000 x i8], ptr %S, i64 0, i64 %3
%4 = load i8, ptr %arrayidx5.epil, align 1, !tbaa !9
%cmp7.epil = icmp eq i8 %4, 67
%5 = zext i1 %cmp7.epil to i32
br label %land.end.epil
land.end.epil: ; preds = %land.rhs.epil, %for.body.epil
%land.ext.epil = phi i32 [ %5, %land.rhs.epil ], [ 0, %for.body.epil ]
%add11.epil = add nuw nsw i32 %.unr, %land.ext.epil
%arrayidx14.epil = getelementptr inbounds [1000000 x i32], ptr %C, i64 0, i64 %3
store i32 %add11.epil, ptr %arrayidx14.epil, align 4, !tbaa !5
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %land.end.epil, %for.cond16.preheader.loopexit.unr-lcssa, %entry
%6 = load i32, ptr %Q, align 4, !tbaa !5
%cmp1741 = icmp sgt i32 %6, 0
br i1 %cmp1741, label %for.body20, label %for.cond.cleanup19
for.body: ; preds = %land.end.1, %for.body.preheader.new
%7 = phi i32 [ 0, %for.body.preheader.new ], [ %add11.1, %land.end.1 ]
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %13, %land.end.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %land.end.1 ]
%arrayidx = getelementptr inbounds [1000000 x i8], ptr %S, i64 0, i64 %indvars.iv
%8 = load i8, ptr %arrayidx, align 2, !tbaa !9
%cmp2 = icmp eq i8 %8, 65
%9 = or i64 %indvars.iv, 1
br i1 %cmp2, label %land.rhs, label %land.end
land.rhs: ; preds = %for.body
%arrayidx5 = getelementptr inbounds [1000000 x i8], ptr %S, i64 0, i64 %9
%10 = load i8, ptr %arrayidx5, align 1, !tbaa !9
%cmp7 = icmp eq i8 %10, 67
br label %land.end
land.end: ; preds = %for.body, %land.rhs
%11 = phi i1 [ %cmp7, %land.rhs ], [ false, %for.body ]
%land.ext = zext i1 %11 to i32
%add11 = add nuw nsw i32 %7, %land.ext
%arrayidx14 = getelementptr inbounds [1000000 x i32], ptr %C, i64 0, i64 %9
store i32 %add11, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx.1 = getelementptr inbounds [1000000 x i8], ptr %S, i64 0, i64 %9
%12 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%cmp2.1 = icmp eq i8 %12, 65
%13 = add nuw nsw i64 %indvars.iv, 2
br i1 %cmp2.1, label %land.rhs.1, label %land.end.1
land.rhs.1: ; preds = %land.end
%arrayidx5.1 = getelementptr inbounds [1000000 x i8], ptr %S, i64 0, i64 %13
%14 = load i8, ptr %arrayidx5.1, align 2, !tbaa !9
%cmp7.1 = icmp eq i8 %14, 67
br label %land.end.1
land.end.1: ; preds = %land.rhs.1, %land.end
%15 = phi i1 [ %cmp7.1, %land.rhs.1 ], [ false, %land.end ]
%land.ext.1 = zext i1 %15 to i32
%add11.1 = add nuw nsw i32 %add11, %land.ext.1
%arrayidx14.1 = getelementptr inbounds [1000000 x i32], ptr %C, i64 0, i64 %13
store i32 %add11.1, ptr %arrayidx14.1, align 8, !tbaa !5
%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.cond16.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.cond.cleanup19: ; preds = %for.body20, %for.cond16.preheader
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body20: ; preds = %for.cond16.preheader, %for.body20
%i15.042 = phi i32 [ %inc31, %for.body20 ], [ 0, %for.cond16.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%16 = load i32, ptr %l, align 4, !tbaa !5
%sub22 = add nsw i32 %16, -1
%idxprom23 = sext i32 %sub22 to i64
%arrayidx24 = getelementptr inbounds [1000000 x i32], ptr %C, i64 0, i64 %idxprom23
%17 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%18 = load i32, ptr %r, align 4, !tbaa !5
%sub25 = add nsw i32 %18, -1
%idxprom26 = sext i32 %sub25 to i64
%arrayidx27 = getelementptr inbounds [1000000 x i32], ptr %C, i64 0, i64 %idxprom26
%19 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%sub28 = sub nsw i32 %19, %17
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub28)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
%inc31 = add nuw nsw i32 %i15.042, 1
%20 = load i32, ptr %Q, align 4, !tbaa !5
%cmp17 = icmp slt i32 %inc31, %20
br i1 %cmp17, label %for.body20, label %for.cond.cleanup19, !llvm.loop !12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main(void) {
int a[400][400];
int N, i, j, k, x, y, left, right, front, back;
int n[201], d[201];
while (1) {
scanf("%d", &N);
if (N == 0) return 0;
for (i = 1; i < N; i++)
scanf("%d%d", &n[i], &d[i]);
for (i = 0; i < 400; i++)
for (j = 0; j < 400; j++)
a[i][j] = -1;
a[200][200] = 0;
for (i = 1; i < N; i++) {
for (k = 0; k < 400; k++)
for (j = 0; j < 400; j++)
if (a[j][k] == n[i]) goto loop_end;
loop_end: ;
x = k;
y = j;
if (d[i] == 0) a[y][x - 1] = i;
else if (d[i] == 1) a[y + 1][x] = i;
else if (d[i] == 2) a[y][x + 1] = i;
else a[y - 1][x] = i;
}
for (j = 0; j < 400; j++)
for (i = 0; i < 400; i++)
if (a[i][j] != -1) {
left = j;
break;
}
for (i = 0; i < 400; i++)
for (j = 0; j < 400; j++)
if (a[i][j] != -1) {
front = i;
break;
}
for (j = 399; j >= 0; j--)
for (i = 399; i >= 0; i--)
if (a[i][j] != -1) {
right = j;
break;
}
for (i = 399; i >= 0; i--)
for (j = 399; j >= 0; j--)
if (a[i][j] != -1) {
back = i;
break;
}
printf("%d %d\n", left - right + 1, front - back + 1);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232578/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232578/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca [400 x [400 x i32]], align 16
%N = alloca i32, align 4
%n = alloca [201 x i32], align 16
%d = alloca [201 x i32], align 16
call void @llvm.lifetime.start.p0(i64 640000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %d) #4
%call249 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp250 = icmp eq i32 %0, 0
br i1 %cmp250, label %if.then, label %for.cond.preheader.lr.ph
for.cond.preheader.lr.ph: ; preds = %entry
%arrayidx22 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 200, i64 200
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.lr.ph, %for.end159
%1 = phi i32 [ %0, %for.cond.preheader.lr.ph ], [ %38, %for.end159 ]
%back.0254 = phi i32 [ undef, %for.cond.preheader.lr.ph ], [ %back.2, %for.end159 ]
%front.0253 = phi i32 [ undef, %for.cond.preheader.lr.ph ], [ %front.2, %for.end159 ]
%right.0252 = phi i32 [ undef, %for.cond.preheader.lr.ph ], [ %right.2, %for.end159 ]
%left.0251 = phi i32 [ undef, %for.cond.preheader.lr.ph ], [ %left.2, %for.end159 ]
%cmp1229 = icmp sgt i32 %1, 1
br i1 %cmp1229, label %for.body, label %for.cond5.preheader.thread
for.cond5.preheader.thread: ; preds = %for.cond.preheader
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(640000) %a, i8 -1, i64 640000, i1 false), !tbaa !5
store i32 0, ptr %arrayidx22, align 16, !tbaa !5
br label %for.cond88.preheader.preheader
if.then: ; preds = %for.end159, %entry
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 640000, ptr nonnull %a) #4
ret i32 0
for.cond5.preheader: ; preds = %for.body
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(640000) %a, i8 -1, i64 640000, i1 false), !tbaa !5
store i32 0, ptr %arrayidx22, align 16, !tbaa !5
%cmp24235 = icmp sgt i32 %2, 1
br i1 %cmp24235, label %for.cond26.preheader.preheader, label %for.cond88.preheader.preheader
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [201 x i32], ptr %n, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [201 x i32], ptr %d, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp1, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond26.preheader.preheader: ; preds = %for.cond5.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.cond26.preheader
for.cond26.preheader: ; preds = %for.cond26.preheader.preheader, %for.inc82
%indvars.iv271 = phi i64 [ 1, %for.cond26.preheader.preheader ], [ %indvars.iv.next272, %for.inc82 ]
%arrayidx37 = getelementptr inbounds [201 x i32], ptr %n, i64 0, i64 %indvars.iv271
%4 = load i32, ptr %arrayidx37, align 4, !tbaa !5
br label %for.cond29.preheader
for.cond29.preheader: ; preds = %for.cond26.preheader, %for.inc44
%indvars.iv267 = phi i64 [ 0, %for.cond26.preheader ], [ %indvars.iv.next268, %for.inc44 ]
br label %for.body31
for.body31: ; preds = %for.inc41.4, %for.cond29.preheader
%indvars.iv264 = phi i64 [ 0, %for.cond29.preheader ], [ %indvars.iv.next265.4, %for.inc41.4 ]
%arrayidx35 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv264, i64 %indvars.iv267
%5 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%cmp38 = icmp eq i32 %5, %4
br i1 %cmp38, label %loop_end.loopexit, label %for.inc41
for.inc41: ; preds = %for.body31
%indvars.iv.next265 = add nuw nsw i64 %indvars.iv264, 1
%arrayidx35.1 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv.next265, i64 %indvars.iv267
%6 = load i32, ptr %arrayidx35.1, align 4, !tbaa !5
%cmp38.1 = icmp eq i32 %6, %4
br i1 %cmp38.1, label %loop_end.loopexit, label %for.inc41.1
for.inc41.1: ; preds = %for.inc41
%indvars.iv.next265.1 = add nuw nsw i64 %indvars.iv264, 2
%arrayidx35.2 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv.next265.1, i64 %indvars.iv267
%7 = load i32, ptr %arrayidx35.2, align 4, !tbaa !5
%cmp38.2 = icmp eq i32 %7, %4
br i1 %cmp38.2, label %loop_end.loopexit, label %for.inc41.2
for.inc41.2: ; preds = %for.inc41.1
%indvars.iv.next265.2 = add nuw nsw i64 %indvars.iv264, 3
%arrayidx35.3 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv.next265.2, i64 %indvars.iv267
%8 = load i32, ptr %arrayidx35.3, align 4, !tbaa !5
%cmp38.3 = icmp eq i32 %8, %4
br i1 %cmp38.3, label %loop_end.loopexit, label %for.inc41.3
for.inc41.3: ; preds = %for.inc41.2
%indvars.iv.next265.3 = add nuw nsw i64 %indvars.iv264, 4
%arrayidx35.4 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv.next265.3, i64 %indvars.iv267
%9 = load i32, ptr %arrayidx35.4, align 4, !tbaa !5
%cmp38.4 = icmp eq i32 %9, %4
br i1 %cmp38.4, label %loop_end.loopexit, label %for.inc41.4
for.inc41.4: ; preds = %for.inc41.3
%indvars.iv.next265.4 = add nuw nsw i64 %indvars.iv264, 5
%exitcond.not.4 = icmp eq i64 %indvars.iv.next265.4, 400
br i1 %exitcond.not.4, label %for.inc44, label %for.body31, !llvm.loop !11
for.inc44: ; preds = %for.inc41.4
%indvars.iv.next268 = add nuw nsw i64 %indvars.iv267, 1
%exitcond270.not = icmp eq i64 %indvars.iv.next268, 400
br i1 %exitcond270.not, label %loop_end, label %for.cond29.preheader, !llvm.loop !12
loop_end.loopexit: ; preds = %for.inc41.3, %for.inc41.2, %for.inc41.1, %for.inc41, %for.body31
%indvars.iv264.lcssa = phi i64 [ %indvars.iv264, %for.body31 ], [ %indvars.iv.next265, %for.inc41 ], [ %indvars.iv.next265.1, %for.inc41.1 ], [ %indvars.iv.next265.2, %for.inc41.2 ], [ %indvars.iv.next265.3, %for.inc41.3 ]
%10 = trunc i64 %indvars.iv267 to i32
%11 = trunc i64 %indvars.iv264.lcssa to i32
br label %loop_end
loop_end: ; preds = %for.inc44, %loop_end.loopexit
%k.0228 = phi i32 [ %10, %loop_end.loopexit ], [ 400, %for.inc44 ]
%j.6 = phi i32 [ %11, %loop_end.loopexit ], [ 400, %for.inc44 ]
%arrayidx48 = getelementptr inbounds [201 x i32], ptr %d, i64 0, i64 %indvars.iv271
%12 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%13 = trunc i64 %indvars.iv271 to i32
switch i32 %12, label %if.else73 [
i32 0, label %if.then50
i32 1, label %if.then58
i32 2, label %if.then67
]
if.then50: ; preds = %loop_end
%idxprom51 = sext i32 %j.6 to i64
%sub = add nsw i32 %k.0228, -1
%idxprom53 = sext i32 %sub to i64
%arrayidx54 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom51, i64 %idxprom53
br label %for.inc82
if.then58: ; preds = %loop_end
%add = add nsw i32 %j.6, 1
%idxprom59 = sext i32 %add to i64
%idxprom61 = zext i32 %k.0228 to i64
%arrayidx62 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom59, i64 %idxprom61
br label %for.inc82
if.then67: ; preds = %loop_end
%idxprom68 = sext i32 %j.6 to i64
%add70 = add nuw nsw i32 %k.0228, 1
%idxprom71 = zext i32 %add70 to i64
%arrayidx72 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom68, i64 %idxprom71
br label %for.inc82
if.else73: ; preds = %loop_end
%sub74 = add nsw i32 %j.6, -1
%idxprom75 = sext i32 %sub74 to i64
%idxprom77 = zext i32 %k.0228 to i64
%arrayidx78 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom75, i64 %idxprom77
br label %for.inc82
for.inc82: ; preds = %if.then50, %if.then67, %if.else73, %if.then58
%arrayidx54.sink = phi ptr [ %arrayidx54, %if.then50 ], [ %arrayidx72, %if.then67 ], [ %arrayidx78, %if.else73 ], [ %arrayidx62, %if.then58 ]
store i32 %13, ptr %arrayidx54.sink, align 4, !tbaa !5
%indvars.iv.next272 = add nuw nsw i64 %indvars.iv271, 1
%exitcond274.not = icmp eq i64 %indvars.iv.next272, %wide.trip.count
br i1 %exitcond274.not, label %for.cond88.preheader.preheader, label %for.cond26.preheader, !llvm.loop !13
for.cond88.preheader.preheader: ; preds = %for.inc82, %for.cond5.preheader.thread, %for.cond5.preheader
br label %for.cond88.preheader
for.cond88.preheader: ; preds = %for.cond88.preheader.preheader, %for.inc101
%indvars.iv279 = phi i64 [ %indvars.iv.next280, %for.inc101 ], [ 0, %for.cond88.preheader.preheader ]
%left.1239 = phi i32 [ %left.2, %for.inc101 ], [ %left.0251, %for.cond88.preheader.preheader ]
%14 = trunc i64 %indvars.iv279 to i32
br label %for.body90
for.cond88: ; preds = %for.body90
%indvars.iv.next276 = add nuw nsw i64 %indvars.iv275, 1
%arrayidx94.1 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv.next276, i64 %indvars.iv279
%15 = load i32, ptr %arrayidx94.1, align 4, !tbaa !5
%cmp95.not.1 = icmp eq i32 %15, -1
br i1 %cmp95.not.1, label %for.cond88.1, label %for.inc101
for.cond88.1: ; preds = %for.cond88
%indvars.iv.next276.1 = add nuw nsw i64 %indvars.iv275, 2
%arrayidx94.2 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv.next276.1, i64 %indvars.iv279
%16 = load i32, ptr %arrayidx94.2, align 4, !tbaa !5
%cmp95.not.2 = icmp eq i32 %16, -1
br i1 %cmp95.not.2, label %for.cond88.2, label %for.inc101
for.cond88.2: ; preds = %for.cond88.1
%indvars.iv.next276.2 = add nuw nsw i64 %indvars.iv275, 3
%arrayidx94.3 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv.next276.2, i64 %indvars.iv279
%17 = load i32, ptr %arrayidx94.3, align 4, !tbaa !5
%cmp95.not.3 = icmp eq i32 %17, -1
br i1 %cmp95.not.3, label %for.cond88.3, label %for.inc101
for.cond88.3: ; preds = %for.cond88.2
%indvars.iv.next276.3 = add nuw nsw i64 %indvars.iv275, 4
%arrayidx94.4 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv.next276.3, i64 %indvars.iv279
%18 = load i32, ptr %arrayidx94.4, align 4, !tbaa !5
%cmp95.not.4 = icmp eq i32 %18, -1
br i1 %cmp95.not.4, label %for.cond88.4, label %for.inc101
for.cond88.4: ; preds = %for.cond88.3
%indvars.iv.next276.4 = add nuw nsw i64 %indvars.iv275, 5
%exitcond278.not.4 = icmp eq i64 %indvars.iv.next276.4, 400
br i1 %exitcond278.not.4, label %for.inc101, label %for.body90, !llvm.loop !14
for.body90: ; preds = %for.cond88.4, %for.cond88.preheader
%indvars.iv275 = phi i64 [ 0, %for.cond88.preheader ], [ %indvars.iv.next276.4, %for.cond88.4 ]
%arrayidx94 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv275, i64 %indvars.iv279
%19 = load i32, ptr %arrayidx94, align 4, !tbaa !5
%cmp95.not = icmp eq i32 %19, -1
br i1 %cmp95.not, label %for.cond88, label %for.inc101
for.inc101: ; preds = %for.cond88.4, %for.cond88.3, %for.cond88.2, %for.cond88.1, %for.cond88, %for.body90
%left.2 = phi i32 [ %14, %for.body90 ], [ %14, %for.cond88 ], [ %14, %for.cond88.1 ], [ %14, %for.cond88.2 ], [ %14, %for.cond88.3 ], [ %left.1239, %for.cond88.4 ]
%indvars.iv.next280 = add nuw nsw i64 %indvars.iv279, 1
%exitcond282.not = icmp eq i64 %indvars.iv.next280, 400
br i1 %exitcond282.not, label %for.cond107.preheader, label %for.cond88.preheader, !llvm.loop !15
for.cond107.preheader: ; preds = %for.inc101, %for.inc120
%indvars.iv287 = phi i64 [ %indvars.iv.next288, %for.inc120 ], [ 0, %for.inc101 ]
%front.1242 = phi i32 [ %front.2, %for.inc120 ], [ %front.0253, %for.inc101 ]
%20 = trunc i64 %indvars.iv287 to i32
br label %for.body109
for.cond107: ; preds = %for.body109
%indvars.iv.next284 = add nuw nsw i64 %indvars.iv283, 1
%arrayidx113.1 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv287, i64 %indvars.iv.next284
%21 = load i32, ptr %arrayidx113.1, align 4, !tbaa !5
%cmp114.not.1 = icmp eq i32 %21, -1
br i1 %cmp114.not.1, label %for.cond107.1, label %for.inc120
for.cond107.1: ; preds = %for.cond107
%indvars.iv.next284.1 = add nuw nsw i64 %indvars.iv283, 2
%arrayidx113.2 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv287, i64 %indvars.iv.next284.1
%22 = load i32, ptr %arrayidx113.2, align 4, !tbaa !5
%cmp114.not.2 = icmp eq i32 %22, -1
br i1 %cmp114.not.2, label %for.cond107.2, label %for.inc120
for.cond107.2: ; preds = %for.cond107.1
%indvars.iv.next284.2 = add nuw nsw i64 %indvars.iv283, 3
%arrayidx113.3 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv287, i64 %indvars.iv.next284.2
%23 = load i32, ptr %arrayidx113.3, align 4, !tbaa !5
%cmp114.not.3 = icmp eq i32 %23, -1
br i1 %cmp114.not.3, label %for.cond107.3, label %for.inc120
for.cond107.3: ; preds = %for.cond107.2
%indvars.iv.next284.3 = add nuw nsw i64 %indvars.iv283, 4
%arrayidx113.4 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv287, i64 %indvars.iv.next284.3
%24 = load i32, ptr %arrayidx113.4, align 4, !tbaa !5
%cmp114.not.4 = icmp eq i32 %24, -1
br i1 %cmp114.not.4, label %for.cond107.4, label %for.inc120
for.cond107.4: ; preds = %for.cond107.3
%indvars.iv.next284.4 = add nuw nsw i64 %indvars.iv283, 5
%exitcond286.not.4 = icmp eq i64 %indvars.iv.next284.4, 400
br i1 %exitcond286.not.4, label %for.inc120, label %for.body109, !llvm.loop !16
for.body109: ; preds = %for.cond107.4, %for.cond107.preheader
%indvars.iv283 = phi i64 [ 0, %for.cond107.preheader ], [ %indvars.iv.next284.4, %for.cond107.4 ]
%arrayidx113 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv287, i64 %indvars.iv283
%25 = load i32, ptr %arrayidx113, align 4, !tbaa !5
%cmp114.not = icmp eq i32 %25, -1
br i1 %cmp114.not, label %for.cond107, label %for.inc120
for.inc120: ; preds = %for.cond107.4, %for.cond107.3, %for.cond107.2, %for.cond107.1, %for.cond107, %for.body109
%front.2 = phi i32 [ %20, %for.body109 ], [ %20, %for.cond107 ], [ %20, %for.cond107.1 ], [ %20, %for.cond107.2 ], [ %20, %for.cond107.3 ], [ %front.1242, %for.cond107.4 ]
%indvars.iv.next288 = add nuw nsw i64 %indvars.iv287, 1
%exitcond290.not = icmp eq i64 %indvars.iv.next288, 400
br i1 %exitcond290.not, label %for.cond126.preheader, label %for.cond107.preheader, !llvm.loop !17
for.cond126.preheader: ; preds = %for.inc120, %for.inc138
%indvars.iv291 = phi i64 [ %indvars.iv.next292, %for.inc138 ], [ 399, %for.inc120 ]
%right.1245 = phi i32 [ %right.2, %for.inc138 ], [ %right.0252, %for.inc120 ]
%26 = trunc i64 %indvars.iv291 to i32
br label %for.body128
for.cond126: ; preds = %for.body128
%dec = add nsw i32 %i.5243, -1
%idxprom129.1 = zext i32 %dec to i64
%arrayidx132.1 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom129.1, i64 %indvars.iv291
%27 = load i32, ptr %arrayidx132.1, align 4, !tbaa !5
%cmp133.not.1 = icmp eq i32 %27, -1
br i1 %cmp133.not.1, label %for.cond126.1, label %for.inc138
for.cond126.1: ; preds = %for.cond126
%dec.1 = add nsw i32 %i.5243, -2
%idxprom129.2 = zext i32 %dec.1 to i64
%arrayidx132.2 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom129.2, i64 %indvars.iv291
%28 = load i32, ptr %arrayidx132.2, align 4, !tbaa !5
%cmp133.not.2 = icmp eq i32 %28, -1
br i1 %cmp133.not.2, label %for.cond126.2, label %for.inc138
for.cond126.2: ; preds = %for.cond126.1
%dec.2 = add nsw i32 %i.5243, -3
%idxprom129.3 = zext i32 %dec.2 to i64
%arrayidx132.3 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom129.3, i64 %indvars.iv291
%29 = load i32, ptr %arrayidx132.3, align 4, !tbaa !5
%cmp133.not.3 = icmp eq i32 %29, -1
br i1 %cmp133.not.3, label %for.cond126.3, label %for.inc138
for.cond126.3: ; preds = %for.cond126.2
%dec.3 = add nsw i32 %i.5243, -4
%idxprom129.4 = zext i32 %dec.3 to i64
%arrayidx132.4 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom129.4, i64 %indvars.iv291
%30 = load i32, ptr %arrayidx132.4, align 4, !tbaa !5
%cmp133.not.4 = icmp eq i32 %30, -1
br i1 %cmp133.not.4, label %for.cond126.4, label %for.inc138
for.cond126.4: ; preds = %for.cond126.3
%dec.4 = add nsw i32 %i.5243, -5
%cmp127.not.4 = icmp eq i32 %dec.3, 0
br i1 %cmp127.not.4, label %for.inc138, label %for.body128, !llvm.loop !18
for.body128: ; preds = %for.cond126.4, %for.cond126.preheader
%i.5243 = phi i32 [ 399, %for.cond126.preheader ], [ %dec.4, %for.cond126.4 ]
%idxprom129 = zext i32 %i.5243 to i64
%arrayidx132 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %idxprom129, i64 %indvars.iv291
%31 = load i32, ptr %arrayidx132, align 4, !tbaa !5
%cmp133.not = icmp eq i32 %31, -1
br i1 %cmp133.not, label %for.cond126, label %for.inc138
for.inc138: ; preds = %for.cond126.4, %for.cond126.3, %for.cond126.2, %for.cond126.1, %for.cond126, %for.body128
%right.2 = phi i32 [ %26, %for.body128 ], [ %26, %for.cond126 ], [ %26, %for.cond126.1 ], [ %26, %for.cond126.2 ], [ %26, %for.cond126.3 ], [ %right.1245, %for.cond126.4 ]
%indvars.iv.next292 = add nsw i64 %indvars.iv291, -1
%cmp124.not = icmp eq i64 %indvars.iv291, 0
br i1 %cmp124.not, label %for.cond144.preheader, label %for.cond126.preheader, !llvm.loop !19
for.cond144.preheader: ; preds = %for.inc138, %for.inc157
%indvars.iv294 = phi i64 [ %indvars.iv.next295, %for.inc157 ], [ 399, %for.inc138 ]
%back.1248 = phi i32 [ %back.2, %for.inc157 ], [ %back.0254, %for.inc138 ]
%32 = trunc i64 %indvars.iv294 to i32
br label %for.body146
for.body146: ; preds = %for.inc154.4, %for.cond144.preheader
%j.11246 = phi i32 [ 399, %for.cond144.preheader ], [ %dec155.4, %for.inc154.4 ]
%idxprom149 = zext i32 %j.11246 to i64
%arrayidx150 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv294, i64 %idxprom149
%33 = load i32, ptr %arrayidx150, align 4, !tbaa !5
%cmp151.not = icmp eq i32 %33, -1
br i1 %cmp151.not, label %for.inc154, label %for.inc157
for.inc154: ; preds = %for.body146
%dec155 = add nsw i32 %j.11246, -1
%idxprom149.1 = zext i32 %dec155 to i64
%arrayidx150.1 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv294, i64 %idxprom149.1
%34 = load i32, ptr %arrayidx150.1, align 4, !tbaa !5
%cmp151.not.1 = icmp eq i32 %34, -1
br i1 %cmp151.not.1, label %for.inc154.1, label %for.inc157
for.inc154.1: ; preds = %for.inc154
%dec155.1 = add nsw i32 %j.11246, -2
%idxprom149.2 = zext i32 %dec155.1 to i64
%arrayidx150.2 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv294, i64 %idxprom149.2
%35 = load i32, ptr %arrayidx150.2, align 4, !tbaa !5
%cmp151.not.2 = icmp eq i32 %35, -1
br i1 %cmp151.not.2, label %for.inc154.2, label %for.inc157
for.inc154.2: ; preds = %for.inc154.1
%dec155.2 = add nsw i32 %j.11246, -3
%idxprom149.3 = zext i32 %dec155.2 to i64
%arrayidx150.3 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv294, i64 %idxprom149.3
%36 = load i32, ptr %arrayidx150.3, align 4, !tbaa !5
%cmp151.not.3 = icmp eq i32 %36, -1
br i1 %cmp151.not.3, label %for.inc154.3, label %for.inc157
for.inc154.3: ; preds = %for.inc154.2
%dec155.3 = add nsw i32 %j.11246, -4
%idxprom149.4 = zext i32 %dec155.3 to i64
%arrayidx150.4 = getelementptr inbounds [400 x [400 x i32]], ptr %a, i64 0, i64 %indvars.iv294, i64 %idxprom149.4
%37 = load i32, ptr %arrayidx150.4, align 4, !tbaa !5
%cmp151.not.4 = icmp eq i32 %37, -1
br i1 %cmp151.not.4, label %for.inc154.4, label %for.inc157
for.inc154.4: ; preds = %for.inc154.3
%dec155.4 = add nsw i32 %j.11246, -5
%cmp145.not.4 = icmp eq i32 %dec155.3, 0
br i1 %cmp145.not.4, label %for.inc157, label %for.body146, !llvm.loop !20
for.inc157: ; preds = %for.inc154.4, %for.inc154.3, %for.inc154.2, %for.inc154.1, %for.inc154, %for.body146
%back.2 = phi i32 [ %32, %for.body146 ], [ %32, %for.inc154 ], [ %32, %for.inc154.1 ], [ %32, %for.inc154.2 ], [ %32, %for.inc154.3 ], [ %back.1248, %for.inc154.4 ]
%indvars.iv.next295 = add nsw i64 %indvars.iv294, -1
%cmp142.not = icmp eq i64 %indvars.iv294, 0
br i1 %cmp142.not, label %for.end159, label %for.cond144.preheader, !llvm.loop !21
for.end159: ; preds = %for.inc157
%sub160 = add i32 %left.2, 1
%add161 = sub i32 %sub160, %right.2
%sub162 = add i32 %front.2, 1
%add163 = sub i32 %sub162, %back.2
%call164 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add161, i32 noundef %add163)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%38 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp eq i32 %38, 0
br i1 %cmp, label %if.then, label %for.cond.preheader
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
/**
Queen Chess
*/
/* include */
#include <stdio.h>
#include <stdlib.h>
/* define */
#define MAX 8
#define BLACK 1 //queen exist
#define WHITE 0 //queen non-exist
#define TRUE 1
#define FALSE -1
/* prototype */
int search(int);
void printing();
/* global */
//X????????????Y????¨???????JUDGE????????????ULLR(Upper Left, Lower Right)???URLL(Upper Right, Lower Left)
int X[MAX], Y[MAX], JUDGE[MAX][MAX], URLL[2*MAX-1], ULLR[2*MAX-1];
int top=1;
int main() {
int i,j, k, r,c;
/*?????????????????????*/
//?????????????¨?????¨??????????
for(i=0;i<MAX;i++){
X[i] = WHITE;
Y[i] = WHITE;
}
//?¬??????????????¨??????????
for(i=0;i<2*MAX-1;i++){
URLL[i] = WHITE;
ULLR[i] = WHITE;
}
//??????????????????
for(i=0;i<MAX;i++){
for(j=0;j<MAX;j++){
JUDGE[i][j] = FALSE;
}
}
//input
scanf("%d", &k); //????????????????????¨??????????????°
for(i=0;i<k;i++){
scanf("%d %d",&r,&c); //r??????,c????¨?
JUDGE[r][c] = TRUE; //?????¨
}
//0???????????????????????????????????????????§£?????¢?´¢
search(0);
return 0;
}
/** ?????????????????????????????????????????????????????¢?´¢
* x?????????????????????????????????????????´??????x?????????????????????????????§????????¨????????????
* ?????????????????£??????????????????????????????????????????
* ?????°????????¨???????????¨??§????????£???????????¶?????????????????????????????¨?????§??????
*/
int search(int x){
int y;
if(x==MAX) { //?????????????????§?????????????????°???????????¶?????°????????§???..????¶???????
printing(); //?????????????????????????±??????£?????????????????¶????????????
return 0;
}
for(y=0;y<MAX;y++){
if(Y[y]==BLACK || URLL[x+y]==BLACK || ULLR[x-y+MAX-1]==BLACK){
continue; //??¨???????????????????????????????¬????for()???
}
//x???????????????????????????????????????????????????????????\??¨?????¢????????????BLACK?????????
X[x] = y; //<?\????>???????????¨??????...
Y[y] = BLACK; //????????????
URLL[x+y] = BLACK; //?????´????????????
ULLR[x-y+MAX-1] = BLACK; //??????????????????
//?¬????????????¢?´¢
search(x+1); //<?\????>??????????¬?????????\???????§???????????????????...
//???????????????????????????????????????
X[x] = WHITE; //<?\????>??????????????\??§????????????????????§??????...????????????????????????
Y[y] = WHITE; //??????...
URLL[x+y] = WHITE; //??????...
ULLR[x-y+MAX-1] = WHITE; //????????????...
}
return 0;
}
/*??????*/
void printing(){
int i,j;
for(i=0;i<MAX;i++){
for(j=0;j<MAX;j++){
if(JUDGE[i][j] == TRUE) { //?????????????????????????????°
if(X[i]!=j){
return;
}
}
}
}
for(i=0;i<MAX;i++) {
for(j=0;j<MAX;j++) {
if(X[i]==j) {
printf("Q");
}else{
printf(".");
}
}
printf("\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232635/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232635/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@top = dso_local local_unnamed_addr global i32 1, align 4
@X = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@Y = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@URLL = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@ULLR = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@JUDGE = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @X, i8 0, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @Y, i8 0, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @URLL, i8 0, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @ULLR, i8 0, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) @JUDGE, i8 -1, i64 256, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp3059 = icmp sgt i32 %0, 0
br i1 %cmp3059, label %for.body31, label %for.end39
for.body31: ; preds = %entry, %for.body31
%i.360 = phi i32 [ %inc38, %for.body31 ], [ 0, %entry ]
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom33 = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom35 = sext i32 %2 to i64
%arrayidx36 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %idxprom33, i64 %idxprom35
store i32 1, ptr %arrayidx36, align 4, !tbaa !5
%inc38 = add nuw nsw i32 %i.360, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp30 = icmp slt i32 %inc38, %3
br i1 %cmp30, label %for.body31, label %for.end39, !llvm.loop !9
for.end39: ; preds = %for.body31, %entry
%call40 = call i32 @search(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @search(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %x, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %x, 7
%idxprom14 = sext i32 %x to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @X, i64 0, i64 %idxprom14
%add26 = add nsw i32 %x, 1
%0 = load i32, ptr @Y, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, 1
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @printing()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @URLL, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, 1
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @ULLR, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, 1
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr @Y, align 16, !tbaa !5
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
store i32 1, ptr %arrayidx10, align 4, !tbaa !5
%call = tail call i32 @search(i32 noundef %add26)
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 0, ptr @Y, align 16, !tbaa !5
store i32 0, ptr %arrayidx4, align 4, !tbaa !5
store i32 0, ptr %arrayidx10, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, 1
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @URLL, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, 1
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %x, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @ULLR, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, 1
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 1), align 4, !tbaa !5
store i32 1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.1, align 4, !tbaa !5
%call.1 = tail call i32 @search(i32 noundef %add26)
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 1), align 4, !tbaa !5
store i32 0, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, 1
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @URLL, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, 1
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %x, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @ULLR, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, 1
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 2), align 8, !tbaa !5
store i32 1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.2, align 4, !tbaa !5
%call.2 = tail call i32 @search(i32 noundef %add26)
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 2), align 8, !tbaa !5
store i32 0, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, 1
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @URLL, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, 1
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %x, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @ULLR, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, 1
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 3), align 4, !tbaa !5
store i32 1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.3, align 4, !tbaa !5
%call.3 = tail call i32 @search(i32 noundef %add26)
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 3), align 4, !tbaa !5
store i32 0, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, 1
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @URLL, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, 1
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %x, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @ULLR, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, 1
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 4), align 16, !tbaa !5
store i32 1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.4, align 4, !tbaa !5
%call.4 = tail call i32 @search(i32 noundef %add26)
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 4), align 16, !tbaa !5
store i32 0, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 0, ptr %arrayidx10.4, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, 1
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @URLL, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, 1
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %x, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @ULLR, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, 1
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 5), align 4, !tbaa !5
store i32 1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.5, align 4, !tbaa !5
%call.5 = tail call i32 @search(i32 noundef %add26)
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 5), align 4, !tbaa !5
store i32 0, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 0, ptr %arrayidx10.5, align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, 1
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @URLL, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, 1
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %x, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @ULLR, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, 1
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 6), align 8, !tbaa !5
store i32 1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.6, align 4, !tbaa !5
%call.6 = tail call i32 @search(i32 noundef %add26)
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 6), align 8, !tbaa !5
store i32 0, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 0, ptr %arrayidx10.6, align 4, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, 1
br i1 %cmp2.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @URLL, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, 1
br i1 %cmp5.7, label %common.ret, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @ULLR, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, 1
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false6.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
%common.ret.op = phi i32 [ 0, %if.end13.7 ], [ 0, %for.inc.6 ], [ 0, %lor.lhs.false.7 ], [ 0, %lor.lhs.false6.7 ], [ 0, %if.then ]
ret i32 %common.ret.op
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 7), align 4, !tbaa !5
store i32 1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.7, align 4, !tbaa !5
%call.7 = tail call i32 @search(i32 noundef %add26)
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @Y, i64 0, i64 7), align 4, !tbaa !5
store i32 0, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 0, ptr %arrayidx10.7, align 4, !tbaa !5
br label %common.ret
}
; 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 @printing() local_unnamed_addr #0 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx8 = getelementptr inbounds [8 x i32], ptr @X, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%cmp6 = icmp eq i32 %0, 1
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp eq i32 %1, 0
br i1 %cmp9.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%cmp6.1 = icmp eq i32 %2, 1
br i1 %cmp6.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.1 = icmp eq i32 %3, 1
br i1 %cmp9.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%cmp6.2 = icmp eq i32 %4, 1
br i1 %cmp6.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.2 = icmp eq i32 %5, 2
br i1 %cmp9.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%cmp6.3 = icmp eq i32 %6, 1
br i1 %cmp6.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.3 = icmp eq i32 %7, 3
br i1 %cmp9.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx5.4, align 16, !tbaa !5
%cmp6.4 = icmp eq i32 %8, 1
br i1 %cmp6.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.4 = icmp eq i32 %9, 4
br i1 %cmp9.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%cmp6.5 = icmp eq i32 %10, 1
br i1 %cmp6.5, label %if.then.5, label %for.inc.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.5 = icmp eq i32 %11, 5
br i1 %cmp9.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx5.6, align 8, !tbaa !5
%cmp6.6 = icmp eq i32 %12, 1
br i1 %cmp6.6, label %if.then.6, label %for.inc.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.6 = icmp eq i32 %13, 6
br i1 %cmp9.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i32]], ptr @JUDGE, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%cmp6.7 = icmp eq i32 %14, 1
br i1 %cmp6.7, label %if.then.7, label %for.inc.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.7 = icmp eq i32 %15, 7
br i1 %cmp9.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond18.preheader, label %for.cond1.preheader, !llvm.loop !11
for.cond18.preheader: ; preds = %for.inc.7, %for.cond18.preheader
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.cond18.preheader ], [ 0, %for.inc.7 ]
%arrayidx22 = getelementptr inbounds [8 x i32], ptr @X, i64 0, i64 %indvars.iv58
%16 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp eq i32 %16, 0
%. = select i1 %cmp23, i32 81, i32 46
%putchar48 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.1 = icmp eq i32 %17, 1
%.sink63 = select i1 %cmp23.1, i32 81, i32 46
%putchar48.1 = tail call i32 @putchar(i32 %.sink63)
%18 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.2 = icmp eq i32 %18, 2
%.sink64 = select i1 %cmp23.2, i32 81, i32 46
%putchar48.2 = tail call i32 @putchar(i32 %.sink64)
%19 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.3 = icmp eq i32 %19, 3
%.sink65 = select i1 %cmp23.3, i32 81, i32 46
%putchar48.3 = tail call i32 @putchar(i32 %.sink65)
%20 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.4 = icmp eq i32 %20, 4
%.sink66 = select i1 %cmp23.4, i32 81, i32 46
%putchar48.4 = tail call i32 @putchar(i32 %.sink66)
%21 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.5 = icmp eq i32 %21, 5
%.sink67 = select i1 %cmp23.5, i32 81, i32 46
%putchar48.5 = tail call i32 @putchar(i32 %.sink67)
%22 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.6 = icmp eq i32 %22, 6
%.sink68 = select i1 %cmp23.6, i32 81, i32 46
%putchar48.6 = tail call i32 @putchar(i32 %.sink68)
%23 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.7 = icmp eq i32 %23, 7
%.sink69 = select i1 %cmp23.7, i32 81, i32 46
%putchar48.7 = tail call i32 @putchar(i32 %.sink69)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%exitcond61.not = icmp eq i64 %indvars.iv.next59, 8
br i1 %exitcond61.not, label %cleanup, label %for.cond18.preheader, !llvm.loop !12
cleanup: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond18.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#define N 8
#define FREE -1
#define NFREE 1
#define EXIST -10
void initialize(void);
void printQ(void);
void putqueen(int);
int row[N],col[N],dpos[2*N-1],dneg[2*N-1],X[N][N];
int main(){
int i,k,r,c;
initialize();
scanf("%d",&k);
for(i = 0;i < k;i++){
scanf("%d%d",&r,&c);
X[r][c]=EXIST;
}
putqueen(0);
return 0;
}
void initialize() {
int i,j;
for(i = 0;i < N;i++){
row[i]=FREE;
col[i]=FREE;
}
for(j = 0;j < 2*N-1;j++){
dpos[j]=FREE;
dneg[j]=FREE;
}
}
void printQ(){
int i,j;
for(i = 0;i < N;i++){
for(j = 0;j < N;j++){
if(X[i][j]){
if(row[i]!=j) return;
}
}
}
for(i = 0;i < N;i++){
for(j = 0;j < N;j++){
if(row[i]==j){
printf("Q");
}
else printf(".");
}
printf("\n");
}
}
void putqueen(int i){
int j;
if(i == N){
printQ();
return;
}
for(j = 0;j < N;j++){
if(col[j]==NFREE || dpos[i+j]==NFREE || dneg[i-j+N-1]==NFREE) continue;
row[i]=j;
col[j]=dpos[i+j]=dneg[i-j+N-1]=NFREE;
putqueen(i+1);
col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232679/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232679/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@X = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@row = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom2 = sext i32 %2 to i64
%arrayidx3 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %idxprom, i64 %idxprom2
store i32 -10, ptr %arrayidx3, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.06, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @putqueen(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #2 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @putqueen(i32 noundef %i) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %i, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %i, 7
%idxprom14 = sext i32 %i to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %idxprom14
%add26 = add nsw i32 %i, 1
%0 = load i32, ptr @col, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, 1
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @printQ()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, 1
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, 1
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10, align 4, !tbaa !5
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
store i32 1, ptr @col, align 16, !tbaa !5
tail call void @putqueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4, align 4, !tbaa !5
store i32 -1, ptr @col, align 16, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, 1
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, 1
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %i, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, 1
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
tail call void @putqueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, 1
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, 1
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %i, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, 1
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
tail call void @putqueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, 1
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, 1
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %i, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, 1
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
tail call void @putqueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, 1
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, 1
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %i, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, 1
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
tail call void @putqueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, 1
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, 1
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %i, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, 1
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
tail call void @putqueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, 1
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, 1
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %i, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, 1
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
tail call void @putqueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, 1
br i1 %cmp2.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, 1
br i1 %cmp5.7, label %common.ret, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, 1
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false6.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
ret void
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
tail call void @putqueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
br label %common.ret
}
; 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 @printQ() local_unnamed_addr #0 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx7 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %for.inc, label %if.then
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not = icmp eq i32 %1, 0
br i1 %cmp8.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %2, 0
br i1 %tobool.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.1 = icmp eq i32 %3, 1
br i1 %cmp8.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%tobool.not.2 = icmp eq i32 %4, 0
br i1 %tobool.not.2, label %for.inc.2, label %if.then.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.2 = icmp eq i32 %5, 2
br i1 %cmp8.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%tobool.not.3 = icmp eq i32 %6, 0
br i1 %tobool.not.3, label %for.inc.3, label %if.then.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.3 = icmp eq i32 %7, 3
br i1 %cmp8.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx5.4, align 16, !tbaa !5
%tobool.not.4 = icmp eq i32 %8, 0
br i1 %tobool.not.4, label %for.inc.4, label %if.then.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.4 = icmp eq i32 %9, 4
br i1 %cmp8.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%tobool.not.5 = icmp eq i32 %10, 0
br i1 %tobool.not.5, label %for.inc.5, label %if.then.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.5 = icmp eq i32 %11, 5
br i1 %cmp8.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx5.6, align 8, !tbaa !5
%tobool.not.6 = icmp eq i32 %12, 0
br i1 %tobool.not.6, label %for.inc.6, label %if.then.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.6 = icmp eq i32 %13, 6
br i1 %cmp8.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%tobool.not.7 = icmp eq i32 %14, 0
br i1 %tobool.not.7, label %for.inc.7, label %if.then.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.7 = icmp eq i32 %15, 7
br i1 %cmp8.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond17.preheader, label %for.cond1.preheader, !llvm.loop !11
for.cond17.preheader: ; preds = %for.inc.7, %for.cond17.preheader
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.cond17.preheader ], [ 0, %for.inc.7 ]
%arrayidx21 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv57
%16 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp eq i32 %16, 0
%. = select i1 %cmp22, i32 81, i32 46
%putchar47 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.1 = icmp eq i32 %17, 1
%.sink62 = select i1 %cmp22.1, i32 81, i32 46
%putchar47.1 = tail call i32 @putchar(i32 %.sink62)
%18 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.2 = icmp eq i32 %18, 2
%.sink63 = select i1 %cmp22.2, i32 81, i32 46
%putchar47.2 = tail call i32 @putchar(i32 %.sink63)
%19 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.3 = icmp eq i32 %19, 3
%.sink64 = select i1 %cmp22.3, i32 81, i32 46
%putchar47.3 = tail call i32 @putchar(i32 %.sink64)
%20 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.4 = icmp eq i32 %20, 4
%.sink65 = select i1 %cmp22.4, i32 81, i32 46
%putchar47.4 = tail call i32 @putchar(i32 %.sink65)
%21 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.5 = icmp eq i32 %21, 5
%.sink66 = select i1 %cmp22.5, i32 81, i32 46
%putchar47.5 = tail call i32 @putchar(i32 %.sink66)
%22 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.6 = icmp eq i32 %22, 6
%.sink67 = select i1 %cmp22.6, i32 81, i32 46
%putchar47.6 = tail call i32 @putchar(i32 %.sink67)
%23 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.7 = icmp eq i32 %23, 7
%.sink68 = select i1 %cmp22.7, i32 81, i32 46
%putchar47.7 = tail call i32 @putchar(i32 %.sink68)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond60.not = icmp eq i64 %indvars.iv.next58, 8
br i1 %exitcond60.not, label %cleanup, label %for.cond17.preheader, !llvm.loop !12
cleanup: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond17.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { mustprogress nofree nosync nounwind willreturn 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 #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: write) }
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>
#define N 8
#define TRUE 3
#define FALSE 2
#define FREE -1
#define NOT_FREE 1
int X[N][N];
int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
void syokika(){
int i;
for(i=0;i<N;i++){
row[i]=FREE;
col[i]=FREE;
}
for(i=0;i<2*N-1;i++){
dpos[i]=FREE;
dneg[i]=FREE;
}
}
void printboard(){
int i,j;
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(X[i][j]==TRUE){
if(row[i]!=j) return;
}
}
}
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(row[i]==j)printf("Q");
else printf(".");
}
printf("\n");
}
}
void putQueen(int a){
int j;
if(a==N){
printboard();
return;
}
for(j=0;j<N;j++){
if(col[j]==NOT_FREE || dpos[a+j]==NOT_FREE || dneg[a-j+N-1]==NOT_FREE) continue;
row[a]=j;
col[j]=dpos[a+j]=dneg[a-j+N-1]=NOT_FREE;
putQueen(a+1);
col[j]=dpos[a+j]=dneg[a-j+N-1]=FREE;
}
}
int main(){
int i,j,k,r,c;
syokika();
for(i=0;i<N;i++){
for(j=0;j<N;j++){
X[i][j]=FALSE;
}
}
scanf("%d",&k);
for(i=0;i<k;i++){
scanf("%d%d",&r,&c);
X[r][c]=TRUE;
}
putQueen(0);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232729/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232729/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@row = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@X = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @syokika() local_unnamed_addr #0 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printboard() local_unnamed_addr #2 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx8 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%cmp6 = icmp eq i32 %0, 3
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp eq i32 %1, 0
br i1 %cmp9.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%cmp6.1 = icmp eq i32 %2, 3
br i1 %cmp6.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.1 = icmp eq i32 %3, 1
br i1 %cmp9.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%cmp6.2 = icmp eq i32 %4, 3
br i1 %cmp6.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.2 = icmp eq i32 %5, 2
br i1 %cmp9.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%cmp6.3 = icmp eq i32 %6, 3
br i1 %cmp6.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.3 = icmp eq i32 %7, 3
br i1 %cmp9.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx5.4, align 16, !tbaa !5
%cmp6.4 = icmp eq i32 %8, 3
br i1 %cmp6.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.4 = icmp eq i32 %9, 4
br i1 %cmp9.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%cmp6.5 = icmp eq i32 %10, 3
br i1 %cmp6.5, label %if.then.5, label %for.inc.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.5 = icmp eq i32 %11, 5
br i1 %cmp9.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx5.6, align 8, !tbaa !5
%cmp6.6 = icmp eq i32 %12, 3
br i1 %cmp6.6, label %if.then.6, label %for.inc.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.6 = icmp eq i32 %13, 6
br i1 %cmp9.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%cmp6.7 = icmp eq i32 %14, 3
br i1 %cmp6.7, label %if.then.7, label %for.inc.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.7 = icmp eq i32 %15, 7
br i1 %cmp9.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond18.preheader, label %for.cond1.preheader, !llvm.loop !9
for.cond18.preheader: ; preds = %for.inc.7, %for.cond18.preheader
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.cond18.preheader ], [ 0, %for.inc.7 ]
%arrayidx22 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv58
%16 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp eq i32 %16, 0
%. = select i1 %cmp23, i32 81, i32 46
%putchar48 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.1 = icmp eq i32 %17, 1
%.sink63 = select i1 %cmp23.1, i32 81, i32 46
%putchar48.1 = tail call i32 @putchar(i32 %.sink63)
%18 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.2 = icmp eq i32 %18, 2
%.sink64 = select i1 %cmp23.2, i32 81, i32 46
%putchar48.2 = tail call i32 @putchar(i32 %.sink64)
%19 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.3 = icmp eq i32 %19, 3
%.sink65 = select i1 %cmp23.3, i32 81, i32 46
%putchar48.3 = tail call i32 @putchar(i32 %.sink65)
%20 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.4 = icmp eq i32 %20, 4
%.sink66 = select i1 %cmp23.4, i32 81, i32 46
%putchar48.4 = tail call i32 @putchar(i32 %.sink66)
%21 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.5 = icmp eq i32 %21, 5
%.sink67 = select i1 %cmp23.5, i32 81, i32 46
%putchar48.5 = tail call i32 @putchar(i32 %.sink67)
%22 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.6 = icmp eq i32 %22, 6
%.sink68 = select i1 %cmp23.6, i32 81, i32 46
%putchar48.6 = tail call i32 @putchar(i32 %.sink68)
%23 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.7 = icmp eq i32 %23, 7
%.sink69 = select i1 %cmp23.7, i32 81, i32 46
%putchar48.7 = tail call i32 @putchar(i32 %.sink69)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%exitcond61.not = icmp eq i64 %indvars.iv.next59, 8
br i1 %exitcond61.not, label %cleanup, label %for.cond18.preheader, !llvm.loop !11
cleanup: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond18.preheader
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @putQueen(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp = icmp eq i32 %a, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %a, 7
%idxprom14 = sext i32 %a to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %idxprom14
%add26 = add nsw i32 %a, 1
%0 = load i32, ptr @col, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, 1
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @printboard()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, 1
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, 1
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10, align 4, !tbaa !5
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
store i32 1, ptr @col, align 16, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4, align 4, !tbaa !5
store i32 -1, ptr @col, align 16, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, 1
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, 1
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %a, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, 1
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, 1
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, 1
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %a, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, 1
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, 1
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, 1
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %a, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, 1
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, 1
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, 1
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %a, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, 1
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, 1
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, 1
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %a, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, 1
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, 1
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, 1
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %a, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, 1
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, 1
br i1 %cmp2.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, 1
br i1 %cmp5.7, label %common.ret, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, 1
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false6.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
ret void
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
br label %common.ret
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr @X, align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 1, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 1, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 2, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 2, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 3, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 3, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 4, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 4, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 5, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 5, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 6, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 6, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 7, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @X, i64 0, i64 7, i64 4), align 16, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp1028 = icmp sgt i32 %0, 0
br i1 %cmp1028, label %for.body11, label %for.end19
for.body11: ; preds = %entry, %for.body11
%i.129 = phi i32 [ %inc18, %for.body11 ], [ 0, %entry ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom13 = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom15 = sext i32 %2 to i64
%arrayidx16 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %idxprom13, i64 %idxprom15
store i32 3, ptr %arrayidx16, align 4, !tbaa !5
%inc18 = add nuw nsw i32 %i.129, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc18, %3
br i1 %cmp10, label %for.body11, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body11, %entry
call void @putQueen(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn 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 #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: write) }
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>
#include<stdlib.h>
int a[100010][2];
int b[100010];
int n,v;
int cmp(const void *aa,const void *bb) {
int *a=(int *)aa,*b=(int *)bb;
if (a[0]<b[0]) return -1; else if (a[0]>b[0]) return 1;
else if (a[1]>b[1]) return -1; else if (a[1]<b[1]) return 1;
return 0;
}
int cal(int a[][2],int n) {
int l,r,i,ret=0;
b[ret++]=a[0][1];
for(i=1;i<n;i++) {
if (a[i][0]<a[0][0]) continue;
for(l=0,r=ret;l<r;)
if (b[(l+r)/2]>=a[i][1]) l=(l+r)/2+1; else r=(l+r)/2;
if (l==0) continue;
b[l]=a[i][1];
if (l==ret) ret++;
}
return ret;
}
int main() {
int i,x,t;
scanf("%d",&n);
for(i=1;i<=n;i++) scanf("%d %d",&a[i][0],&a[i][1]);
scanf("%d",&v);
for(i=1;i<=n;i++) {
x=a[i][0],t=a[i][1];
a[i][0]=x+v*t;
a[i][1]=x-v*t;
}
qsort(a+1,n,sizeof(a[0]),cmp);
a[0][0]=a[0][1]=0;
t=cal(a,n+1);
a[0][0]=-2000000000;
a[0][1]=2000000000;
printf("%d %d\n",t-1,cal(a,n+1)-1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23278/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23278/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@b = dso_local local_unnamed_addr global [100010 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@a = dso_local global [100010 x [2 x i32]] zeroinitializer, align 16
@v = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %aa, ptr nocapture noundef readonly %bb) #0 {
entry:
%0 = load i32, ptr %aa, align 4, !tbaa !5
%1 = load i32, ptr %bb, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp4 = icmp sgt i32 %0, %1
br i1 %cmp4, label %cleanup, label %if.else6
if.else6: ; preds = %if.else
%arrayidx7 = getelementptr inbounds i32, ptr %aa, i64 1
%2 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%arrayidx8 = getelementptr inbounds i32, ptr %bb, i64 1
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %2, %3
br i1 %cmp9, label %cleanup, label %if.else11
if.else11: ; preds = %if.else6
%cmp14 = icmp slt i32 %2, %3
%. = zext i1 %cmp14 to i32
br label %cleanup
cleanup: ; preds = %if.else11, %if.else6, %if.else, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.else ], [ -1, %if.else6 ], [ %., %if.else11 ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @cal(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%arrayidx1 = getelementptr inbounds [2 x i32], ptr %a, i64 0, i64 1
%0 = load i32, ptr %arrayidx1, align 4, !tbaa !5
store i32 %0, ptr @b, align 16, !tbaa !5
%cmp63 = icmp sgt i32 %n, 1
br i1 %cmp63, label %for.body.preheader, label %for.end38
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%ret.065 = phi i32 [ 1, %for.body.preheader ], [ %ret.1, %for.inc ]
%arrayidx4 = getelementptr inbounds [2 x i32], ptr %a, i64 %indvars.iv
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp8 = icmp sge i32 %1, %2
%cmp1060 = icmp sgt i32 %ret.065, 0
%or.cond = select i1 %cmp8, i1 %cmp1060, i1 false
br i1 %or.cond, label %for.body11.lr.ph, label %for.inc
for.body11.lr.ph: ; preds = %for.body
%arrayidx16 = getelementptr inbounds [2 x i32], ptr %a, i64 %indvars.iv, i64 1
%3 = load i32, ptr %arrayidx16, align 4, !tbaa !5
br label %for.body11
for.body11: ; preds = %for.body11.lr.ph, %for.body11
%r.062 = phi i32 [ %ret.065, %for.body11.lr.ph ], [ %r.1, %for.body11 ]
%l.061 = phi i32 [ 0, %for.body11.lr.ph ], [ %l.1, %for.body11 ]
%add = add nsw i32 %r.062, %l.061
%div = sdiv i32 %add, 2
%idxprom12 = sext i32 %div to i64
%arrayidx13 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %idxprom12
%4 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp17.not = icmp slt i32 %4, %3
%add21 = add nsw i32 %div, 1
%l.1 = select i1 %cmp17.not, i32 %l.061, i32 %add21
%r.1 = select i1 %cmp17.not, i32 %div, i32 %r.062
%cmp10 = icmp slt i32 %l.1, %r.1
br i1 %cmp10, label %for.body11, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body11
%cmp25 = icmp eq i32 %l.1, 0
br i1 %cmp25, label %for.inc, label %if.end27
if.end27: ; preds = %for.end
%arrayidx30 = getelementptr inbounds [2 x i32], ptr %a, i64 %indvars.iv, i64 1
%5 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%idxprom31 = sext i32 %l.1 to i64
%arrayidx32 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %idxprom31
store i32 %5, ptr %arrayidx32, align 4, !tbaa !5
%cmp33 = icmp eq i32 %l.1, %ret.065
%inc35 = zext i1 %cmp33 to i32
%spec.select = add nsw i32 %ret.065, %inc35
br label %for.inc
for.inc: ; preds = %if.end27, %for.end, %for.body
%ret.1 = phi i32 [ %ret.065, %for.body ], [ %ret.065, %for.end ], [ %spec.select, %if.end27 ]
%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.end38, label %for.body, !llvm.loop !11
for.end38: ; preds = %for.inc, %entry
%ret.0.lcssa = phi i32 [ 1, %entry ], [ %ret.1, %for.inc ]
ret i32 %ret.0.lcssa
}
; 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)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not87 = icmp slt i32 %0, 1
br i1 %cmp.not87, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100010 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [100010 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv, i64 1
%call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%call6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @v)
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp8.not89 = icmp slt i32 %3, 1
br i1 %cmp8.not89, label %for.end25, label %for.body9.lr.ph
for.body9.lr.ph: ; preds = %for.end
%4 = load i32, ptr @v, align 4, !tbaa !5
%5 = add nuw i32 %3, 1
%wide.trip.count = zext i32 %5 to i64
%6 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp eq i32 %3, 1
br i1 %min.iters.check, label %for.body9.preheader, label %vector.ph
vector.ph: ; preds = %for.body9.lr.ph
%n.vec = and i64 %6, -2
%ind.end = or i64 %6, 1
%broadcast.splatinsert = insertelement <2 x i32> poison, i32 %4, i64 0
%broadcast.splat = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = or i64 %index, 1
%7 = getelementptr inbounds [100010 x [2 x i32]], ptr @a, i64 0, i64 %offset.idx
%wide.vec = load <4 x i32>, ptr %7, align 8, !tbaa !5
%strided.vec = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
%strided.vec95 = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
%8 = mul nsw <2 x i32> %broadcast.splat, %strided.vec95
%9 = add nsw <2 x i32> %8, %strided.vec
%10 = sub nsw <2 x i32> %strided.vec, %8
%11 = getelementptr inbounds [100010 x [2 x i32]], ptr @a, i64 0, i64 %offset.idx
%interleaved.vec = shufflevector <2 x i32> %9, <2 x i32> %10, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %11, align 8, !tbaa !5
%index.next = add nuw i64 %index, 2
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.end25, label %for.body9.preheader
for.body9.preheader: ; preds = %for.body9.lr.ph, %middle.block
%indvars.iv92.ph = phi i64 [ 1, %for.body9.lr.ph ], [ %ind.end, %middle.block ]
br label %for.body9
for.body9: ; preds = %for.body9.preheader, %for.body9
%indvars.iv92 = phi i64 [ %indvars.iv.next93, %for.body9 ], [ %indvars.iv92.ph, %for.body9.preheader ]
%arrayidx11 = getelementptr inbounds [100010 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv92
%13 = load i32, ptr %arrayidx11, align 8, !tbaa !5
%arrayidx15 = getelementptr inbounds [100010 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv92, i64 1
%14 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%mul = mul nsw i32 %4, %14
%add = add nsw i32 %mul, %13
store i32 %add, ptr %arrayidx11, align 8, !tbaa !5
%sub = sub nsw i32 %13, %mul
store i32 %sub, ptr %arrayidx15, align 4, !tbaa !5
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%exitcond.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count
br i1 %exitcond.not, label %for.end25, label %for.body9, !llvm.loop !16
for.end25: ; preds = %for.body9, %middle.block, %for.end
%conv = sext i32 %3 to i64
tail call void @qsort(ptr noundef nonnull getelementptr inbounds ([100010 x [2 x i32]], ptr @a, i64 0, i64 1), i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @cmp) #5
%15 = load i32, ptr @n, align 4, !tbaa !5
store i32 0, ptr @b, align 16, !tbaa !5
%cmp63.i = icmp sgt i32 %15, 0
br i1 %cmp63.i, label %for.body.preheader.i, label %cal.exit.thread
cal.exit.thread: ; preds = %for.end25
store i32 -2000000000, ptr @a, align 16, !tbaa !5
store i32 2000000000, ptr getelementptr inbounds ([100010 x [2 x i32]], ptr @a, i64 0, i64 0, i64 1), align 4, !tbaa !5
store i32 2000000000, ptr @b, align 16, !tbaa !5
br label %cal.exit83
for.body.preheader.i: ; preds = %for.end25
%add26 = add nuw nsw i32 %15, 1
%wide.trip.count.i = zext i32 %add26 to i64
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%ret.065.i = phi i32 [ 1, %for.body.preheader.i ], [ %ret.1.i, %for.inc.i ]
%arrayidx4.i = getelementptr inbounds [2 x i32], ptr @a, i64 %indvars.iv.i
%16 = load i32, ptr %arrayidx4.i, align 8, !tbaa !5
%cmp8.i = icmp sgt i32 %16, -1
%cmp1060.i = icmp sgt i32 %ret.065.i, 0
%or.cond.i = select i1 %cmp8.i, i1 %cmp1060.i, i1 false
br i1 %or.cond.i, label %for.body11.lr.ph.i, label %for.inc.i
for.body11.lr.ph.i: ; preds = %for.body.i
%arrayidx16.i = getelementptr inbounds [2 x i32], ptr @a, i64 %indvars.iv.i, i64 1
%17 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
br label %for.body11.i
for.body11.i: ; preds = %for.body11.i, %for.body11.lr.ph.i
%r.062.i = phi i32 [ %ret.065.i, %for.body11.lr.ph.i ], [ %r.1.i, %for.body11.i ]
%l.061.i = phi i32 [ 0, %for.body11.lr.ph.i ], [ %l.1.i, %for.body11.i ]
%add.i = add nsw i32 %l.061.i, %r.062.i
%div.i = sdiv i32 %add.i, 2
%idxprom12.i = sext i32 %div.i to i64
%arrayidx13.i = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %idxprom12.i
%18 = load i32, ptr %arrayidx13.i, align 4, !tbaa !5
%cmp17.not.i = icmp slt i32 %18, %17
%add21.i = add nsw i32 %div.i, 1
%l.1.i = select i1 %cmp17.not.i, i32 %l.061.i, i32 %add21.i
%r.1.i = select i1 %cmp17.not.i, i32 %div.i, i32 %r.062.i
%cmp10.i = icmp slt i32 %l.1.i, %r.1.i
br i1 %cmp10.i, label %for.body11.i, label %for.end.i, !llvm.loop !9
for.end.i: ; preds = %for.body11.i
%cmp25.i = icmp eq i32 %l.1.i, 0
br i1 %cmp25.i, label %for.inc.i, label %if.end27.i
if.end27.i: ; preds = %for.end.i
%idxprom31.i = sext i32 %l.1.i to i64
%arrayidx32.i = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %idxprom31.i
store i32 %17, ptr %arrayidx32.i, align 4, !tbaa !5
%cmp33.i = icmp eq i32 %l.1.i, %ret.065.i
%inc35.i = zext i1 %cmp33.i to i32
%spec.select.i = add nsw i32 %ret.065.i, %inc35.i
br label %for.inc.i
for.inc.i: ; preds = %if.end27.i, %for.end.i, %for.body.i
%ret.1.i = phi i32 [ %ret.065.i, %for.body.i ], [ %ret.065.i, %for.end.i ], [ %spec.select.i, %if.end27.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %cal.exit, label %for.body.i, !llvm.loop !11
cal.exit: ; preds = %for.inc.i
store i32 -2000000000, ptr @a, align 16, !tbaa !5
store i32 2000000000, ptr getelementptr inbounds ([100010 x [2 x i32]], ptr @a, i64 0, i64 0, i64 1), align 4, !tbaa !5
store i32 2000000000, ptr @b, align 16, !tbaa !5
br label %for.body.i49
for.body.i49: ; preds = %for.inc.i56, %cal.exit
%indvars.iv.i50 = phi i64 [ 1, %cal.exit ], [ %indvars.iv.next.i58, %for.inc.i56 ]
%ret.065.i51 = phi i32 [ 1, %cal.exit ], [ %ret.1.i57, %for.inc.i56 ]
%arrayidx4.i52 = getelementptr inbounds [2 x i32], ptr @a, i64 %indvars.iv.i50
%19 = load i32, ptr %arrayidx4.i52, align 8, !tbaa !5
%cmp8.i53 = icmp sgt i32 %19, -2000000001
%cmp1060.i54 = icmp sgt i32 %ret.065.i51, 0
%or.cond.i55 = select i1 %cmp8.i53, i1 %cmp1060.i54, i1 false
br i1 %or.cond.i55, label %for.body11.lr.ph.i60, label %for.inc.i56
for.body11.lr.ph.i60: ; preds = %for.body.i49
%arrayidx16.i61 = getelementptr inbounds [2 x i32], ptr @a, i64 %indvars.iv.i50, i64 1
%20 = load i32, ptr %arrayidx16.i61, align 4, !tbaa !5
br label %for.body11.i62
for.body11.i62: ; preds = %for.body11.i62, %for.body11.lr.ph.i60
%r.062.i63 = phi i32 [ %ret.065.i51, %for.body11.lr.ph.i60 ], [ %r.1.i72, %for.body11.i62 ]
%l.061.i64 = phi i32 [ 0, %for.body11.lr.ph.i60 ], [ %l.1.i71, %for.body11.i62 ]
%add.i65 = add nsw i32 %l.061.i64, %r.062.i63
%div.i66 = sdiv i32 %add.i65, 2
%idxprom12.i67 = sext i32 %div.i66 to i64
%arrayidx13.i68 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %idxprom12.i67
%21 = load i32, ptr %arrayidx13.i68, align 4, !tbaa !5
%cmp17.not.i69 = icmp slt i32 %21, %20
%add21.i70 = add nsw i32 %div.i66, 1
%l.1.i71 = select i1 %cmp17.not.i69, i32 %l.061.i64, i32 %add21.i70
%r.1.i72 = select i1 %cmp17.not.i69, i32 %div.i66, i32 %r.062.i63
%cmp10.i73 = icmp slt i32 %l.1.i71, %r.1.i72
br i1 %cmp10.i73, label %for.body11.i62, label %for.end.i74, !llvm.loop !9
for.end.i74: ; preds = %for.body11.i62
%cmp25.i75 = icmp eq i32 %l.1.i71, 0
br i1 %cmp25.i75, label %for.inc.i56, label %if.end27.i76
if.end27.i76: ; preds = %for.end.i74
%idxprom31.i78 = sext i32 %l.1.i71 to i64
%arrayidx32.i79 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %idxprom31.i78
store i32 %20, ptr %arrayidx32.i79, align 4, !tbaa !5
%cmp33.i80 = icmp eq i32 %l.1.i71, %ret.065.i51
%inc35.i81 = zext i1 %cmp33.i80 to i32
%spec.select.i82 = add nsw i32 %ret.065.i51, %inc35.i81
br label %for.inc.i56
for.inc.i56: ; preds = %if.end27.i76, %for.end.i74, %for.body.i49
%ret.1.i57 = phi i32 [ %ret.065.i51, %for.body.i49 ], [ %ret.065.i51, %for.end.i74 ], [ %spec.select.i82, %if.end27.i76 ]
%indvars.iv.next.i58 = add nuw nsw i64 %indvars.iv.i50, 1
%exitcond.not.i59 = icmp eq i64 %indvars.iv.next.i58, %wide.trip.count.i
br i1 %exitcond.not.i59, label %cal.exit83.loopexit, label %for.body.i49, !llvm.loop !11
cal.exit83.loopexit: ; preds = %for.inc.i56
%sub28 = add nsw i32 %ret.1.i, -1
%22 = add nsw i32 %ret.1.i57, -1
br label %cal.exit83
cal.exit83: ; preds = %cal.exit83.loopexit, %cal.exit.thread
%sub2886 = phi i32 [ 0, %cal.exit.thread ], [ %sub28, %cal.exit83.loopexit ]
%ret.0.lcssa.i46 = phi i32 [ 0, %cal.exit.thread ], [ %22, %cal.exit83.loopexit ]
%call32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub2886, i32 noundef %ret.0.lcssa.i46)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
|
#include <stdio.h>
#define N 8
#define UFOKERU -5
#define NOT_UFOKERU 5
#define true 1
#define false 0
int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];
int X[N][N];
void init()
{
int i;
for (i = 0; i < N; i++)
{
row[i] = UFOKERU, col[i] = UFOKERU;
}
for (i = 0; i < 2 * N - 1; i++)
{
dpos[i] = UFOKERU;
dneg[i] = UFOKERU;
}
}
void printBoard()
{
int i, j;
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
{
if (X[i][j])
{
if (row[i] != j)
return;
}
}
}
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
{
if (row[i] == j)
printf("Q");
else
printf(".");
}
printf("\n");
}
}
void recursive(int i)
{
int j;
if (i == N)
{
printBoard();
return;
}
for (j = 0; j < N; j++)
{
if (NOT_UFOKERU == col[j] ||
NOT_UFOKERU == dpos[i + j] ||
NOT_UFOKERU == dneg[i - j + N - 1])
continue;
row[i] = j;
col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_UFOKERU;
recursive(i + 1);
row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = UFOKERU;
}
}
int main()
{
int i, j;
init();
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
X[i][j] = false;
int k;
scanf("%d", &k);
for (i = 0; i < k; i++)
{
int r, c;
scanf("%d%d", &r, &c);
X[r][c] = true;
}
recursive(0);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232822/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232822/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@row = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@X = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @init() local_unnamed_addr #0 {
entry:
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr @row, align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr @col, align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([8 x i32], ptr @row, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr @dpos, align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr @dneg, align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 8), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 8), align 16, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 12), align 16, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 12), align 16, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 13), align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 13), align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 14), align 8, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 14), align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printBoard() local_unnamed_addr #2 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx7 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %for.inc, label %if.then
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not = icmp eq i32 %1, 0
br i1 %cmp8.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %2, 0
br i1 %tobool.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.1 = icmp eq i32 %3, 1
br i1 %cmp8.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%tobool.not.2 = icmp eq i32 %4, 0
br i1 %tobool.not.2, label %for.inc.2, label %if.then.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.2 = icmp eq i32 %5, 2
br i1 %cmp8.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%tobool.not.3 = icmp eq i32 %6, 0
br i1 %tobool.not.3, label %for.inc.3, label %if.then.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.3 = icmp eq i32 %7, 3
br i1 %cmp8.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx5.4, align 16, !tbaa !5
%tobool.not.4 = icmp eq i32 %8, 0
br i1 %tobool.not.4, label %for.inc.4, label %if.then.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.4 = icmp eq i32 %9, 4
br i1 %cmp8.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%tobool.not.5 = icmp eq i32 %10, 0
br i1 %tobool.not.5, label %for.inc.5, label %if.then.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.5 = icmp eq i32 %11, 5
br i1 %cmp8.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx5.6, align 8, !tbaa !5
%tobool.not.6 = icmp eq i32 %12, 0
br i1 %tobool.not.6, label %for.inc.6, label %if.then.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.6 = icmp eq i32 %13, 6
br i1 %cmp8.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%tobool.not.7 = icmp eq i32 %14, 0
br i1 %tobool.not.7, label %for.inc.7, label %if.then.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.7 = icmp eq i32 %15, 7
br i1 %cmp8.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond17.preheader, label %for.cond1.preheader, !llvm.loop !9
for.cond17.preheader: ; preds = %for.inc.7, %for.cond17.preheader
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.cond17.preheader ], [ 0, %for.inc.7 ]
%arrayidx21 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv57
%16 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp eq i32 %16, 0
%. = select i1 %cmp22, i32 81, i32 46
%putchar47 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.1 = icmp eq i32 %17, 1
%.sink62 = select i1 %cmp22.1, i32 81, i32 46
%putchar47.1 = tail call i32 @putchar(i32 %.sink62)
%18 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.2 = icmp eq i32 %18, 2
%.sink63 = select i1 %cmp22.2, i32 81, i32 46
%putchar47.2 = tail call i32 @putchar(i32 %.sink63)
%19 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.3 = icmp eq i32 %19, 3
%.sink64 = select i1 %cmp22.3, i32 81, i32 46
%putchar47.3 = tail call i32 @putchar(i32 %.sink64)
%20 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.4 = icmp eq i32 %20, 4
%.sink65 = select i1 %cmp22.4, i32 81, i32 46
%putchar47.4 = tail call i32 @putchar(i32 %.sink65)
%21 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.5 = icmp eq i32 %21, 5
%.sink66 = select i1 %cmp22.5, i32 81, i32 46
%putchar47.5 = tail call i32 @putchar(i32 %.sink66)
%22 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.6 = icmp eq i32 %22, 6
%.sink67 = select i1 %cmp22.6, i32 81, i32 46
%putchar47.6 = tail call i32 @putchar(i32 %.sink67)
%23 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.7 = icmp eq i32 %23, 7
%.sink68 = select i1 %cmp22.7, i32 81, i32 46
%putchar47.7 = tail call i32 @putchar(i32 %.sink68)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond60.not = icmp eq i64 %indvars.iv.next58, 8
br i1 %exitcond60.not, label %cleanup, label %for.cond17.preheader, !llvm.loop !11
cleanup: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond17.preheader
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @recursive(i32 noundef %i) local_unnamed_addr #2 {
entry:
%cmp = icmp eq i32 %i, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %i, 7
%idxprom14 = sext i32 %i to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %idxprom14
%add26 = add nsw i32 %i, 1
%0 = load i32, ptr @col, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, 5
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @printBoard()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, 5
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, 5
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 5, ptr %arrayidx10, align 4, !tbaa !5
store i32 5, ptr %arrayidx4, align 4, !tbaa !5
store i32 5, ptr @col, align 16, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -5, ptr %arrayidx10, align 4, !tbaa !5
store i32 -5, ptr %arrayidx4, align 4, !tbaa !5
store i32 -5, ptr @col, align 16, !tbaa !5
store i32 -5, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, 5
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, 5
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %i, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, 5
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 5, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 5, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -5, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -5, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
store i32 -5, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, 5
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, 5
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %i, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, 5
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 5, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 5, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -5, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -5, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
store i32 -5, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, 5
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, 5
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %i, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, 5
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 5, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 5, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -5, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -5, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
store i32 -5, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, 5
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, 5
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %i, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, 5
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 5, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 5, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -5, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -5, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
store i32 -5, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, 5
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, 5
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %i, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, 5
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 5, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 5, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -5, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -5, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
store i32 -5, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, 5
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, 5
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %i, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, 5
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 5, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 5, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -5, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -5, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
store i32 -5, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, 5
br i1 %cmp2.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, 5
br i1 %cmp5.7, label %common.ret, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, 5
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false6.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
ret void
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 5, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 5, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -5, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -5, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
store i32 -5, ptr %arrayidx15, align 4, !tbaa !5
br label %common.ret
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr @row, align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr @col, align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([8 x i32], ptr @row, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr @dpos, align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr @dneg, align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 8), align 16, !tbaa !5
store <4 x i32> <i32 -5, i32 -5, i32 -5, i32 -5>, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 8), align 16, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 12), align 16, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 12), align 16, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 13), align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 13), align 4, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dpos, i64 0, i64 14), align 8, !tbaa !5
store i32 -5, ptr getelementptr inbounds ([15 x i32], ptr @dneg, i64 0, i64 14), align 8, !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) @X, i8 0, i64 256, i1 false), !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp1028 = icmp sgt i32 %0, 0
br i1 %cmp1028, label %for.body11, label %for.end19
for.body11: ; preds = %entry, %for.body11
%i.129 = phi i32 [ %inc18, %for.body11 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom13 = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom15 = sext i32 %2 to i64
%arrayidx16 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %idxprom13, i64 %idxprom15
store i32 1, ptr %arrayidx16, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
%inc18 = add nuw nsw i32 %i.129, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc18, %3
br i1 %cmp10, label %for.body11, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body11, %entry
call void @recursive(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn 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 #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: write) }
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>
#define N 8
#define notfree 1
#define free 0
int queen[N],col[N],dpos[N*2-1],dneg[N*2-1],h[N];
void setQueen(int i){
int j;
if(i == N) {
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(j == queen[i])printf("Q");
else printf(".");
}
printf("\n");
}
return;
}
if(h[i] != -1){
setQueen(i+1);
return;
}
for(j=0;j<N;j++){
if(col[j] == notfree || dpos[i+j] == notfree || dneg[i-j+N-1] == notfree) continue;
queen[i]=j;
col[j]=notfree;
dpos[i+j]=notfree;
dneg[i-j+N-1]=notfree;
setQueen(i+1);
col[j]=free;
dpos[i+j]=free;
dneg[i-j+N-1]=free;
}
}
int main(){
int i,j,k,r,c;
scanf("%d",&k);
for(i=0;i<N;i++)h[i]=-1;
for(i=0;i<k;i++){
scanf("%d %d",&r,&c);
queen[r]=c;
col[c]=notfree;
dpos[r+c]=notfree;
dneg[r-c+N-1]=notfree;
h[r]=c;
}
setQueen(0);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232866/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232866/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@queen = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@h = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @setQueen(i32 noundef %i) local_unnamed_addr #0 {
entry:
%cmp93 = icmp eq i32 %i, 8
br i1 %cmp93, label %for.cond2.preheader.preheader, label %if.end12.preheader
for.cond2.preheader.preheader: ; preds = %if.then16, %entry
br label %for.cond2.preheader
if.end12.preheader: ; preds = %entry
%0 = sext i32 %i to i64
br label %if.end12
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.cond2.preheader
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.cond2.preheader ], [ 0, %for.cond2.preheader.preheader ]
%arrayidx = getelementptr inbounds [8 x i32], ptr @queen, i64 0, i64 %indvars.iv106
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, 0
%. = select i1 %cmp5, i32 81, i32 46
%putchar90 = tail call i32 @putchar(i32 %.)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %2, 1
%.sink117 = select i1 %cmp5.1, i32 81, i32 46
%putchar90.1 = tail call i32 @putchar(i32 %.sink117)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %3, 2
%.sink118 = select i1 %cmp5.2, i32 81, i32 46
%putchar90.2 = tail call i32 @putchar(i32 %.sink118)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %4, 3
%.sink119 = select i1 %cmp5.3, i32 81, i32 46
%putchar90.3 = tail call i32 @putchar(i32 %.sink119)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %5, 4
%.sink120 = select i1 %cmp5.4, i32 81, i32 46
%putchar90.4 = tail call i32 @putchar(i32 %.sink120)
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %6, 5
%.sink121 = select i1 %cmp5.5, i32 81, i32 46
%putchar90.5 = tail call i32 @putchar(i32 %.sink121)
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %7, 6
%.sink122 = select i1 %cmp5.6, i32 81, i32 46
%putchar90.6 = tail call i32 @putchar(i32 %.sink122)
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %8, 7
%.sink123 = select i1 %cmp5.7, i32 81, i32 46
%putchar90.7 = tail call i32 @putchar(i32 %.sink123)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
%exitcond.not = icmp eq i64 %indvars.iv.next107, 8
br i1 %exitcond.not, label %common.ret, label %for.cond2.preheader, !llvm.loop !9
if.end12: ; preds = %if.end12.preheader, %if.then16
%indvars.iv = phi i64 [ %0, %if.end12.preheader ], [ %indvars.iv.next, %if.then16 ]
%arrayidx14 = getelementptr inbounds [8 x i32], ptr @h, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15.not = icmp eq i32 %9, -1
br i1 %cmp15.not, label %for.cond18.preheader, label %if.then16
for.cond18.preheader: ; preds = %if.end12
%10 = trunc i64 %indvars.iv to i32
%arrayidx37 = getelementptr inbounds [8 x i32], ptr @queen, i64 0, i64 %indvars.iv
%add48 = add nsw i32 %10, 1
%sext = shl i64 %indvars.iv, 32
%11 = ashr exact i64 %sext, 32
%12 = load i32, ptr @col, align 16, !tbaa !5
%cmp23 = icmp eq i32 %12, 1
br i1 %cmp23, label %for.inc59, label %lor.lhs.false
if.then16: ; preds = %if.end12
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%13 = and i64 %indvars.iv.next, 4294967295
%cmp = icmp eq i64 %13, 8
br i1 %cmp, label %for.cond2.preheader.preheader, label %if.end12
lor.lhs.false: ; preds = %for.cond18.preheader
%arrayidx26 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %11
%14 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27 = icmp eq i32 %14, 1
br i1 %cmp27, label %for.inc59, label %lor.lhs.false28
lor.lhs.false28: ; preds = %lor.lhs.false
%sub = shl i64 %indvars.iv, 32
%sext114 = add i64 %sub, 30064771072
%idxprom31 = ashr exact i64 %sext114, 32
%arrayidx32 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom31
%15 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33 = icmp eq i32 %15, 1
br i1 %cmp33, label %for.inc59, label %if.end35
if.end35: ; preds = %lor.lhs.false28
store i32 0, ptr %arrayidx37, align 4, !tbaa !5
store i32 1, ptr @col, align 16, !tbaa !5
store i32 1, ptr %arrayidx26, align 4, !tbaa !5
store i32 1, ptr %arrayidx32, align 4, !tbaa !5
tail call void @setQueen(i32 noundef %add48)
store i32 0, ptr @col, align 16, !tbaa !5
store i32 0, ptr %arrayidx26, align 4, !tbaa !5
store i32 0, ptr %arrayidx32, align 4, !tbaa !5
br label %for.inc59
for.inc59: ; preds = %for.cond18.preheader, %lor.lhs.false, %lor.lhs.false28, %if.end35
%16 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp23.1 = icmp eq i32 %16, 1
br i1 %cmp23.1, label %for.inc59.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc59
%17 = add nsw i64 %11, 1
%arrayidx26.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %17
%18 = load i32, ptr %arrayidx26.1, align 4, !tbaa !5
%cmp27.1 = icmp eq i32 %18, 1
br i1 %cmp27.1, label %for.inc59.1, label %lor.lhs.false28.1
lor.lhs.false28.1: ; preds = %lor.lhs.false.1
%sub30.1 = shl i64 %indvars.iv, 32
%sext109 = add i64 %sub30.1, 25769803776
%idxprom31.1 = ashr exact i64 %sext109, 32
%arrayidx32.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom31.1
%19 = load i32, ptr %arrayidx32.1, align 4, !tbaa !5
%cmp33.1 = icmp eq i32 %19, 1
br i1 %cmp33.1, label %for.inc59.1, label %if.end35.1
if.end35.1: ; preds = %lor.lhs.false28.1
store i32 1, ptr %arrayidx37, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
store i32 1, ptr %arrayidx26.1, align 4, !tbaa !5
store i32 1, ptr %arrayidx32.1, align 4, !tbaa !5
tail call void @setQueen(i32 noundef %add48)
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
store i32 0, ptr %arrayidx26.1, align 4, !tbaa !5
store i32 0, ptr %arrayidx32.1, align 4, !tbaa !5
br label %for.inc59.1
for.inc59.1: ; preds = %if.end35.1, %lor.lhs.false28.1, %lor.lhs.false.1, %for.inc59
%20 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp23.2 = icmp eq i32 %20, 1
br i1 %cmp23.2, label %for.inc59.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc59.1
%21 = add nsw i64 %11, 2
%arrayidx26.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %21
%22 = load i32, ptr %arrayidx26.2, align 4, !tbaa !5
%cmp27.2 = icmp eq i32 %22, 1
br i1 %cmp27.2, label %for.inc59.2, label %lor.lhs.false28.2
lor.lhs.false28.2: ; preds = %lor.lhs.false.2
%sub30.2 = shl i64 %indvars.iv, 32
%sext110 = add i64 %sub30.2, 21474836480
%idxprom31.2 = ashr exact i64 %sext110, 32
%arrayidx32.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom31.2
%23 = load i32, ptr %arrayidx32.2, align 4, !tbaa !5
%cmp33.2 = icmp eq i32 %23, 1
br i1 %cmp33.2, label %for.inc59.2, label %if.end35.2
if.end35.2: ; preds = %lor.lhs.false28.2
store i32 2, ptr %arrayidx37, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
store i32 1, ptr %arrayidx26.2, align 4, !tbaa !5
store i32 1, ptr %arrayidx32.2, align 4, !tbaa !5
tail call void @setQueen(i32 noundef %add48)
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
store i32 0, ptr %arrayidx26.2, align 4, !tbaa !5
store i32 0, ptr %arrayidx32.2, align 4, !tbaa !5
br label %for.inc59.2
for.inc59.2: ; preds = %if.end35.2, %lor.lhs.false28.2, %lor.lhs.false.2, %for.inc59.1
%24 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp23.3 = icmp eq i32 %24, 1
br i1 %cmp23.3, label %for.inc59.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc59.2
%25 = add nsw i64 %11, 3
%arrayidx26.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %25
%26 = load i32, ptr %arrayidx26.3, align 4, !tbaa !5
%cmp27.3 = icmp eq i32 %26, 1
br i1 %cmp27.3, label %for.inc59.3, label %lor.lhs.false28.3
lor.lhs.false28.3: ; preds = %lor.lhs.false.3
%sub30.3 = shl i64 %indvars.iv, 32
%sext111 = add i64 %sub30.3, 17179869184
%idxprom31.3 = ashr exact i64 %sext111, 32
%arrayidx32.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom31.3
%27 = load i32, ptr %arrayidx32.3, align 4, !tbaa !5
%cmp33.3 = icmp eq i32 %27, 1
br i1 %cmp33.3, label %for.inc59.3, label %if.end35.3
if.end35.3: ; preds = %lor.lhs.false28.3
store i32 3, ptr %arrayidx37, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
store i32 1, ptr %arrayidx26.3, align 4, !tbaa !5
store i32 1, ptr %arrayidx32.3, align 4, !tbaa !5
tail call void @setQueen(i32 noundef %add48)
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
store i32 0, ptr %arrayidx26.3, align 4, !tbaa !5
store i32 0, ptr %arrayidx32.3, align 4, !tbaa !5
br label %for.inc59.3
for.inc59.3: ; preds = %if.end35.3, %lor.lhs.false28.3, %lor.lhs.false.3, %for.inc59.2
%28 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp23.4 = icmp eq i32 %28, 1
br i1 %cmp23.4, label %for.inc59.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc59.3
%29 = add nsw i64 %11, 4
%arrayidx26.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %29
%30 = load i32, ptr %arrayidx26.4, align 4, !tbaa !5
%cmp27.4 = icmp eq i32 %30, 1
br i1 %cmp27.4, label %for.inc59.4, label %lor.lhs.false28.4
lor.lhs.false28.4: ; preds = %lor.lhs.false.4
%sub30.4 = shl i64 %indvars.iv, 32
%sext112 = add i64 %sub30.4, 12884901888
%idxprom31.4 = ashr exact i64 %sext112, 32
%arrayidx32.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom31.4
%31 = load i32, ptr %arrayidx32.4, align 4, !tbaa !5
%cmp33.4 = icmp eq i32 %31, 1
br i1 %cmp33.4, label %for.inc59.4, label %if.end35.4
if.end35.4: ; preds = %lor.lhs.false28.4
store i32 4, ptr %arrayidx37, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
store i32 1, ptr %arrayidx26.4, align 4, !tbaa !5
store i32 1, ptr %arrayidx32.4, align 4, !tbaa !5
tail call void @setQueen(i32 noundef %add48)
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
store i32 0, ptr %arrayidx26.4, align 4, !tbaa !5
store i32 0, ptr %arrayidx32.4, align 4, !tbaa !5
br label %for.inc59.4
for.inc59.4: ; preds = %if.end35.4, %lor.lhs.false28.4, %lor.lhs.false.4, %for.inc59.3
%32 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp23.5 = icmp eq i32 %32, 1
br i1 %cmp23.5, label %for.inc59.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc59.4
%33 = add nsw i64 %11, 5
%arrayidx26.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %33
%34 = load i32, ptr %arrayidx26.5, align 4, !tbaa !5
%cmp27.5 = icmp eq i32 %34, 1
br i1 %cmp27.5, label %for.inc59.5, label %lor.lhs.false28.5
lor.lhs.false28.5: ; preds = %lor.lhs.false.5
%sub30.5 = shl i64 %indvars.iv, 32
%sext113 = add i64 %sub30.5, 8589934592
%idxprom31.5 = ashr exact i64 %sext113, 32
%arrayidx32.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom31.5
%35 = load i32, ptr %arrayidx32.5, align 4, !tbaa !5
%cmp33.5 = icmp eq i32 %35, 1
br i1 %cmp33.5, label %for.inc59.5, label %if.end35.5
if.end35.5: ; preds = %lor.lhs.false28.5
store i32 5, ptr %arrayidx37, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
store i32 1, ptr %arrayidx26.5, align 4, !tbaa !5
store i32 1, ptr %arrayidx32.5, align 4, !tbaa !5
tail call void @setQueen(i32 noundef %add48)
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
store i32 0, ptr %arrayidx26.5, align 4, !tbaa !5
store i32 0, ptr %arrayidx32.5, align 4, !tbaa !5
br label %for.inc59.5
for.inc59.5: ; preds = %if.end35.5, %lor.lhs.false28.5, %lor.lhs.false.5, %for.inc59.4
%36 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp23.6 = icmp eq i32 %36, 1
br i1 %cmp23.6, label %for.inc59.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc59.5
%37 = add nsw i64 %11, 6
%arrayidx26.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %37
%38 = load i32, ptr %arrayidx26.6, align 4, !tbaa !5
%cmp27.6 = icmp eq i32 %38, 1
br i1 %cmp27.6, label %for.inc59.6, label %lor.lhs.false28.6
lor.lhs.false28.6: ; preds = %lor.lhs.false.6
%sub30.6 = shl i64 %indvars.iv, 32
%sext115 = add i64 %sub30.6, 4294967296
%idxprom31.6 = ashr exact i64 %sext115, 32
%arrayidx32.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom31.6
%39 = load i32, ptr %arrayidx32.6, align 4, !tbaa !5
%cmp33.6 = icmp eq i32 %39, 1
br i1 %cmp33.6, label %for.inc59.6, label %if.end35.6
if.end35.6: ; preds = %lor.lhs.false28.6
store i32 6, ptr %arrayidx37, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
store i32 1, ptr %arrayidx26.6, align 4, !tbaa !5
store i32 1, ptr %arrayidx32.6, align 4, !tbaa !5
tail call void @setQueen(i32 noundef %add48)
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
store i32 0, ptr %arrayidx26.6, align 4, !tbaa !5
store i32 0, ptr %arrayidx32.6, align 4, !tbaa !5
br label %for.inc59.6
for.inc59.6: ; preds = %if.end35.6, %lor.lhs.false28.6, %lor.lhs.false.6, %for.inc59.5
%40 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp23.7 = icmp eq i32 %40, 1
br i1 %cmp23.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc59.6
%41 = add nsw i64 %11, 7
%arrayidx26.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %41
%42 = load i32, ptr %arrayidx26.7, align 4, !tbaa !5
%cmp27.7 = icmp eq i32 %42, 1
br i1 %cmp27.7, label %common.ret, label %lor.lhs.false28.7
lor.lhs.false28.7: ; preds = %lor.lhs.false.7
%arrayidx32.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %11
%43 = load i32, ptr %arrayidx32.7, align 4, !tbaa !5
%cmp33.7 = icmp eq i32 %43, 1
br i1 %cmp33.7, label %common.ret, label %if.end35.7
common.ret: ; preds = %lor.lhs.false28.7, %lor.lhs.false.7, %for.inc59.6, %for.cond2.preheader, %if.end35.7
ret void
if.end35.7: ; preds = %lor.lhs.false28.7
store i32 7, ptr %arrayidx37, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
store i32 1, ptr %arrayidx26.7, align 4, !tbaa !5
store i32 1, ptr %arrayidx32.7, align 4, !tbaa !5
tail call void @setQueen(i32 noundef %add48)
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
store i32 0, ptr %arrayidx26.7, align 4, !tbaa !5
store i32 0, ptr %arrayidx32.7, align 4, !tbaa !5
br label %common.ret
}
; 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 #0 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %k)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @h, i8 -1, i64 32, i1 false), !tbaa !5
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp225 = icmp sgt i32 %0, 0
br i1 %cmp225, label %for.body3, label %for.end19
for.body3: ; preds = %entry, %for.body3
%i.126 = phi i32 [ %inc18, %for.body3 ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %c, align 4, !tbaa !5
%2 = load i32, ptr %r, align 4, !tbaa !5
%idxprom5 = sext i32 %2 to i64
%arrayidx6 = getelementptr inbounds [8 x i32], ptr @queen, i64 0, i64 %idxprom5
store i32 %1, ptr %arrayidx6, align 4, !tbaa !5
%idxprom7 = sext i32 %1 to i64
%arrayidx8 = getelementptr inbounds [8 x i32], ptr @col, i64 0, i64 %idxprom7
store i32 1, ptr %arrayidx8, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%idxprom9 = sext i32 %add to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom9
store i32 1, ptr %arrayidx10, align 4, !tbaa !5
%reass.sub = sub i32 %2, %1
%sub12 = add i32 %reass.sub, 7
%idxprom13 = sext i32 %sub12 to i64
%arrayidx14 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom13
store i32 1, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [8 x i32], ptr @h, i64 0, i64 %idxprom5
store i32 %1, ptr %arrayidx16, align 4, !tbaa !5
%inc18 = add nuw nsw i32 %i.126, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc18, %3
br i1 %cmp2, label %for.body3, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.body3, %entry
call void @setQueen(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#define N 8
#define T 1
#define F 0
#define FREE -1
#define NOT_FREE -2
int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
int X[N][N];
void initialize()
{
int i;
for(i=0;i<N;i++)
{
row[i] = FREE;
col[i] = FREE;
}
for(i=0;i<2*N-1;i++)
{
dpos[i] = FREE;
dneg[i] = FREE;
}
}
void printBoard()
{
int i,j;
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
if(X[i][j])
{
if(row[i] != j)return ;
}
}
}
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
if(row[i] == j)
printf("Q");
else printf(".");
}
printf("\n");
}
}
void putQueen(int i)
{
int j;
if(i==N)
{
printBoard();
return;
}
for(j=0;j<N;j++)
{
if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE)
continue;
row[i] = j;
col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
putQueen(i+1);
row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
}
}
int main()
{
int k,r,c,i,j;
initialize();
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
X[i][j] = F;
}
}
scanf("%d",&k);
for(i=0;i<k;i++)
{
scanf("%d %d",&r,&c);
X[r][c] = T;
}
putQueen(0);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232909/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232909/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@row = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@X = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #0 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printBoard() local_unnamed_addr #2 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx7 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %for.inc, label %if.then
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not = icmp eq i32 %1, 0
br i1 %cmp8.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %2, 0
br i1 %tobool.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.1 = icmp eq i32 %3, 1
br i1 %cmp8.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%tobool.not.2 = icmp eq i32 %4, 0
br i1 %tobool.not.2, label %for.inc.2, label %if.then.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.2 = icmp eq i32 %5, 2
br i1 %cmp8.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%tobool.not.3 = icmp eq i32 %6, 0
br i1 %tobool.not.3, label %for.inc.3, label %if.then.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.3 = icmp eq i32 %7, 3
br i1 %cmp8.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx5.4, align 16, !tbaa !5
%tobool.not.4 = icmp eq i32 %8, 0
br i1 %tobool.not.4, label %for.inc.4, label %if.then.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.4 = icmp eq i32 %9, 4
br i1 %cmp8.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%tobool.not.5 = icmp eq i32 %10, 0
br i1 %tobool.not.5, label %for.inc.5, label %if.then.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.5 = icmp eq i32 %11, 5
br i1 %cmp8.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx5.6, align 8, !tbaa !5
%tobool.not.6 = icmp eq i32 %12, 0
br i1 %tobool.not.6, label %for.inc.6, label %if.then.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.6 = icmp eq i32 %13, 6
br i1 %cmp8.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%tobool.not.7 = icmp eq i32 %14, 0
br i1 %tobool.not.7, label %for.inc.7, label %if.then.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.7 = icmp eq i32 %15, 7
br i1 %cmp8.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond17.preheader, label %for.cond1.preheader, !llvm.loop !9
for.cond17.preheader: ; preds = %for.inc.7, %for.cond17.preheader
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.cond17.preheader ], [ 0, %for.inc.7 ]
%arrayidx21 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv57
%16 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp eq i32 %16, 0
%. = select i1 %cmp22, i32 81, i32 46
%putchar47 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.1 = icmp eq i32 %17, 1
%.sink62 = select i1 %cmp22.1, i32 81, i32 46
%putchar47.1 = tail call i32 @putchar(i32 %.sink62)
%18 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.2 = icmp eq i32 %18, 2
%.sink63 = select i1 %cmp22.2, i32 81, i32 46
%putchar47.2 = tail call i32 @putchar(i32 %.sink63)
%19 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.3 = icmp eq i32 %19, 3
%.sink64 = select i1 %cmp22.3, i32 81, i32 46
%putchar47.3 = tail call i32 @putchar(i32 %.sink64)
%20 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.4 = icmp eq i32 %20, 4
%.sink65 = select i1 %cmp22.4, i32 81, i32 46
%putchar47.4 = tail call i32 @putchar(i32 %.sink65)
%21 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.5 = icmp eq i32 %21, 5
%.sink66 = select i1 %cmp22.5, i32 81, i32 46
%putchar47.5 = tail call i32 @putchar(i32 %.sink66)
%22 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.6 = icmp eq i32 %22, 6
%.sink67 = select i1 %cmp22.6, i32 81, i32 46
%putchar47.6 = tail call i32 @putchar(i32 %.sink67)
%23 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.7 = icmp eq i32 %23, 7
%.sink68 = select i1 %cmp22.7, i32 81, i32 46
%putchar47.7 = tail call i32 @putchar(i32 %.sink68)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond60.not = icmp eq i64 %indvars.iv.next58, 8
br i1 %exitcond60.not, label %cleanup, label %for.cond17.preheader, !llvm.loop !11
cleanup: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond17.preheader
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @putQueen(i32 noundef %i) local_unnamed_addr #2 {
entry:
%cmp = icmp eq i32 %i, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %i, 7
%idxprom14 = sext i32 %i to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %idxprom14
%add26 = add nsw i32 %i, 1
%0 = load i32, ptr @col, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, -2
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @printBoard()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, -2
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, -2
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4, align 4, !tbaa !5
store i32 -2, ptr @col, align 16, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4, align 4, !tbaa !5
store i32 -1, ptr @col, align 16, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, -2
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, -2
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %i, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, -2
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, -2
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, -2
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %i, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, -2
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, -2
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, -2
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %i, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, -2
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, -2
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, -2
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %i, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, -2
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, -2
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, -2
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %i, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, -2
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, -2
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, -2
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %i, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, -2
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, -2
br i1 %cmp2.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, -2
br i1 %cmp5.7, label %common.ret, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, -2
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false6.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
ret void
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %common.ret
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) @X, i8 0, i64 256, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp1028 = icmp sgt i32 %0, 0
br i1 %cmp1028, label %for.body11, label %for.end19
for.body11: ; preds = %entry, %for.body11
%i.129 = phi i32 [ %inc18, %for.body11 ], [ 0, %entry ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom13 = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom15 = sext i32 %2 to i64
%arrayidx16 = getelementptr inbounds [8 x [8 x i32]], ptr @X, i64 0, i64 %idxprom13, i64 %idxprom15
store i32 1, ptr %arrayidx16, align 4, !tbaa !5
%inc18 = add nuw nsw i32 %i.129, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc18, %3
br i1 %cmp10, label %for.body11, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body11, %entry
call void @putQueen(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn 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 #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: write) }
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}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.c
* Author: kundaikwangwari
*
* Created on August 1, 2019, 8:38 AM
*/
#include <stdio.h>
#include <stdlib.h>
#define Free -1
#define Not_Free -2
#define Queens 8
#define Valid 1
/*
*
*/
int Col[Queens], Board[Queens][Queens],Row[Queens],drop[Queens*2 - 1],dneg[Queens*2 - 1];
void DisplayAns(){
for(int i = 0; i < Queens; i++){
for(int j = 0; j < Queens; j++){
if(Board[i][j] == Valid){
if(Row[i] != j)return;
}
}
}
for(int i = 0; i < Queens; i++){
for(int j = 0; j < Queens; j++){
if(Row[i] == j)printf("Q");
else printf(".");
}
printf("\n");
}
return;
}
void PutQueen(int pos){
if(pos == Queens){
DisplayAns();
return;
}
for(int j = 0; j < Queens; j++){
if((Col[j] == Not_Free) || (drop[pos + j] == Not_Free)
|| (dneg[pos - j + Queens - 1] == Not_Free))continue;
Row[pos] = j;
Col[j] = drop[pos + j] = dneg[ pos - j + Queens - 1] = Not_Free;
PutQueen(pos + 1);
Row[pos] = Col[j] = drop[pos + j] = dneg[pos - 1 + Queens - j] = Free;
}
}
int main(int argc, char** argv) {
for(int i = 0; i < Queens; i++){
for(int j = 0; j < Queens; j++)Board[i][j] = 0;
}
for(int i = 0; i < Queens; i++){
Col[i] = Free;
Row[i] = Free;
}
for(int i = 0; i < Queens*2 - 1; i++){
drop[i] = Free;
dneg[i] = Free;
}
int n;
scanf("%d",&n);
int x[n], y[n];
for(int i = 0; i < n; i++){
scanf("%d %d",&x[i],&y[i]);
//printf("%d %d\n",x[i],y[i]);
Board[x[i]][y[i]] = Valid;
//printf("board[%d][%d] is %d\n",x[i],y[i],Board[x[i]][y[i]]);
}
PutQueen(0);
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_232952/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_232952/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@Board = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@Row = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@Col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@drop = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @DisplayAns() local_unnamed_addr #0 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx9 = getelementptr inbounds [8 x i32], ptr @Row, i64 0, i64 %indvars.iv
%arrayidx6 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx6, align 16, !tbaa !5
%cmp7 = icmp eq i32 %0, 1
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not = icmp eq i32 %1, 0
br i1 %cmp10.not, label %for.inc, label %return
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx6.1 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%cmp7.1 = icmp eq i32 %2, 1
br i1 %cmp7.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not.1 = icmp eq i32 %3, 1
br i1 %cmp10.not.1, label %for.inc.1, label %return
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx6.2 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5
%cmp7.2 = icmp eq i32 %4, 1
br i1 %cmp7.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not.2 = icmp eq i32 %5, 2
br i1 %cmp10.not.2, label %for.inc.2, label %return
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx6.3 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%cmp7.3 = icmp eq i32 %6, 1
br i1 %cmp7.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not.3 = icmp eq i32 %7, 3
br i1 %cmp10.not.3, label %for.inc.3, label %return
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx6.4 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx6.4, align 16, !tbaa !5
%cmp7.4 = icmp eq i32 %8, 1
br i1 %cmp7.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not.4 = icmp eq i32 %9, 4
br i1 %cmp10.not.4, label %for.inc.4, label %return
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx6.5 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx6.5, align 4, !tbaa !5
%cmp7.5 = icmp eq i32 %10, 1
br i1 %cmp7.5, label %if.then.5, label %for.inc.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not.5 = icmp eq i32 %11, 5
br i1 %cmp10.not.5, label %for.inc.5, label %return
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx6.6 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx6.6, align 8, !tbaa !5
%cmp7.6 = icmp eq i32 %12, 1
br i1 %cmp7.6, label %if.then.6, label %for.inc.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not.6 = icmp eq i32 %13, 6
br i1 %cmp10.not.6, label %for.inc.6, label %return
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx6.7 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx6.7, align 4, !tbaa !5
%cmp7.7 = icmp eq i32 %14, 1
br i1 %cmp7.7, label %if.then.7, label %for.inc.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not.7 = icmp eq i32 %15, 7
br i1 %cmp10.not.7, label %for.inc.7, label %return
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond24.preheader, label %for.cond1.preheader, !llvm.loop !9
for.cond24.preheader: ; preds = %for.inc.7, %for.cond24.preheader
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.cond24.preheader ], [ 0, %for.inc.7 ]
%arrayidx29 = getelementptr inbounds [8 x i32], ptr @Row, i64 0, i64 %indvars.iv69
%16 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30 = icmp eq i32 %16, 0
%. = select i1 %cmp30, i32 81, i32 46
%putchar55 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.1 = icmp eq i32 %17, 1
%.sink74 = select i1 %cmp30.1, i32 81, i32 46
%putchar55.1 = tail call i32 @putchar(i32 %.sink74)
%18 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.2 = icmp eq i32 %18, 2
%.sink75 = select i1 %cmp30.2, i32 81, i32 46
%putchar55.2 = tail call i32 @putchar(i32 %.sink75)
%19 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.3 = icmp eq i32 %19, 3
%.sink76 = select i1 %cmp30.3, i32 81, i32 46
%putchar55.3 = tail call i32 @putchar(i32 %.sink76)
%20 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.4 = icmp eq i32 %20, 4
%.sink77 = select i1 %cmp30.4, i32 81, i32 46
%putchar55.4 = tail call i32 @putchar(i32 %.sink77)
%21 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.5 = icmp eq i32 %21, 5
%.sink78 = select i1 %cmp30.5, i32 81, i32 46
%putchar55.5 = tail call i32 @putchar(i32 %.sink78)
%22 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.6 = icmp eq i32 %22, 6
%.sink79 = select i1 %cmp30.6, i32 81, i32 46
%putchar55.6 = tail call i32 @putchar(i32 %.sink79)
%23 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.7 = icmp eq i32 %23, 7
%.sink80 = select i1 %cmp30.7, i32 81, i32 46
%putchar55.7 = tail call i32 @putchar(i32 %.sink80)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond72.not = icmp eq i64 %indvars.iv.next70, 8
br i1 %exitcond72.not, label %return, label %for.cond24.preheader, !llvm.loop !11
return: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond24.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 nounwind uwtable
define dso_local void @PutQueen(i32 noundef %pos) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %pos, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %pos, 7
%idxprom14 = sext i32 %pos to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @Row, i64 0, i64 %idxprom14
%add26 = add nsw i32 %pos, 1
%0 = load i32, ptr @Col, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, -2
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @DisplayAns()
br label %for.end
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @drop, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, -2
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, -2
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4, align 4, !tbaa !5
store i32 -2, ptr @Col, align 16, !tbaa !5
tail call void @PutQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4, align 4, !tbaa !5
store i32 -1, ptr @Col, align 16, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, -2
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @drop, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, -2
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %pos, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, -2
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 1), align 4, !tbaa !5
tail call void @PutQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 1), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, -2
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @drop, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, -2
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %pos, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, -2
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 2), align 8, !tbaa !5
tail call void @PutQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 2), align 8, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, -2
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @drop, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, -2
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %pos, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, -2
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 3), align 4, !tbaa !5
tail call void @PutQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 3), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, -2
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @drop, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, -2
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %pos, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, -2
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 4), align 16, !tbaa !5
tail call void @PutQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 4), align 16, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, -2
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @drop, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, -2
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %pos, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, -2
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 5), align 4, !tbaa !5
tail call void @PutQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 5), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, -2
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @drop, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, -2
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %pos, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, -2
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 6), align 8, !tbaa !5
tail call void @PutQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 6), align 8, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, -2
br i1 %cmp2.7, label %for.end, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @drop, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, -2
br i1 %cmp5.7, label %for.end, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%idxprom9.7 = sext i32 %pos to i64
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.7
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, -2
br i1 %cmp11.7, label %for.end, label %if.end13.7
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 7), align 4, !tbaa !5
tail call void @PutQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @Col, i64 0, i64 7), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.inc.6, %lor.lhs.false.7, %lor.lhs.false6.7, %if.end13.7, %if.then
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) @Board, i8 0, i64 256, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @Col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @Row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @drop, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla34 = alloca i32, i64 %4, align 16
%cmp3775 = icmp sgt i32 %3, 0
br i1 %cmp3775, label %for.body39, label %for.cond.cleanup38
for.cond.cleanup38: ; preds = %for.body39, %entry
call void @PutQueen(i32 noundef 0)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body39: ; preds = %entry, %for.body39
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body39 ], [ 0, %entry ]
%arrayidx41 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx43 = getelementptr inbounds i32, ptr %vla34, i64 %indvars.iv
%call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx41, ptr noundef nonnull %arrayidx43)
%5 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%idxprom47 = sext i32 %5 to i64
%6 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%idxprom51 = sext i32 %6 to i64
%arrayidx52 = getelementptr inbounds [8 x [8 x i32]], ptr @Board, i64 0, i64 %idxprom47, i64 %idxprom51
store i32 1, ptr %arrayidx52, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp37 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp37, label %for.body39, label %for.cond.cleanup38, !llvm.loop !12
}
; 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
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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>
#define N 8
#define FREE -1
#define NOT_FREE -2
#define TRUE -3
#define FALSE -4
int row[N], col[N], dpos[2*N-1], dneg[2*N-1], x[N][N];
//row: x = i
//col: x = j
//dpos: x = i + j
//dneg: x = i - j + (N - 1)
void putQueen(int);
void printBoard(void);
int main() {
int k, i, j, r, c;
for ( i=0; i<(2*N-1); i++ ) {
row[i] = col[i] = dpos[i] = dneg[i] = FREE;
for ( j=0; j<N; j++ ) x[i][j] = FALSE;
}
scanf( "%d" , &k );
for ( i=0; i<k; i++ ) {
scanf( "%d %d" , &r , &c );
x[r][c] = TRUE;
}
putQueen(0);
return 0;
}
void putQueen(int i) {
int j;
if ( i == N ) {
printBoard();
return;
}
for ( j=0; j<N; j++ ) {
if ( (col[j] == NOT_FREE)
|| (dpos[i+j] == NOT_FREE)
|| (dneg[i-j+N-1] == NOT_FREE) ) continue;
// put a queen at (i, j)
row[i] = j;
col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
// try the next row
putQueen(i+1);
// remove the queen at (i, j) for backtracking
col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
}
}
void printBoard(void) {
int i, j;
for ( i=0; i<N; i++ )
for ( j=0; j<N; j++ )
if((x[i][j] == TRUE) && (row[i] != j)) return;
for ( i=0; i<N; i++ ) {
for ( j=0; j<N; j++ ) {
if ( row[i] == j ) printf( "Q" );
else printf( "." );
}
printf( "\n" );
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233016/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233016/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@row = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@x = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @col, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @row, i8 -1, i64 60, i1 false), !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr @x, align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 1, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 1, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 2, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 2, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 3, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 3, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 4, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 4, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 5, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 5, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 6, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 6, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 7, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 0, i64 7, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 0, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 1, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 1, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 2, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 2, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 3, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 3, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 4, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 4, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 5, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 5, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 6, i64 0), align 16, !tbaa !5
store <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, ptr getelementptr inbounds ([8 x [8 x i32]], ptr @x, i64 1, i64 6, i64 4), align 16, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp1840 = icmp sgt i32 %0, 0
br i1 %cmp1840, label %for.body19, label %for.end27
for.body19: ; preds = %entry, %for.body19
%i.141 = phi i32 [ %inc26, %for.body19 ], [ 0, %entry ]
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom21 = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom23 = sext i32 %2 to i64
%arrayidx24 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %idxprom21, i64 %idxprom23
store i32 -3, ptr %arrayidx24, align 4, !tbaa !5
%inc26 = add nuw nsw i32 %i.141, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp18 = icmp slt i32 %inc26, %3
br i1 %cmp18, label %for.body19, label %for.end27, !llvm.loop !9
for.end27: ; preds = %for.body19, %entry
call void @putQueen(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @putQueen(i32 noundef %i) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %i, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %i, 7
%idxprom14 = sext i32 %i to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %idxprom14
%add26 = add nsw i32 %i, 1
%0 = load i32, ptr @col, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, -2
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @printBoard()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, -2
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, -2
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4, align 4, !tbaa !5
store i32 -2, ptr @col, align 16, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4, align 4, !tbaa !5
store i32 -1, ptr @col, align 16, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, -2
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, -2
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %i, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, -2
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, -2
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, -2
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %i, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, -2
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, -2
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, -2
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %i, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, -2
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, -2
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, -2
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %i, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, -2
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, -2
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, -2
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %i, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, -2
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, -2
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, -2
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %i, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, -2
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, -2
br i1 %cmp2.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, -2
br i1 %cmp5.7, label %common.ret, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, -2
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false6.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
ret void
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 -2, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -2, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -2, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
br label %common.ret
}
; 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 @printBoard() local_unnamed_addr #0 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx8 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%cmp6 = icmp eq i32 %0, -3
br i1 %cmp6, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp eq i32 %1, 0
br i1 %cmp9.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %land.lhs.true
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%cmp6.1 = icmp eq i32 %2, -3
br i1 %cmp6.1, label %land.lhs.true.1, label %for.inc.1
land.lhs.true.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.1 = icmp eq i32 %3, 1
br i1 %cmp9.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %land.lhs.true.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%cmp6.2 = icmp eq i32 %4, -3
br i1 %cmp6.2, label %land.lhs.true.2, label %for.inc.2
land.lhs.true.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.2 = icmp eq i32 %5, 2
br i1 %cmp9.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %land.lhs.true.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%cmp6.3 = icmp eq i32 %6, -3
br i1 %cmp6.3, label %land.lhs.true.3, label %for.inc.3
land.lhs.true.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.3 = icmp eq i32 %7, 3
br i1 %cmp9.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %land.lhs.true.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx5.4, align 16, !tbaa !5
%cmp6.4 = icmp eq i32 %8, -3
br i1 %cmp6.4, label %land.lhs.true.4, label %for.inc.4
land.lhs.true.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.4 = icmp eq i32 %9, 4
br i1 %cmp9.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %land.lhs.true.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%cmp6.5 = icmp eq i32 %10, -3
br i1 %cmp6.5, label %land.lhs.true.5, label %for.inc.5
land.lhs.true.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.5 = icmp eq i32 %11, 5
br i1 %cmp9.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %land.lhs.true.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx5.6, align 8, !tbaa !5
%cmp6.6 = icmp eq i32 %12, -3
br i1 %cmp6.6, label %land.lhs.true.6, label %for.inc.6
land.lhs.true.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.6 = icmp eq i32 %13, 6
br i1 %cmp9.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %land.lhs.true.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i32]], ptr @x, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%cmp6.7 = icmp eq i32 %14, -3
br i1 %cmp6.7, label %land.lhs.true.7, label %for.inc.7
land.lhs.true.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.7 = icmp eq i32 %15, 7
br i1 %cmp9.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %land.lhs.true.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond16.preheader, label %for.cond1.preheader, !llvm.loop !11
for.cond16.preheader: ; preds = %for.inc.7, %for.cond16.preheader
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.cond16.preheader ], [ 0, %for.inc.7 ]
%arrayidx20 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv56
%16 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21 = icmp eq i32 %16, 0
%. = select i1 %cmp21, i32 81, i32 46
%putchar46 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.1 = icmp eq i32 %17, 1
%.sink61 = select i1 %cmp21.1, i32 81, i32 46
%putchar46.1 = tail call i32 @putchar(i32 %.sink61)
%18 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.2 = icmp eq i32 %18, 2
%.sink62 = select i1 %cmp21.2, i32 81, i32 46
%putchar46.2 = tail call i32 @putchar(i32 %.sink62)
%19 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.3 = icmp eq i32 %19, 3
%.sink63 = select i1 %cmp21.3, i32 81, i32 46
%putchar46.3 = tail call i32 @putchar(i32 %.sink63)
%20 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.4 = icmp eq i32 %20, 4
%.sink64 = select i1 %cmp21.4, i32 81, i32 46
%putchar46.4 = tail call i32 @putchar(i32 %.sink64)
%21 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.5 = icmp eq i32 %21, 5
%.sink65 = select i1 %cmp21.5, i32 81, i32 46
%putchar46.5 = tail call i32 @putchar(i32 %.sink65)
%22 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.6 = icmp eq i32 %22, 6
%.sink66 = select i1 %cmp21.6, i32 81, i32 46
%putchar46.6 = tail call i32 @putchar(i32 %.sink66)
%23 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.7 = icmp eq i32 %23, 7
%.sink67 = select i1 %cmp21.7, i32 81, i32 46
%putchar46.7 = tail call i32 @putchar(i32 %.sink67)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next57, 8
br i1 %exitcond59.not, label %cleanup, label %for.cond16.preheader, !llvm.loop !12
cleanup: ; preds = %land.lhs.true, %land.lhs.true.1, %land.lhs.true.2, %land.lhs.true.3, %land.lhs.true.4, %land.lhs.true.5, %land.lhs.true.6, %land.lhs.true.7, %for.cond16.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdbool.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
bool X[N][N];
void initialize(){
int i;
for(i=0;i<N;i++){row[i]=FREE,col[i]=FREE;}
for(i=0;i<2*N-1;i++){dpos[i]=FREE;dneg[i]=FREE;}
}
void printBoard(){
int i,j;
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(X[i][j]){
if(row[i]!=j) return;
}
}
}
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(row[i] == j) printf("Q");
else printf(".");
}
printf("\n");
}
}
void recursive(int i){
int j;
if(i==N){
printBoard(); return;
}
for(j=0;j<N;j++){
if(NOT_FREE == col[j] ||
NOT_FREE == dpos[i+j] ||
NOT_FREE == dneg[i-j+N-1]) continue;
row[i] = j; col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
recursive(i+1);
row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1] = FREE;
}
}
int main(){
int i,j,k;
int r,c;
initialize();
for(i=0;i<N;i++)
for(j=0;j<N;j++)X[i][j]=false;
scanf("%d",&k);
for(i=0;i<k;i++){
scanf("%d%d",&r,&c);
X[r][c] = true;
}
recursive(0);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233074/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233074/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@row = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@X = dso_local local_unnamed_addr global [8 x [8 x i8]] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #0 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printBoard() local_unnamed_addr #2 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx7 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %indvars.iv, i64 0
%0 = load i8, ptr %arrayidx5, align 8, !tbaa !9, !range !11, !noundef !12
%tobool.not = icmp eq i8 %0, 0
br i1 %tobool.not, label %for.inc, label %if.then
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not = icmp eq i32 %1, 0
br i1 %cmp8.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %indvars.iv, i64 1
%2 = load i8, ptr %arrayidx5.1, align 1, !tbaa !9, !range !11, !noundef !12
%tobool.not.1 = icmp eq i8 %2, 0
br i1 %tobool.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.1 = icmp eq i32 %3, 1
br i1 %cmp8.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %indvars.iv, i64 2
%4 = load i8, ptr %arrayidx5.2, align 2, !tbaa !9, !range !11, !noundef !12
%tobool.not.2 = icmp eq i8 %4, 0
br i1 %tobool.not.2, label %for.inc.2, label %if.then.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.2 = icmp eq i32 %5, 2
br i1 %cmp8.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %indvars.iv, i64 3
%6 = load i8, ptr %arrayidx5.3, align 1, !tbaa !9, !range !11, !noundef !12
%tobool.not.3 = icmp eq i8 %6, 0
br i1 %tobool.not.3, label %for.inc.3, label %if.then.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.3 = icmp eq i32 %7, 3
br i1 %cmp8.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %indvars.iv, i64 4
%8 = load i8, ptr %arrayidx5.4, align 4, !tbaa !9, !range !11, !noundef !12
%tobool.not.4 = icmp eq i8 %8, 0
br i1 %tobool.not.4, label %for.inc.4, label %if.then.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.4 = icmp eq i32 %9, 4
br i1 %cmp8.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %indvars.iv, i64 5
%10 = load i8, ptr %arrayidx5.5, align 1, !tbaa !9, !range !11, !noundef !12
%tobool.not.5 = icmp eq i8 %10, 0
br i1 %tobool.not.5, label %for.inc.5, label %if.then.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.5 = icmp eq i32 %11, 5
br i1 %cmp8.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %indvars.iv, i64 6
%12 = load i8, ptr %arrayidx5.6, align 2, !tbaa !9, !range !11, !noundef !12
%tobool.not.6 = icmp eq i8 %12, 0
br i1 %tobool.not.6, label %for.inc.6, label %if.then.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.6 = icmp eq i32 %13, 6
br i1 %cmp8.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %indvars.iv, i64 7
%14 = load i8, ptr %arrayidx5.7, align 1, !tbaa !9, !range !11, !noundef !12
%tobool.not.7 = icmp eq i8 %14, 0
br i1 %tobool.not.7, label %for.inc.7, label %if.then.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.7 = icmp eq i32 %15, 7
br i1 %cmp8.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond17.preheader, label %for.cond1.preheader, !llvm.loop !13
for.cond17.preheader: ; preds = %for.inc.7, %for.cond17.preheader
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.cond17.preheader ], [ 0, %for.inc.7 ]
%arrayidx21 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv57
%16 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp eq i32 %16, 0
%. = select i1 %cmp22, i32 81, i32 46
%putchar47 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.1 = icmp eq i32 %17, 1
%.sink62 = select i1 %cmp22.1, i32 81, i32 46
%putchar47.1 = tail call i32 @putchar(i32 %.sink62)
%18 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.2 = icmp eq i32 %18, 2
%.sink63 = select i1 %cmp22.2, i32 81, i32 46
%putchar47.2 = tail call i32 @putchar(i32 %.sink63)
%19 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.3 = icmp eq i32 %19, 3
%.sink64 = select i1 %cmp22.3, i32 81, i32 46
%putchar47.3 = tail call i32 @putchar(i32 %.sink64)
%20 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.4 = icmp eq i32 %20, 4
%.sink65 = select i1 %cmp22.4, i32 81, i32 46
%putchar47.4 = tail call i32 @putchar(i32 %.sink65)
%21 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.5 = icmp eq i32 %21, 5
%.sink66 = select i1 %cmp22.5, i32 81, i32 46
%putchar47.5 = tail call i32 @putchar(i32 %.sink66)
%22 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.6 = icmp eq i32 %22, 6
%.sink67 = select i1 %cmp22.6, i32 81, i32 46
%putchar47.6 = tail call i32 @putchar(i32 %.sink67)
%23 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.7 = icmp eq i32 %23, 7
%.sink68 = select i1 %cmp22.7, i32 81, i32 46
%putchar47.7 = tail call i32 @putchar(i32 %.sink68)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond60.not = icmp eq i64 %indvars.iv.next58, 8
br i1 %exitcond60.not, label %cleanup, label %for.cond17.preheader, !llvm.loop !15
cleanup: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond17.preheader
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @recursive(i32 noundef %i) local_unnamed_addr #2 {
entry:
%cmp = icmp eq i32 %i, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %i, 7
%idxprom14 = sext i32 %i to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %idxprom14
%add26 = add nsw i32 %i, 1
%0 = load i32, ptr @col, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, 1
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @printBoard()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, 1
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, 1
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10, align 4, !tbaa !5
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
store i32 1, ptr @col, align 16, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -1, ptr %arrayidx10, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4, align 4, !tbaa !5
store i32 -1, ptr @col, align 16, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, 1
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, 1
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %i, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, 1
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, 1
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, 1
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %i, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, 1
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, 1
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, 1
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %i, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, 1
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, 1
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, 1
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %i, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, 1
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, 1
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, 1
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %i, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, 1
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, 1
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, 1
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %i, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, 1
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, 1
br i1 %cmp2.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, 1
br i1 %cmp5.7, label %common.ret, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, 1
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false6.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
ret void
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
tail call void @recursive(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
store i32 -1, ptr %arrayidx15, align 4, !tbaa !5
br label %common.ret
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) @X, i8 0, i64 64, i1 false), !tbaa !9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp1028 = icmp sgt i32 %0, 0
br i1 %cmp1028, label %for.body11, label %for.end19
for.body11: ; preds = %entry, %for.body11
%i.129 = phi i32 [ %inc18, %for.body11 ], [ 0, %entry ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom13 = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom15 = sext i32 %2 to i64
%arrayidx16 = getelementptr inbounds [8 x [8 x i8]], ptr @X, i64 0, i64 %idxprom13, i64 %idxprom15
store i8 1, ptr %arrayidx16, align 1, !tbaa !9
%inc18 = add nuw nsw i32 %i.129, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc18, %3
br i1 %cmp10, label %for.body11, label %for.end19, !llvm.loop !16
for.end19: ; preds = %for.body11, %entry
call void @recursive(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn 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 #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: write) }
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, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
|
#include<stdio.h>
#define N 8
int queen[N][N],row[N],col[N],dpos[2*N-1],dneg[2*N-1];
void print();
void move(int );
int main(){
int n,r,c;
int i,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d",&r,&c);
queen[r][c] = 1;
}
move(0);
return 0;
}
void move(int i){
int j,p,q;
if(i==N)
{
print();
return;
}
for(j=0;j<N;j++)
{
p = i+j;
q = i-j+N-1;
if(col[j]==1 || dpos[p]==1 || dneg[q]==1)
continue;
row[i] = j;
col[j] = dpos[p] = dneg[q] = 1;
move(i+1);
row[i] = col[j] = dpos[p] = dneg[q] = 0;
}
}
void print(){
int i,j;
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
if(queen[i][j])
{
if(row[i] != j) return;
}
}
}
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
if(row[i] == j) printf("Q");
else printf(".");
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233131/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233131/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@queen = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@row = dso_local local_unnamed_addr global [8 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
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom2 = sext i32 %2 to i64
%arrayidx3 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %idxprom, i64 %idxprom2
store i32 1, ptr %arrayidx3, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.06, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @move(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #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 uwtable
define dso_local void @move(i32 noundef %i) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %i, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %i, 7
%idxprom14 = sext i32 %i to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %idxprom14
%add22 = add nsw i32 %i, 1
%0 = load i32, ptr @col, align 16, !tbaa !5
%cmp4 = icmp eq i32 %0, 1
br i1 %cmp4, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @print()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %1, 1
br i1 %cmp7, label %for.inc, label %lor.lhs.false8
lor.lhs.false8: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, 1
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false8
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10, align 4, !tbaa !5
store i32 1, ptr %arrayidx6, align 4, !tbaa !5
store i32 1, ptr @col, align 16, !tbaa !5
tail call void @move(i32 noundef %add22)
store i32 0, ptr %arrayidx10, align 4, !tbaa !5
store i32 0, ptr %arrayidx6, align 4, !tbaa !5
store i32 0, ptr @col, align 16, !tbaa !5
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false8, %if.end13
%sub3.1 = add i32 %i, 6
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp4.1 = icmp eq i32 %3, 1
br i1 %cmp4.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx6.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %4
%5 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%cmp7.1 = icmp eq i32 %5, 1
br i1 %cmp7.1, label %for.inc.1, label %lor.lhs.false8.1
lor.lhs.false8.1: ; preds = %lor.lhs.false.1
%idxprom9.1 = sext i32 %sub3.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, 1
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false8.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 1, ptr %arrayidx6.1, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
tail call void @move(i32 noundef %add22)
store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 0, ptr %arrayidx6.1, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false8.1, %lor.lhs.false.1, %for.inc
%sub3.2 = add i32 %i, 5
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp4.2 = icmp eq i32 %7, 1
br i1 %cmp4.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx6.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %8
%9 = load i32, ptr %arrayidx6.2, align 4, !tbaa !5
%cmp7.2 = icmp eq i32 %9, 1
br i1 %cmp7.2, label %for.inc.2, label %lor.lhs.false8.2
lor.lhs.false8.2: ; preds = %lor.lhs.false.2
%idxprom9.2 = sext i32 %sub3.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, 1
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false8.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 1, ptr %arrayidx6.2, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
tail call void @move(i32 noundef %add22)
store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 0, ptr %arrayidx6.2, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false8.2, %lor.lhs.false.2, %for.inc.1
%sub3.3 = add i32 %i, 4
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp4.3 = icmp eq i32 %11, 1
br i1 %cmp4.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx6.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %12
%13 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%cmp7.3 = icmp eq i32 %13, 1
br i1 %cmp7.3, label %for.inc.3, label %lor.lhs.false8.3
lor.lhs.false8.3: ; preds = %lor.lhs.false.3
%idxprom9.3 = sext i32 %sub3.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, 1
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false8.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 1, ptr %arrayidx6.3, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
tail call void @move(i32 noundef %add22)
store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 0, ptr %arrayidx6.3, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false8.3, %lor.lhs.false.3, %for.inc.2
%sub3.4 = add i32 %i, 3
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp4.4 = icmp eq i32 %15, 1
br i1 %cmp4.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx6.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %16
%17 = load i32, ptr %arrayidx6.4, align 4, !tbaa !5
%cmp7.4 = icmp eq i32 %17, 1
br i1 %cmp7.4, label %for.inc.4, label %lor.lhs.false8.4
lor.lhs.false8.4: ; preds = %lor.lhs.false.4
%idxprom9.4 = sext i32 %sub3.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, 1
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false8.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 1, ptr %arrayidx6.4, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
tail call void @move(i32 noundef %add22)
store i32 0, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 0, ptr %arrayidx6.4, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false8.4, %lor.lhs.false.4, %for.inc.3
%sub3.5 = add i32 %i, 2
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp4.5 = icmp eq i32 %19, 1
br i1 %cmp4.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx6.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %20
%21 = load i32, ptr %arrayidx6.5, align 4, !tbaa !5
%cmp7.5 = icmp eq i32 %21, 1
br i1 %cmp7.5, label %for.inc.5, label %lor.lhs.false8.5
lor.lhs.false8.5: ; preds = %lor.lhs.false.5
%idxprom9.5 = sext i32 %sub3.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, 1
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false8.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 1, ptr %arrayidx6.5, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
tail call void @move(i32 noundef %add22)
store i32 0, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 0, ptr %arrayidx6.5, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false8.5, %lor.lhs.false.5, %for.inc.4
%sub3.6 = add i32 %i, 1
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp4.6 = icmp eq i32 %23, 1
br i1 %cmp4.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx6.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %24
%25 = load i32, ptr %arrayidx6.6, align 4, !tbaa !5
%cmp7.6 = icmp eq i32 %25, 1
br i1 %cmp7.6, label %for.inc.6, label %lor.lhs.false8.6
lor.lhs.false8.6: ; preds = %lor.lhs.false.6
%idxprom9.6 = sext i32 %sub3.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, 1
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false8.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 1, ptr %arrayidx6.6, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
tail call void @move(i32 noundef %add22)
store i32 0, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 0, ptr %arrayidx6.6, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false8.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp4.7 = icmp eq i32 %27, 1
br i1 %cmp4.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx6.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %28
%29 = load i32, ptr %arrayidx6.7, align 4, !tbaa !5
%cmp7.7 = icmp eq i32 %29, 1
br i1 %cmp7.7, label %common.ret, label %lor.lhs.false8.7
lor.lhs.false8.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, 1
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false8.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
ret void
if.end13.7: ; preds = %lor.lhs.false8.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 1, ptr %arrayidx6.7, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
tail call void @move(i32 noundef %add22)
store i32 0, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 0, ptr %arrayidx6.7, align 4, !tbaa !5
store i32 0, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
br label %common.ret
}
; 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 @print() local_unnamed_addr #0 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx7 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %for.inc, label %if.then
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not = icmp eq i32 %1, 0
br i1 %cmp8.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %2, 0
br i1 %tobool.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.1 = icmp eq i32 %3, 1
br i1 %cmp8.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%tobool.not.2 = icmp eq i32 %4, 0
br i1 %tobool.not.2, label %for.inc.2, label %if.then.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.2 = icmp eq i32 %5, 2
br i1 %cmp8.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%tobool.not.3 = icmp eq i32 %6, 0
br i1 %tobool.not.3, label %for.inc.3, label %if.then.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.3 = icmp eq i32 %7, 3
br i1 %cmp8.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx5.4, align 16, !tbaa !5
%tobool.not.4 = icmp eq i32 %8, 0
br i1 %tobool.not.4, label %for.inc.4, label %if.then.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.4 = icmp eq i32 %9, 4
br i1 %cmp8.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%tobool.not.5 = icmp eq i32 %10, 0
br i1 %tobool.not.5, label %for.inc.5, label %if.then.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.5 = icmp eq i32 %11, 5
br i1 %cmp8.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx5.6, align 8, !tbaa !5
%tobool.not.6 = icmp eq i32 %12, 0
br i1 %tobool.not.6, label %for.inc.6, label %if.then.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.6 = icmp eq i32 %13, 6
br i1 %cmp8.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i32]], ptr @queen, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%tobool.not.7 = icmp eq i32 %14, 0
br i1 %tobool.not.7, label %for.inc.7, label %if.then.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not.7 = icmp eq i32 %15, 7
br i1 %cmp8.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond17.preheader, label %for.cond1.preheader, !llvm.loop !11
for.cond17.preheader: ; preds = %for.inc.7, %for.cond17.preheader
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.cond17.preheader ], [ 0, %for.inc.7 ]
%arrayidx21 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv57
%16 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp eq i32 %16, 0
%. = select i1 %cmp22, i32 81, i32 46
%putchar47 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.1 = icmp eq i32 %17, 1
%.sink62 = select i1 %cmp22.1, i32 81, i32 46
%putchar47.1 = tail call i32 @putchar(i32 %.sink62)
%18 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.2 = icmp eq i32 %18, 2
%.sink63 = select i1 %cmp22.2, i32 81, i32 46
%putchar47.2 = tail call i32 @putchar(i32 %.sink63)
%19 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.3 = icmp eq i32 %19, 3
%.sink64 = select i1 %cmp22.3, i32 81, i32 46
%putchar47.3 = tail call i32 @putchar(i32 %.sink64)
%20 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.4 = icmp eq i32 %20, 4
%.sink65 = select i1 %cmp22.4, i32 81, i32 46
%putchar47.4 = tail call i32 @putchar(i32 %.sink65)
%21 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.5 = icmp eq i32 %21, 5
%.sink66 = select i1 %cmp22.5, i32 81, i32 46
%putchar47.5 = tail call i32 @putchar(i32 %.sink66)
%22 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.6 = icmp eq i32 %22, 6
%.sink67 = select i1 %cmp22.6, i32 81, i32 46
%putchar47.6 = tail call i32 @putchar(i32 %.sink67)
%23 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.7 = icmp eq i32 %23, 7
%.sink68 = select i1 %cmp22.7, i32 81, i32 46
%putchar47.7 = tail call i32 @putchar(i32 %.sink68)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond60.not = icmp eq i64 %indvars.iv.next58, 8
br i1 %exitcond60.not, label %cleanup, label %for.cond17.preheader, !llvm.loop !12
cleanup: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond17.preheader
ret void
}
; 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 N 8
#define FREE -1
#define NOT_FREE 1
int row[N],col[N],dpos[2*N-1],dneg[2*N-1],T[N][N];
void tofree(){
int i,j;
for(i=0;i<N;i++)row[i]=col[i]=FREE;
for(i=0;i<2*N-1;i++)dpos[i]=dneg[i]=FREE;
}
void printBoard(){
int i,j;
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(T[i][j]==1){
if(row[i]!=j)return;
}
}
}
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(row[i]==j)printf("Q");
else printf(".");
}
printf("\n");
}
}
void putQueen(int i){
int j;
if(i==N){
printBoard();
return;
}
for(j=0;j<N;j++){
if(col[j]==NOT_FREE || dpos[i+j]==NOT_FREE || dneg[i-j+N-1]==NOT_FREE)continue;
row[i]=j;
col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
putQueen(i+1);
col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
}
}
int main(){
int i,j,k,r,c;
tofree();
for(i=0;i<N;i++){
for(j=0;j<N;j++){
T[i][j]=0;
}}
scanf("%d",&k);
for(i=0;i<k;i++){
scanf("%d%d",&r,&c);
T[r][c]=1;
}
putQueen(0);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233175/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233175/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@col = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@row = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@dneg = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@dpos = dso_local local_unnamed_addr global [15 x i32] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [8 x [8 x i32]] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @tofree() local_unnamed_addr #0 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printBoard() local_unnamed_addr #2 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc.7
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc.7 ]
%arrayidx8 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 0
%0 = load i32, ptr %arrayidx5, align 16, !tbaa !5
%cmp6 = icmp eq i32 %0, 1
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.cond1.preheader
%1 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not = icmp eq i32 %1, 0
br i1 %cmp9.not, label %for.inc, label %cleanup
for.inc: ; preds = %for.cond1.preheader, %if.then
%arrayidx5.1 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%cmp6.1 = icmp eq i32 %2, 1
br i1 %cmp6.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.1 = icmp eq i32 %3, 1
br i1 %cmp9.not.1, label %for.inc.1, label %cleanup
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx5.2 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 2
%4 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5
%cmp6.2 = icmp eq i32 %4, 1
br i1 %cmp6.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.2 = icmp eq i32 %5, 2
br i1 %cmp9.not.2, label %for.inc.2, label %cleanup
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx5.3 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%cmp6.3 = icmp eq i32 %6, 1
br i1 %cmp6.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.3 = icmp eq i32 %7, 3
br i1 %cmp9.not.3, label %for.inc.3, label %cleanup
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx5.4 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 4
%8 = load i32, ptr %arrayidx5.4, align 16, !tbaa !5
%cmp6.4 = icmp eq i32 %8, 1
br i1 %cmp6.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
%9 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.4 = icmp eq i32 %9, 4
br i1 %cmp9.not.4, label %for.inc.4, label %cleanup
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx5.5 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 5
%10 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%cmp6.5 = icmp eq i32 %10, 1
br i1 %cmp6.5, label %if.then.5, label %for.inc.5
if.then.5: ; preds = %for.inc.4
%11 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.5 = icmp eq i32 %11, 5
br i1 %cmp9.not.5, label %for.inc.5, label %cleanup
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx5.6 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 6
%12 = load i32, ptr %arrayidx5.6, align 8, !tbaa !5
%cmp6.6 = icmp eq i32 %12, 1
br i1 %cmp6.6, label %if.then.6, label %for.inc.6
if.then.6: ; preds = %for.inc.5
%13 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.6 = icmp eq i32 %13, 6
br i1 %cmp9.not.6, label %for.inc.6, label %cleanup
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx5.7 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %indvars.iv, i64 7
%14 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%cmp6.7 = icmp eq i32 %14, 1
br i1 %cmp6.7, label %if.then.7, label %for.inc.7
if.then.7: ; preds = %for.inc.6
%15 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9.not.7 = icmp eq i32 %15, 7
br i1 %cmp9.not.7, label %for.inc.7, label %cleanup
for.inc.7: ; preds = %if.then.7, %for.inc.6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.cond18.preheader, label %for.cond1.preheader, !llvm.loop !9
for.cond18.preheader: ; preds = %for.inc.7, %for.cond18.preheader
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.cond18.preheader ], [ 0, %for.inc.7 ]
%arrayidx22 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %indvars.iv58
%16 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp eq i32 %16, 0
%. = select i1 %cmp23, i32 81, i32 46
%putchar48 = tail call i32 @putchar(i32 %.)
%17 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.1 = icmp eq i32 %17, 1
%.sink63 = select i1 %cmp23.1, i32 81, i32 46
%putchar48.1 = tail call i32 @putchar(i32 %.sink63)
%18 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.2 = icmp eq i32 %18, 2
%.sink64 = select i1 %cmp23.2, i32 81, i32 46
%putchar48.2 = tail call i32 @putchar(i32 %.sink64)
%19 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.3 = icmp eq i32 %19, 3
%.sink65 = select i1 %cmp23.3, i32 81, i32 46
%putchar48.3 = tail call i32 @putchar(i32 %.sink65)
%20 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.4 = icmp eq i32 %20, 4
%.sink66 = select i1 %cmp23.4, i32 81, i32 46
%putchar48.4 = tail call i32 @putchar(i32 %.sink66)
%21 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.5 = icmp eq i32 %21, 5
%.sink67 = select i1 %cmp23.5, i32 81, i32 46
%putchar48.5 = tail call i32 @putchar(i32 %.sink67)
%22 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.6 = icmp eq i32 %22, 6
%.sink68 = select i1 %cmp23.6, i32 81, i32 46
%putchar48.6 = tail call i32 @putchar(i32 %.sink68)
%23 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.7 = icmp eq i32 %23, 7
%.sink69 = select i1 %cmp23.7, i32 81, i32 46
%putchar48.7 = tail call i32 @putchar(i32 %.sink69)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%exitcond61.not = icmp eq i64 %indvars.iv.next59, 8
br i1 %exitcond61.not, label %cleanup, label %for.cond18.preheader, !llvm.loop !11
cleanup: ; preds = %if.then, %if.then.1, %if.then.2, %if.then.3, %if.then.4, %if.then.5, %if.then.6, %if.then.7, %for.cond18.preheader
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @putQueen(i32 noundef %i) local_unnamed_addr #2 {
entry:
%cmp = icmp eq i32 %i, 8
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = add i32 %i, 7
%idxprom14 = sext i32 %i to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @row, i64 0, i64 %idxprom14
%add26 = add nsw i32 %i, 1
%0 = load i32, ptr @col, align 16, !tbaa !5
%cmp2 = icmp eq i32 %0, 1
br i1 %cmp2, label %for.inc, label %lor.lhs.false
if.then: ; preds = %entry
tail call void @printBoard()
br label %common.ret
lor.lhs.false: ; preds = %for.cond.preheader
%arrayidx4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %idxprom14
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %1, 1
br i1 %cmp5, label %for.inc, label %lor.lhs.false6
lor.lhs.false6: ; preds = %lor.lhs.false
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %2, 1
br i1 %cmp11, label %for.inc, label %if.end13
if.end13: ; preds = %lor.lhs.false6
store i32 0, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10, align 4, !tbaa !5
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
store i32 1, ptr @col, align 16, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4, align 4, !tbaa !5
store i32 -1, ptr @col, align 16, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %lor.lhs.false, %lor.lhs.false6, %if.end13
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
%cmp2.1 = icmp eq i32 %3, 1
br i1 %cmp2.1, label %for.inc.1, label %lor.lhs.false.1
lor.lhs.false.1: ; preds = %for.inc
%4 = add nsw i64 %idxprom14, 1
%arrayidx4.1 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %4
%5 = load i32, ptr %arrayidx4.1, align 4, !tbaa !5
%cmp5.1 = icmp eq i32 %5, 1
br i1 %cmp5.1, label %for.inc.1, label %lor.lhs.false6.1
lor.lhs.false6.1: ; preds = %lor.lhs.false.1
%sub8.1 = add i32 %i, 6
%idxprom9.1 = sext i32 %sub8.1 to i64
%arrayidx10.1 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.1
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.1 = icmp eq i32 %6, 1
br i1 %cmp11.1, label %for.inc.1, label %if.end13.1
if.end13.1: ; preds = %lor.lhs.false6.1
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.1, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.1, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 1), align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end13.1, %lor.lhs.false6.1, %lor.lhs.false.1, %for.inc
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
%cmp2.2 = icmp eq i32 %7, 1
br i1 %cmp2.2, label %for.inc.2, label %lor.lhs.false.2
lor.lhs.false.2: ; preds = %for.inc.1
%8 = add nsw i64 %idxprom14, 2
%arrayidx4.2 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %8
%9 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%cmp5.2 = icmp eq i32 %9, 1
br i1 %cmp5.2, label %for.inc.2, label %lor.lhs.false6.2
lor.lhs.false6.2: ; preds = %lor.lhs.false.2
%sub8.2 = add i32 %i, 5
%idxprom9.2 = sext i32 %sub8.2 to i64
%arrayidx10.2 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.2
%10 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %10, 1
br i1 %cmp11.2, label %for.inc.2, label %if.end13.2
if.end13.2: ; preds = %lor.lhs.false6.2
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.2, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.2, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 2), align 8, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end13.2, %lor.lhs.false6.2, %lor.lhs.false.2, %for.inc.1
%11 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
%cmp2.3 = icmp eq i32 %11, 1
br i1 %cmp2.3, label %for.inc.3, label %lor.lhs.false.3
lor.lhs.false.3: ; preds = %for.inc.2
%12 = add nsw i64 %idxprom14, 3
%arrayidx4.3 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %12
%13 = load i32, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp5.3 = icmp eq i32 %13, 1
br i1 %cmp5.3, label %for.inc.3, label %lor.lhs.false6.3
lor.lhs.false6.3: ; preds = %lor.lhs.false.3
%sub8.3 = add i32 %i, 4
%idxprom9.3 = sext i32 %sub8.3 to i64
%arrayidx10.3 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.3
%14 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%cmp11.3 = icmp eq i32 %14, 1
br i1 %cmp11.3, label %for.inc.3, label %if.end13.3
if.end13.3: ; preds = %lor.lhs.false6.3
store i32 3, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.3, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.3, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 3), align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.end13.3, %lor.lhs.false6.3, %lor.lhs.false.3, %for.inc.2
%15 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
%cmp2.4 = icmp eq i32 %15, 1
br i1 %cmp2.4, label %for.inc.4, label %lor.lhs.false.4
lor.lhs.false.4: ; preds = %for.inc.3
%16 = add nsw i64 %idxprom14, 4
%arrayidx4.4 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %16
%17 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%cmp5.4 = icmp eq i32 %17, 1
br i1 %cmp5.4, label %for.inc.4, label %lor.lhs.false6.4
lor.lhs.false6.4: ; preds = %lor.lhs.false.4
%sub8.4 = add i32 %i, 3
%idxprom9.4 = sext i32 %sub8.4 to i64
%arrayidx10.4 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.4
%18 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %18, 1
br i1 %cmp11.4, label %for.inc.4, label %if.end13.4
if.end13.4: ; preds = %lor.lhs.false6.4
store i32 4, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.4, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.4, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 4), align 16, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.end13.4, %lor.lhs.false6.4, %lor.lhs.false.4, %for.inc.3
%19 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
%cmp2.5 = icmp eq i32 %19, 1
br i1 %cmp2.5, label %for.inc.5, label %lor.lhs.false.5
lor.lhs.false.5: ; preds = %for.inc.4
%20 = add nsw i64 %idxprom14, 5
%arrayidx4.5 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %20
%21 = load i32, ptr %arrayidx4.5, align 4, !tbaa !5
%cmp5.5 = icmp eq i32 %21, 1
br i1 %cmp5.5, label %for.inc.5, label %lor.lhs.false6.5
lor.lhs.false6.5: ; preds = %lor.lhs.false.5
%sub8.5 = add i32 %i, 2
%idxprom9.5 = sext i32 %sub8.5 to i64
%arrayidx10.5 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.5
%22 = load i32, ptr %arrayidx10.5, align 4, !tbaa !5
%cmp11.5 = icmp eq i32 %22, 1
br i1 %cmp11.5, label %for.inc.5, label %if.end13.5
if.end13.5: ; preds = %lor.lhs.false6.5
store i32 5, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.5, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.5, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 5), align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.end13.5, %lor.lhs.false6.5, %lor.lhs.false.5, %for.inc.4
%23 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
%cmp2.6 = icmp eq i32 %23, 1
br i1 %cmp2.6, label %for.inc.6, label %lor.lhs.false.6
lor.lhs.false.6: ; preds = %for.inc.5
%24 = add nsw i64 %idxprom14, 6
%arrayidx4.6 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %24
%25 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%cmp5.6 = icmp eq i32 %25, 1
br i1 %cmp5.6, label %for.inc.6, label %lor.lhs.false6.6
lor.lhs.false6.6: ; preds = %lor.lhs.false.6
%sub8.6 = add i32 %i, 1
%idxprom9.6 = sext i32 %sub8.6 to i64
%arrayidx10.6 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom9.6
%26 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %26, 1
br i1 %cmp11.6, label %for.inc.6, label %if.end13.6
if.end13.6: ; preds = %lor.lhs.false6.6
store i32 6, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.6, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.6, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 6), align 8, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.end13.6, %lor.lhs.false6.6, %lor.lhs.false.6, %for.inc.5
%27 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
%cmp2.7 = icmp eq i32 %27, 1
br i1 %cmp2.7, label %common.ret, label %lor.lhs.false.7
lor.lhs.false.7: ; preds = %for.inc.6
%28 = add nsw i64 %idxprom14, 7
%arrayidx4.7 = getelementptr inbounds [15 x i32], ptr @dpos, i64 0, i64 %28
%29 = load i32, ptr %arrayidx4.7, align 4, !tbaa !5
%cmp5.7 = icmp eq i32 %29, 1
br i1 %cmp5.7, label %common.ret, label %lor.lhs.false6.7
lor.lhs.false6.7: ; preds = %lor.lhs.false.7
%arrayidx10.7 = getelementptr inbounds [15 x i32], ptr @dneg, i64 0, i64 %idxprom14
%30 = load i32, ptr %arrayidx10.7, align 4, !tbaa !5
%cmp11.7 = icmp eq i32 %30, 1
br i1 %cmp11.7, label %common.ret, label %if.end13.7
common.ret: ; preds = %if.then, %lor.lhs.false6.7, %lor.lhs.false.7, %for.inc.6, %if.end13.7
ret void
if.end13.7: ; preds = %lor.lhs.false6.7
store i32 7, ptr %arrayidx15, align 4, !tbaa !5
store i32 1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
tail call void @putQueen(i32 noundef %add26)
store i32 -1, ptr %arrayidx10.7, align 4, !tbaa !5
store i32 -1, ptr %arrayidx4.7, align 4, !tbaa !5
store i32 -1, ptr getelementptr inbounds ([8 x i32], ptr @col, i64 0, i64 7), align 4, !tbaa !5
br label %common.ret
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%k = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @col, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) @row, i8 -1, i64 32, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dneg, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @dpos, i8 -1, i64 60, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) @T, i8 0, i64 256, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp1028 = icmp sgt i32 %0, 0
br i1 %cmp1028, label %for.body11, label %for.end19
for.body11: ; preds = %entry, %for.body11
%i.129 = phi i32 [ %inc18, %for.body11 ], [ 0, %entry ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %r, ptr noundef nonnull %c)
%1 = load i32, ptr %r, align 4, !tbaa !5
%idxprom13 = sext i32 %1 to i64
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom15 = sext i32 %2 to i64
%arrayidx16 = getelementptr inbounds [8 x [8 x i32]], ptr @T, i64 0, i64 %idxprom13, i64 %idxprom15
store i32 1, ptr %arrayidx16, align 4, !tbaa !5
%inc18 = add nuw nsw i32 %i.129, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc18, %3
br i1 %cmp10, label %for.body11, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body11, %entry
call void @putQueen(i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn 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 #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: write) }
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 whriswrng(int *p,int m){
int a=p[0]+p[1];
int b=p[1]+p[2];
int c=p[2]+p[3];
if(p[0]!=p[1]){
if(a!=p[2]){
if(b!=p[0]){
return 0;
}
else{
if(b!=c){
return 2;
}
else{
return 0;
}
}
}
else{
return 1;
}
}
else{
if(a==p[2]){
if(c!=p[0]){
return 1;
}
else{
return 3;
}
}
else{
int i=2;
while(i!=m){
if(p[i]!=p[0]){
return i+1;
}
i++;
}
}
}
return m;
}
int judge(int *p,int n){
int m=n-1;
int d[m];
int i;
for(i=0;i<m;i++){
d[i]=p[i+1]-p[i];
}
return whriswrng(d,m);
}
void doit(int n){
int a[n];
int i;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("%d\n",a[judge(a,n)]);
}
int main(){
int n;
scanf("%d",&n);
if(n!=0){
doit(n+1);
return main();
}
else{
return 0;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233225/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233225/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @whriswrng(ptr nocapture noundef readonly %p, i32 noundef %m) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %p, align 4, !tbaa !5
%arrayidx1 = getelementptr inbounds i32, ptr %p, i64 1
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%arrayidx3 = getelementptr inbounds i32, ptr %p, i64 2
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%add4 = add nsw i32 %2, %1
%arrayidx6 = getelementptr inbounds i32, ptr %p, i64 3
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%add7 = add nsw i32 %3, %2
%cmp.not = icmp eq i32 %0, %1
%cmp22 = icmp eq i32 %add, %2
br i1 %cmp.not, label %if.else20, label %if.then
if.then: ; preds = %entry
br i1 %cmp22, label %cleanup37, label %if.then12
if.then12: ; preds = %if.then
%cmp14.not = icmp eq i32 %add4, %0
br i1 %cmp14.not, label %if.else, label %cleanup37
if.else: ; preds = %if.then12
%cmp16.not = icmp eq i32 %1, %3
%. = select i1 %cmp16.not, i32 0, i32 2
br label %cleanup37
if.else20: ; preds = %entry
br i1 %cmp22, label %if.then23, label %while.cond.preheader
while.cond.preheader: ; preds = %if.else20
%cmp29.not62 = icmp eq i32 %m, 2
br i1 %cmp29.not62, label %cleanup37, label %while.body.preheader
while.body.preheader: ; preds = %while.cond.preheader
%4 = zext i32 %m to i64
br label %while.body
if.then23: ; preds = %if.else20
%cmp25.not = icmp eq i32 %add7, %0
%.60 = select i1 %cmp25.not, i32 3, i32 1
br label %cleanup37
while.body: ; preds = %while.body.preheader, %if.end
%indvars.iv = phi i64 [ 2, %while.body.preheader ], [ %indvars.iv.next, %if.end ]
%arrayidx30 = getelementptr inbounds i32, ptr %p, i64 %indvars.iv
%5 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%cmp32.not = icmp eq i32 %5, %0
br i1 %cmp32.not, label %if.end, label %if.then33
if.then33: ; preds = %while.body
%6 = trunc i64 %indvars.iv to i32
%add34 = add nuw nsw i32 %6, 1
br label %cleanup37
if.end: ; preds = %while.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp29.not = icmp eq i64 %indvars.iv.next, %4
br i1 %cmp29.not, label %cleanup37, label %while.body, !llvm.loop !9
cleanup37: ; preds = %if.end, %while.cond.preheader, %if.then33, %if.then23, %if.then, %if.else, %if.then12
%retval.1 = phi i32 [ 0, %if.then12 ], [ %., %if.else ], [ 1, %if.then ], [ %.60, %if.then23 ], [ %add34, %if.then33 ], [ 2, %while.cond.preheader ], [ %m, %if.end ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @judge(ptr nocapture noundef readonly %p, i32 noundef %n) local_unnamed_addr #0 {
entry:
%sub = add i32 %n, -1
%0 = zext i32 %sub to i64
%vla = alloca i32, i64 %0, align 16
%cmp14 = icmp sgt i32 %n, 1
br i1 %cmp14, label %for.body.preheader, label %if.then23.i
for.body.preheader: ; preds = %entry
%.pre = load i32, ptr %p, align 4, !tbaa !5
%min.iters.check = icmp ult i32 %n, 9
br i1 %min.iters.check, label %for.body.preheader36, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, 4294967288
%vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load34, %vector.body ]
%1 = or i64 %index, 1
%2 = getelementptr inbounds i32, ptr %p, i64 %1
%wide.load = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load34 = load <4 x i32>, ptr %3, align 4, !tbaa !5
%4 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%5 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load34, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%6 = sub nsw <4 x i32> %wide.load, %4
%7 = sub nsw <4 x i32> %wide.load34, %5
%8 = getelementptr inbounds i32, ptr %vla, i64 %index
store <4 x i32> %6, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
store <4 x i32> %7, ptr %9, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %0
%vector.recur.extract = extractelement <4 x i32> %wide.load34, i64 3
br i1 %cmp.n, label %for.end, label %for.body.preheader36
for.body.preheader36: ; preds = %for.body.preheader, %middle.block
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body.preheader ]
%indvars.iv.ph = phi i64 [ %n.vec, %middle.block ], [ 0, %for.body.preheader ]
br label %for.body
for.body: ; preds = %for.body.preheader36, %for.body
%scalar.recur = phi i32 [ %11, %for.body ], [ %scalar.recur.ph, %for.body.preheader36 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader36 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i32, ptr %p, i64 %indvars.iv.next
%11 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub3 = sub nsw i32 %11, %scalar.recur
%arrayidx5 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
store i32 %sub3, ptr %arrayidx5, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %for.body, %middle.block
%.pre18 = load i32, ptr %vla, align 16, !tbaa !5
%arrayidx1.i.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 1
%.pre19 = load i32, ptr %arrayidx1.i.phi.trans.insert, align 4, !tbaa !5
%arrayidx3.i.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 2
%.pre20 = load i32, ptr %arrayidx3.i.phi.trans.insert, align 8, !tbaa !5
%arrayidx6.i.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 3
%.pre21 = load i32, ptr %arrayidx6.i.phi.trans.insert, align 4, !tbaa !5
%add.i = add nsw i32 %.pre19, %.pre18
%add4.i = add nsw i32 %.pre20, %.pre19
%cmp.not.i = icmp eq i32 %.pre18, %.pre19
%cmp22.i = icmp eq i32 %add.i, %.pre20
br i1 %cmp.not.i, label %if.else20.i, label %if.then.i
if.then.i: ; preds = %for.end
br i1 %cmp22.i, label %whriswrng.exit, label %if.then12.i
if.then12.i: ; preds = %if.then.i
%cmp14.not.i = icmp eq i32 %add4.i, %.pre18
br i1 %cmp14.not.i, label %if.else.i, label %whriswrng.exit
if.else.i: ; preds = %if.then12.i
%cmp16.not.i = icmp eq i32 %.pre19, %.pre21
%..i = select i1 %cmp16.not.i, i32 0, i32 2
br label %whriswrng.exit
if.else20.i: ; preds = %for.end
%add7.i = add nsw i32 %.pre21, %.pre20
br i1 %cmp22.i, label %if.then23.i, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.else20.i
%cmp29.not62.i = icmp eq i32 %sub, 2
br i1 %cmp29.not62.i, label %whriswrng.exit, label %while.body.i
if.then23.i: ; preds = %entry, %if.else20.i
%12 = phi i32 [ %.pre19, %if.else20.i ], [ undef, %entry ]
%add7.i2731 = phi i32 [ %add7.i, %if.else20.i ], [ undef, %entry ]
%cmp25.not.i = icmp eq i32 %add7.i2731, %12
%.60.i = select i1 %cmp25.not.i, i32 3, i32 1
br label %whriswrng.exit
while.body.i: ; preds = %while.cond.preheader.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 2, %while.cond.preheader.i ]
%arrayidx30.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
%13 = load i32, ptr %arrayidx30.i, align 4, !tbaa !5
%cmp32.not.i = icmp eq i32 %13, %.pre19
br i1 %cmp32.not.i, label %if.end.i, label %if.then33.i
if.then33.i: ; preds = %while.body.i
%14 = trunc i64 %indvars.iv.i to i32
%add34.i = add nuw nsw i32 %14, 1
br label %whriswrng.exit
if.end.i: ; preds = %while.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%cmp29.not.i = icmp eq i64 %indvars.iv.next.i, %0
br i1 %cmp29.not.i, label %whriswrng.exit, label %while.body.i, !llvm.loop !9
whriswrng.exit: ; preds = %if.end.i, %if.then.i, %if.then12.i, %if.else.i, %while.cond.preheader.i, %if.then23.i, %if.then33.i
%retval.1.i = phi i32 [ 0, %if.then12.i ], [ %..i, %if.else.i ], [ 1, %if.then.i ], [ %.60.i, %if.then23.i ], [ %add34.i, %if.then33.i ], [ 2, %while.cond.preheader.i ], [ %sub, %if.end.i ]
ret i32 %retval.1.i
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @doit(i32 noundef %n) local_unnamed_addr #2 {
entry:
%0 = zext i32 %n to i64
%vla = alloca i32, i64 %0, align 16
%cmp9 = icmp sgt i32 %n, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !15
for.end: ; preds = %for.body, %entry
%call1 = call i32 @judge(ptr noundef nonnull %vla, i32 noundef %n)
%idxprom2 = sext i32 %call1 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %vla, i64 %idxprom2
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
ret void
}
; 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 uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, 0
br i1 %cmp.not, label %cleanup, label %if.then
if.then: ; preds = %entry
%add = add nsw i32 %0, 1
call void @doit(i32 noundef %add)
%call1 = call i32 @main()
br label %cleanup
cleanup: ; preds = %entry, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main()
{
int A,B,C,D,R,L1,L2;
scanf("%d %d %d %d",&A,&B,&C,&D);
L1=A;
if(B<A)
{L1=B;}
L2=C;
if(D<C)
{L2=D;}
R=L1+L2;
printf("%d\n",R);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233269/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233269/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%D = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %D)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %1, i32 %0)
%2 = load i32, ptr %C, align 4, !tbaa !5
%3 = load i32, ptr %D, align 4, !tbaa !5
%L2.0 = call i32 @llvm.smin.i32(i32 %3, i32 %2)
%add = add nsw i32 %L2.0, %spec.select
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 <stdlib.h>
int main()
{
int a,b,c,d,i,j;
while(~scanf("%d %d %d %d",&a,&b,&c,&d))
{
if(a>b)
{
i=b;
}
if(a<=b)
{
i=a;
}
if(c>d)
{
j=d;
}
if(c<=d)
{
j=c;
}
printf("%d\n",i+j);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233326/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233326/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%tobool.not15 = icmp eq i32 %call14, -1
br i1 %tobool.not15, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%i.2 = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%2 = load i32, ptr %c, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%j.2 = call i32 @llvm.smin.i32(i32 %2, i32 %3)
%add = add nsw i32 %j.2, %i.2
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
void print(int *a,int n)
{
int i;
for(i=0;i<n;i++)
printf("%d ",a[i]);
printf("\n");
}
int main()
{
int max,a[505][505],i,j,cnt,n,m,q,x,y;
scanf("%d %d %d",&n,&m,&q);
for(i=1;i<=n;i++)
{
cnt=0;
max=0;
for(j=1;j<=m;j++)
{
scanf("%d",&a[i][j]);
if(a[i][j]==1)
cnt++;
else
cnt=0;
if(cnt>max)
max=cnt;
}
a[i][0]=max;
}
for(i=0;i<q;i++)
{
scanf("%d %d",&x,&y);
a[x][y]=(a[x][y]^1);
cnt=0;
max=0;
for(j=1;j<=m;j++)
{
if(a[x][j]==1)
cnt++;
else
cnt=0;
if(cnt>max)
max=cnt;
}
a[x][0]=max;
max=0;
for(j=1;j<=n;j++)
{
if(max<a[j][0])
max=a[j][0];
}
printf("%d\n",max);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23337/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23337/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [505 x [505 x i32]], align 16
%n = alloca i32, align 4
%m = alloca i32, align 4
%q = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1020100, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not104 = icmp slt i32 %0, 1
br i1 %cmp.not104, label %for.cond22.preheader, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %m, align 4, !tbaa !5
%2 = icmp slt i32 %1, 1
br i1 %2, label %for.cond1.preheader.lr.ph.split.us, label %for.cond1.preheader
for.cond1.preheader.lr.ph.split.us: ; preds = %for.cond1.preheader.lr.ph
%3 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %3 to i64
%4 = add nsw i64 %wide.trip.count, -1
%5 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %4, 3
%6 = icmp ult i64 %5, 3
br i1 %6, label %for.cond22.preheader.loopexit.unr-lcssa, label %for.cond1.preheader.lr.ph.split.us.new
for.cond1.preheader.lr.ph.split.us.new: ; preds = %for.cond1.preheader.lr.ph.split.us
%unroll_iter = and i64 %4, -4
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.lr.ph.split.us.new
%indvars.iv122 = phi i64 [ 1, %for.cond1.preheader.lr.ph.split.us.new ], [ %indvars.iv.next123.3, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.lr.ph.split.us.new ], [ %niter.next.3, %for.cond1.preheader.us ]
%arrayidx17.us = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %indvars.iv122
store i32 0, ptr %arrayidx17.us, align 4, !tbaa !5
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%arrayidx17.us.1 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %indvars.iv.next123
store i32 0, ptr %arrayidx17.us.1, align 4, !tbaa !5
%indvars.iv.next123.1 = add nuw nsw i64 %indvars.iv122, 2
%arrayidx17.us.2 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %indvars.iv.next123.1
store i32 0, ptr %arrayidx17.us.2, align 4, !tbaa !5
%indvars.iv.next123.2 = add nuw nsw i64 %indvars.iv122, 3
%arrayidx17.us.3 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %indvars.iv.next123.2
store i32 0, ptr %arrayidx17.us.3, align 4, !tbaa !5
%indvars.iv.next123.3 = add nuw nsw i64 %indvars.iv122, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond22.preheader.loopexit.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !11
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.end
%7 = phi i32 [ %13, %for.end ], [ %0, %for.cond1.preheader.lr.ph ]
%8 = phi i32 [ %14, %for.end ], [ %1, %for.cond1.preheader.lr.ph ]
%indvars.iv119 = phi i64 [ %indvars.iv.next120, %for.end ], [ 1, %for.cond1.preheader.lr.ph ]
%cmp2.not100 = icmp slt i32 %8, 1
br i1 %cmp2.not100, label %for.end, label %for.body3
for.cond22.preheader.loopexit.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.lr.ph.split.us
%indvars.iv122.unr = phi i64 [ 1, %for.cond1.preheader.lr.ph.split.us ], [ %indvars.iv.next123.3, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond22.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond22.preheader.loopexit.unr-lcssa, %for.cond1.preheader.us.epil
%indvars.iv122.epil = phi i64 [ %indvars.iv.next123.epil, %for.cond1.preheader.us.epil ], [ %indvars.iv122.unr, %for.cond22.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond22.preheader.loopexit.unr-lcssa ]
%arrayidx17.us.epil = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %indvars.iv122.epil
store i32 0, ptr %arrayidx17.us.epil, align 4, !tbaa !5
%indvars.iv.next123.epil = add nuw nsw i64 %indvars.iv122.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond22.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !12
for.cond22.preheader: ; preds = %for.end, %for.cond22.preheader.loopexit.unr-lcssa, %for.cond1.preheader.us.epil, %entry
%9 = load i32, ptr %q, align 4, !tbaa !5
%cmp23115 = icmp sgt i32 %9, 0
br i1 %cmp23115, label %for.body24, label %for.end73
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 1, %for.cond1.preheader ]
%cnt.0103 = phi i32 [ %cnt.1, %for.body3 ], [ 0, %for.cond1.preheader ]
%max.0101 = phi i32 [ %max.1, %for.body3 ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %indvars.iv119, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx5)
%10 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp11 = icmp eq i32 %10, 1
%inc = add nsw i32 %cnt.0103, 1
%cnt.1 = select i1 %cmp11, i32 %inc, i32 0
%max.1 = call i32 @llvm.smax.i32(i32 %cnt.1, i32 %max.0101)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = load i32, ptr %m, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp2.not.not = icmp slt i64 %indvars.iv, %12
br i1 %cmp2.not.not, label %for.body3, label %for.end.loopexit, !llvm.loop !14
for.end.loopexit: ; preds = %for.body3
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %for.cond1.preheader
%13 = phi i32 [ %7, %for.cond1.preheader ], [ %.pre, %for.end.loopexit ]
%14 = phi i32 [ %8, %for.cond1.preheader ], [ %11, %for.end.loopexit ]
%max.0.lcssa = phi i32 [ 0, %for.cond1.preheader ], [ %max.1, %for.end.loopexit ]
%arrayidx17 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %indvars.iv119
store i32 %max.0.lcssa, ptr %arrayidx17, align 4, !tbaa !5
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%15 = sext i32 %13 to i64
%cmp.not.not = icmp slt i64 %indvars.iv119, %15
br i1 %cmp.not.not, label %for.cond1.preheader, label %for.cond22.preheader, !llvm.loop !15
for.body24: ; preds = %for.cond22.preheader, %for.end69
%i.1116 = phi i32 [ %inc72, %for.end69 ], [ 0, %for.cond22.preheader ]
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %x, ptr noundef nonnull %y)
%16 = load i32, ptr %x, align 4, !tbaa !5
%idxprom26 = sext i32 %16 to i64
%17 = load i32, ptr %y, align 4, !tbaa !5
%idxprom28 = sext i32 %17 to i64
%arrayidx29 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %idxprom26, i64 %idxprom28
%18 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%xor = xor i32 %18, 1
store i32 %xor, ptr %arrayidx29, align 4, !tbaa !5
%19 = load i32, ptr %m, align 4, !tbaa !5
%cmp35.not106 = icmp slt i32 %19, 1
br i1 %cmp35.not106, label %for.end51, label %for.body36.preheader
for.body36.preheader: ; preds = %for.body24
%20 = zext i32 %19 to i64
%xtraiter142 = and i64 %20, 1
%21 = icmp eq i32 %19, 1
br i1 %21, label %for.end51.loopexit.unr-lcssa, label %for.body36.preheader.new
for.body36.preheader.new: ; preds = %for.body36.preheader
%unroll_iter146 = and i64 %20, 4294967294
br label %for.body36
for.body36: ; preds = %for.body36, %for.body36.preheader.new
%indvars.iv125 = phi i64 [ 1, %for.body36.preheader.new ], [ %indvars.iv.next126.1, %for.body36 ]
%cnt.2109 = phi i32 [ 0, %for.body36.preheader.new ], [ %cnt.3.1, %for.body36 ]
%max.2107 = phi i32 [ 0, %for.body36.preheader.new ], [ %max.3.1, %for.body36 ]
%niter147 = phi i64 [ 0, %for.body36.preheader.new ], [ %niter147.next.1, %for.body36 ]
%arrayidx40 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %idxprom26, i64 %indvars.iv125
%22 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%cmp41 = icmp eq i32 %22, 1
%inc43 = add nsw i32 %cnt.2109, 1
%cnt.3 = select i1 %cmp41, i32 %inc43, i32 0
%max.3 = call i32 @llvm.smax.i32(i32 %cnt.3, i32 %max.2107)
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%arrayidx40.1 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %idxprom26, i64 %indvars.iv.next126
%23 = load i32, ptr %arrayidx40.1, align 4, !tbaa !5
%cmp41.1 = icmp eq i32 %23, 1
%inc43.1 = add nsw i32 %cnt.3, 1
%cnt.3.1 = select i1 %cmp41.1, i32 %inc43.1, i32 0
%max.3.1 = call i32 @llvm.smax.i32(i32 %cnt.3.1, i32 %max.3)
%indvars.iv.next126.1 = add nuw nsw i64 %indvars.iv125, 2
%niter147.next.1 = add i64 %niter147, 2
%niter147.ncmp.1 = icmp eq i64 %niter147.next.1, %unroll_iter146
br i1 %niter147.ncmp.1, label %for.end51.loopexit.unr-lcssa, label %for.body36, !llvm.loop !17
for.end51.loopexit.unr-lcssa: ; preds = %for.body36, %for.body36.preheader
%max.3.lcssa.ph = phi i32 [ undef, %for.body36.preheader ], [ %max.3.1, %for.body36 ]
%indvars.iv125.unr = phi i64 [ 1, %for.body36.preheader ], [ %indvars.iv.next126.1, %for.body36 ]
%cnt.2109.unr = phi i32 [ 0, %for.body36.preheader ], [ %cnt.3.1, %for.body36 ]
%max.2107.unr = phi i32 [ 0, %for.body36.preheader ], [ %max.3.1, %for.body36 ]
%lcmp.mod144.not = icmp eq i64 %xtraiter142, 0
br i1 %lcmp.mod144.not, label %for.end51, label %for.body36.epil
for.body36.epil: ; preds = %for.end51.loopexit.unr-lcssa
%arrayidx40.epil = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %idxprom26, i64 %indvars.iv125.unr
%24 = load i32, ptr %arrayidx40.epil, align 4, !tbaa !5
%cmp41.epil = icmp eq i32 %24, 1
%inc43.epil = add nsw i32 %cnt.2109.unr, 1
%cnt.3.epil = select i1 %cmp41.epil, i32 %inc43.epil, i32 0
%max.3.epil = call i32 @llvm.smax.i32(i32 %cnt.3.epil, i32 %max.2107.unr)
br label %for.end51
for.end51: ; preds = %for.body36.epil, %for.end51.loopexit.unr-lcssa, %for.body24
%max.2.lcssa = phi i32 [ 0, %for.body24 ], [ %max.3.lcssa.ph, %for.end51.loopexit.unr-lcssa ], [ %max.3.epil, %for.body36.epil ]
%arrayidx53 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %idxprom26
store i32 %max.2.lcssa, ptr %arrayidx53, align 4, !tbaa !5
%25 = load i32, ptr %n, align 4, !tbaa !5
%cmp56.not111 = icmp slt i32 %25, 1
br i1 %cmp56.not111, label %for.end69, label %for.body57.preheader
for.body57.preheader: ; preds = %for.end51
%26 = add nuw i32 %25, 1
%wide.trip.count133 = zext i32 %26 to i64
%27 = add nsw i64 %wide.trip.count133, -1
%min.iters.check = icmp ult i32 %25, 8
br i1 %min.iters.check, label %for.body57.preheader138, label %vector.ph
vector.ph: ; preds = %for.body57.preheader
%n.vec = and i64 %27, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %59, %vector.body ]
%vec.phi137 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %60, %vector.body ]
%offset.idx = or i64 %index, 1
%28 = or i64 %index, 2
%29 = or i64 %index, 3
%30 = or i64 %index, 4
%31 = or i64 %index, 5
%32 = or i64 %index, 6
%33 = or i64 %index, 7
%34 = add i64 %index, 8
%35 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %offset.idx
%36 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %28
%37 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %29
%38 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %30
%39 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %31
%40 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %32
%41 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %33
%42 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %34
%43 = load i32, ptr %35, align 4, !tbaa !5
%44 = load i32, ptr %36, align 8, !tbaa !5
%45 = load i32, ptr %37, align 4, !tbaa !5
%46 = load i32, ptr %38, align 16, !tbaa !5
%47 = insertelement <4 x i32> poison, i32 %43, i64 0
%48 = insertelement <4 x i32> %47, i32 %44, i64 1
%49 = insertelement <4 x i32> %48, i32 %45, i64 2
%50 = insertelement <4 x i32> %49, i32 %46, i64 3
%51 = load i32, ptr %39, align 4, !tbaa !5
%52 = load i32, ptr %40, align 8, !tbaa !5
%53 = load i32, ptr %41, align 4, !tbaa !5
%54 = load i32, ptr %42, align 16, !tbaa !5
%55 = insertelement <4 x i32> poison, i32 %51, i64 0
%56 = insertelement <4 x i32> %55, i32 %52, i64 1
%57 = insertelement <4 x i32> %56, i32 %53, i64 2
%58 = insertelement <4 x i32> %57, i32 %54, i64 3
%59 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %50)
%60 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi137, <4 x i32> %58)
%index.next = add nuw i64 %index, 8
%61 = icmp eq i64 %index.next, %n.vec
br i1 %61, label %middle.block, label %vector.body, !llvm.loop !18
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %59, <4 x i32> %60)
%62 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %27, %n.vec
br i1 %cmp.n, label %for.end69, label %for.body57.preheader138
for.body57.preheader138: ; preds = %for.body57.preheader, %middle.block
%indvars.iv130.ph = phi i64 [ 1, %for.body57.preheader ], [ %ind.end, %middle.block ]
%max.4112.ph = phi i32 [ 0, %for.body57.preheader ], [ %62, %middle.block ]
br label %for.body57
for.body57: ; preds = %for.body57.preheader138, %for.body57
%indvars.iv130 = phi i64 [ %indvars.iv.next131, %for.body57 ], [ %indvars.iv130.ph, %for.body57.preheader138 ]
%max.4112 = phi i32 [ %spec.select, %for.body57 ], [ %max.4112.ph, %for.body57.preheader138 ]
%arrayidx59 = getelementptr inbounds [505 x [505 x i32]], ptr %a, i64 0, i64 %indvars.iv130
%63 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %max.4112, i32 %63)
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%exitcond134.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count133
br i1 %exitcond134.not, label %for.end69, label %for.body57, !llvm.loop !21
for.end69: ; preds = %for.body57, %middle.block, %for.end51
%max.4.lcssa = phi i32 [ 0, %for.end51 ], [ %62, %middle.block ], [ %spec.select, %for.body57 ]
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %max.4.lcssa)
%inc72 = add nuw nsw i32 %i.1116, 1
%64 = load i32, ptr %q, align 4, !tbaa !5
%cmp23 = icmp slt i32 %inc72, %64
br i1 %cmp23, label %for.body24, label %for.end73, !llvm.loop !22
for.end73: ; preds = %for.end69, %for.cond22.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 1020100, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !10, !20, !19}
!22 = distinct !{!22, !10}
|
#include<stdio.h>
#include<string.h>
int chck(char *s,int l){
int i;
for(i=0;i<l/2;i++){
if(*(s+i)!=*(s+l-i-1))
return 0;
}
return 1;
}
int main(void){
char s[1000];
int k,i,l,c=0;
scanf("%s",s);
scanf("%d",&k);
l=strlen(s);
if(!(l%k)){
for(i=0;i<l;i+=l/k){
c+=chck(&s[i],l/k);
}
if(c==k)
printf("YES");
else
printf("NO");
}
else
printf("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23342/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23342/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"%d\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 norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @chck(ptr nocapture noundef readonly %s, i32 noundef %l) local_unnamed_addr #0 {
entry:
%cmp14 = icmp sgt i32 %l, 1
br i1 %cmp14, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %entry
%div1819 = lshr i32 %l, 1
%idx.ext1 = zext i32 %l to i64
%add.ptr2 = getelementptr inbounds i8, ptr %s, i64 %idx.ext1
%invariant.gep = getelementptr i8, ptr %add.ptr2, i64 -1
%wide.trip.count = zext i32 %div1819 to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.body.lr.ph, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.cond ]
%add.ptr = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
%0 = load i8, ptr %add.ptr, align 1, !tbaa !7
%idx.neg = sub nsw i64 0, %indvars.iv
%gep = getelementptr i8, ptr %invariant.gep, i64 %idx.neg
%1 = load i8, ptr %gep, align 1, !tbaa !7
%cmp7.not = icmp eq i8 %0, %1
br i1 %cmp7.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress 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:
%s = alloca [1000 x i8], align 16
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%conv = trunc i64 %call3 to i32
%0 = load i32, ptr %k, align 4, !tbaa !10
%rem = srem i32 %conv, %0
%div = sdiv i32 %conv, %0
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %for.cond.preheader, label %if.end15
for.cond.preheader: ; preds = %entry
%cmp22 = icmp sgt i32 %conv, 0
br i1 %cmp22, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %for.cond.preheader
%cmp14.i = icmp sgt i32 %div, 1
%div1819.i = lshr i32 %div, 1
%idx.ext1.i = zext i32 %div to i64
%wide.trip.count.i = zext i32 %div1819.i to i64
br i1 %cmp14.i, label %for.body.us.preheader, label %for.body.preheader
for.body.preheader: ; preds = %for.body.lr.ph
%smax = call i32 @llvm.smax.i32(i32 %div, i32 %conv)
%1 = add i32 %smax, -1
%2 = udiv i32 %1, %div
%3 = add i32 %2, 1
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body.preheader30, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %3, -8
%ind.end = mul i32 %n.vec, %div
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %4, %vector.body ]
%vec.phi29 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ]
%4 = add <4 x i32> %vec.phi, <i32 1, i32 1, i32 1, i32 1>
%5 = add <4 x i32> %vec.phi29, <i32 1, i32 1, i32 1, i32 1>
%index.next = add nuw i32 %index, 8
%6 = icmp eq i32 %index.next, %n.vec
br i1 %6, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %5, %4
%7 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %3, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader30
for.body.preheader30: ; preds = %for.body.preheader, %middle.block
%c.024.ph = phi i32 [ 0, %for.body.preheader ], [ %7, %middle.block ]
%i.023.ph = phi i32 [ 0, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body.us.preheader: ; preds = %for.body.lr.ph
%8 = zext i32 %div to i64
%sext = shl i64 %call3, 32
%9 = ashr exact i64 %sext, 32
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %chck.exit.loopexit.us
%indvars.iv = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next, %chck.exit.loopexit.us ]
%c.024.us = phi i32 [ 0, %for.body.us.preheader ], [ %add.us, %chck.exit.loopexit.us ]
%arrayidx.us = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv
%add.ptr2.i.us = getelementptr inbounds i8, ptr %arrayidx.us, i64 %idx.ext1.i
%invariant.gep.i.us = getelementptr i8, ptr %add.ptr2.i.us, i64 -1
br label %for.body.i.us
for.body.i.us: ; preds = %for.cond.i.us, %for.body.us
%indvars.iv.i.us = phi i64 [ 0, %for.body.us ], [ %indvars.iv.next.i.us, %for.cond.i.us ]
%add.ptr.i.us = getelementptr inbounds i8, ptr %arrayidx.us, i64 %indvars.iv.i.us
%10 = load i8, ptr %add.ptr.i.us, align 1, !tbaa !7
%idx.neg.i.us = sub nsw i64 0, %indvars.iv.i.us
%gep.i.us = getelementptr i8, ptr %invariant.gep.i.us, i64 %idx.neg.i.us
%11 = load i8, ptr %gep.i.us, align 1, !tbaa !7
%cmp7.not.i.us = icmp eq i8 %10, %11
br i1 %cmp7.not.i.us, label %for.cond.i.us, label %chck.exit.loopexit.us
for.cond.i.us: ; preds = %for.body.i.us
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i
br i1 %exitcond.not.i.us, label %chck.exit.loopexit.us, label %for.body.i.us, !llvm.loop !5
chck.exit.loopexit.us: ; preds = %for.cond.i.us, %for.body.i.us
%retval.0.i.ph.us = phi i32 [ 0, %for.body.i.us ], [ 1, %for.cond.i.us ]
%add.us = add nuw nsw i32 %retval.0.i.ph.us, %c.024.us
%indvars.iv.next = add i64 %indvars.iv, %8
%cmp.us = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp.us, label %for.body.us, label %for.end, !llvm.loop !15
for.body: ; preds = %for.body.preheader30, %for.body
%c.024 = phi i32 [ %add, %for.body ], [ %c.024.ph, %for.body.preheader30 ]
%i.023 = phi i32 [ %add7, %for.body ], [ %i.023.ph, %for.body.preheader30 ]
%add = add nuw nsw i32 %c.024, 1
%add7 = add nsw i32 %div, %i.023
%cmp = icmp slt i32 %add7, %conv
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body, %chck.exit.loopexit.us, %middle.block, %for.cond.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %7, %middle.block ], [ %add.us, %chck.exit.loopexit.us ], [ %add, %for.body ]
%cmp8 = icmp eq i32 %c.0.lcssa, %0
%.str.2..str.3 = select i1 %cmp8, ptr @.str.2, ptr @.str.3
br label %if.end15
if.end15: ; preds = %entry, %for.end
%.str.2.sink = phi ptr [ %.str.2..str.3, %for.end ], [ @.str.3, %entry ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = distinct !{!12, !6, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6, !14, !13}
|
#include <stdio.h>
int main(void) {
int a, b, c, d;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
scanf("%d", &d);
if (a >= b) {
a = b;
} if (c >= d) {
c = d;
} printf("%d\n", a + c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233470/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233470/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
store i32 %1, ptr %a, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%3 = load i32, ptr %c, align 4, !tbaa !5
%4 = load i32, ptr %d, align 4, !tbaa !5
%cmp4.not = icmp slt i32 %3, %4
br i1 %cmp4.not, label %if.end6, label %if.then5
if.then5: ; preds = %if.end
store i32 %4, ptr %c, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then5, %if.end
%5 = phi i32 [ %4, %if.then5 ], [ %3, %if.end ]
%add = add nsw i32 %5, %2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int min(int a,int b){
if(a<b){
return a;
}else return b;
}
int main(void){
int busfare[2],trainfare[2],ans;
scanf("%d",&busfare[0]);
scanf("%d",&busfare[1]);
scanf("%d",&trainfare[0]);
scanf("%d",&trainfare[1]);
ans=min(busfare[0],busfare[1])+min(trainfare[0],trainfare[1]);
printf("%d\n",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233513/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233513/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%busfare = alloca [2 x i32], align 4
%trainfare = alloca [2 x i32], align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %busfare) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %trainfare) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %busfare)
%arrayidx1 = getelementptr inbounds [2 x i32], ptr %busfare, i64 0, i64 1
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %trainfare)
%arrayidx5 = getelementptr inbounds [2 x i32], ptr %trainfare, i64 0, i64 1
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%0 = load i32, ptr %busfare, align 4, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%a.b.i = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%2 = load i32, ptr %trainfare, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%a.b.i14 = call i32 @llvm.smin.i32(i32 %2, i32 %3)
%add = add nsw i32 %a.b.i14, %a.b.i
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %trainfare) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %busfare) #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) #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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a, b, c, d, e, f;
scanf("%d %d %d %d",&a, &b, &c, &d);
if (a >= b){
e = b;
} else {
e = a;
}
if (c >= d){
f = d;
} else {
f = c;
}
printf("%d\n", e + f);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233557/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233557/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%. = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%2 = load i32, ptr %c, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%f.0 = call i32 @llvm.smin.i32(i32 %2, i32 %3)
%add = add nsw i32 %f.0, %.
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 <stdlib.h>
int a[501][501];
int d[501]={0};
int maxe(int a,int b)
{
if(a>=b)
return a;
else
return b;
}
int find_max(int n)
{
int i,max;
max=d[0];
for(i=1;i<n;i++)
{
if(d[i]>max)
max=d[i];
}
return max;
}
int main()
{
int n,m,q,i,j,x,y,k,max,p;
scanf("%d%d%d",&n,&m,&q);
for(i=0;i<n;i++)
{
p=0;
for(j=0;j<m;j++)
{
scanf("%d",&a[i][j]);
if(a[i][j]==0)
{
d[i]=maxe(d[i],p);
p=0;
}
else
p=p+1;
}
d[i]=maxe(d[i],p);
}
for(k=0;k<q;k++)
{
scanf("%d%d",&x,&y);
a[x-1][y-1]=1-a[x-1][y-1];
p=0;
d[x-1]=0;
for(j=0;j<m;j++)
{
if(a[x-1][j]==0)
{
d[x-1]=maxe(d[x-1],p);
p=0;
}
else
p=p+1;
}
d[x-1]=maxe(d[x-1],p);
max=find_max(n);
printf("%d\n",max);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23360/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23360/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@d = dso_local local_unnamed_addr global [501 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global [501 x [501 x i32]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @maxe(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%b.a = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %b.a
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @find_max(i32 noundef %n) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @d, align 16, !tbaa !5
%cmp8 = icmp sgt i32 %n, 1
br i1 %cmp8, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%1 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %n, 9
br i1 %min.iters.check, label %for.body.preheader14, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -8
%ind.end = or i64 %n.vec, 1
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %4, %vector.body ]
%vec.phi12 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %5, %vector.body ]
%offset.idx = or i64 %index, 1
%2 = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load13 = load <4 x i32>, ptr %3, align 4, !tbaa !5
%4 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
%5 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load13, <4 x i32> %vec.phi12)
%index.next = add nuw i64 %index, 8
%6 = icmp eq i64 %index.next, %n.vec
br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %4, <4 x i32> %5)
%7 = tail call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader14
for.body.preheader14: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%max.010.ph = phi i32 [ %0, %for.body.preheader ], [ %7, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader14, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader14 ]
%max.010 = phi i32 [ %spec.select, %for.body ], [ %max.010.ph, %for.body.preheader14 ]
%arrayidx = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%spec.select = tail call i32 @llvm.smax.i32(i32 %8, i32 %max.010)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%max.0.lcssa = phi i32 [ %0, %entry ], [ %7, %middle.block ], [ %spec.select, %for.body ]
ret i32 %max.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 nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%q = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp104 = icmp sgt i32 %0, 0
br i1 %cmp104, label %for.cond1.preheader.lr.ph, label %for.cond25.preheader
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %m, align 4, !tbaa !5
%2 = icmp sgt i32 %1, 0
br i1 %2, label %for.cond1.preheader, label %for.cond1.preheader.lr.ph.split.us
for.cond1.preheader.lr.ph.split.us: ; preds = %for.cond1.preheader.lr.ph
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.cond1.preheader.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader.lr.ph.split.us
%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 ]
%3 = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
%wide.load129 = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> zeroinitializer)
%6 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load129, <4 x i32> zeroinitializer)
store <4 x i32> %5, ptr %3, align 16, !tbaa !5
store <4 x i32> %6, ptr %4, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond25.preheader, label %for.cond1.preheader.us.preheader
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph.split.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.lr.ph.split.us ], [ %n.vec, %middle.block ]
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.preheader.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader.us ], [ %indvars.iv.ph, %for.cond1.preheader.us.preheader ]
%arrayidx18.us = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5
%b.a.i98.us = call i32 @llvm.smax.i32(i32 %8, i32 0)
store i32 %b.a.i98.us, ptr %arrayidx18.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond25.preheader, label %for.cond1.preheader.us, !llvm.loop !15
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.end
%9 = phi i32 [ %16, %for.end ], [ %0, %for.cond1.preheader.lr.ph ]
%10 = phi i32 [ %17, %for.end ], [ %1, %for.cond1.preheader.lr.ph ]
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.end ], [ 0, %for.cond1.preheader.lr.ph ]
%cmp2101 = icmp sgt i32 %10, 0
br i1 %cmp2101, label %for.body3.lr.ph, label %for.end
for.body3.lr.ph: ; preds = %for.cond1.preheader
%arrayidx13 = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %indvars.iv117
br label %for.body3
for.cond25.preheader: ; preds = %for.cond1.preheader.us, %for.end, %middle.block, %entry
%11 = load i32, ptr %q, align 4, !tbaa !5
%cmp26110 = icmp sgt i32 %11, 0
br i1 %cmp26110, label %for.body27, label %for.end78
for.body3: ; preds = %for.body3.lr.ph, %for.inc
%indvars.iv114 = phi i64 [ 0, %for.body3.lr.ph ], [ %indvars.iv.next115, %for.inc ]
%p.0103 = phi i32 [ 0, %for.body3.lr.ph ], [ %p.1, %for.inc ]
%arrayidx5 = getelementptr inbounds [501 x [501 x i32]], ptr @a, i64 0, i64 %indvars.iv117, i64 %indvars.iv114
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%12 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp11 = icmp eq i32 %12, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %for.body3
%13 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%b.a.i = call i32 @llvm.smax.i32(i32 %13, i32 %p.0103)
store i32 %b.a.i, ptr %arrayidx13, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body3
%add = add nsw i32 %p.0103, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%p.1 = phi i32 [ 0, %if.then ], [ %add, %if.else ]
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%14 = load i32, ptr %m, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp2 = icmp slt i64 %indvars.iv.next115, %15
br i1 %cmp2, label %for.body3, label %for.end.loopexit, !llvm.loop !16
for.end.loopexit: ; preds = %for.inc
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %for.cond1.preheader
%16 = phi i32 [ %9, %for.cond1.preheader ], [ %.pre, %for.end.loopexit ]
%17 = phi i32 [ %10, %for.cond1.preheader ], [ %14, %for.end.loopexit ]
%p.0.lcssa = phi i32 [ 0, %for.cond1.preheader ], [ %p.1, %for.end.loopexit ]
%arrayidx18 = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %indvars.iv117
%18 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%b.a.i98 = call i32 @llvm.smax.i32(i32 %18, i32 %p.0.lcssa)
store i32 %b.a.i98, ptr %arrayidx18, align 4, !tbaa !5
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%19 = sext i32 %16 to i64
%cmp = icmp slt i64 %indvars.iv.next118, %19
br i1 %cmp, label %for.cond1.preheader, label %for.cond25.preheader, !llvm.loop !17
for.body27: ; preds = %for.cond25.preheader, %find_max.exit
%k.0111 = phi i32 [ %inc77, %find_max.exit ], [ 0, %for.cond25.preheader ]
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x, ptr noundef nonnull %y)
%20 = load i32, ptr %x, align 4, !tbaa !5
%sub = add nsw i32 %20, -1
%idxprom29 = sext i32 %sub to i64
%21 = load i32, ptr %y, align 4, !tbaa !5
%sub31 = add nsw i32 %21, -1
%idxprom32 = sext i32 %sub31 to i64
%arrayidx33 = getelementptr inbounds [501 x [501 x i32]], ptr @a, i64 0, i64 %idxprom29, i64 %idxprom32
%22 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%sub34 = sub nsw i32 1, %22
store i32 %sub34, ptr %arrayidx33, align 4, !tbaa !5
%arrayidx43 = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %idxprom29
%23 = load i32, ptr %m, align 4, !tbaa !5
%cmp45106 = icmp sgt i32 %23, 0
br i1 %cmp45106, label %for.body46.preheader, label %for.end66
for.body46.preheader: ; preds = %for.body27
%wide.trip.count123 = zext i32 %23 to i64
%xtraiter = and i64 %wide.trip.count123, 1
%24 = icmp eq i32 %23, 1
br i1 %24, label %for.end66.loopexit.unr-lcssa, label %for.body46.preheader.new
for.body46.preheader.new: ; preds = %for.body46.preheader
%unroll_iter = and i64 %wide.trip.count123, 4294967294
br label %for.body46
for.body46: ; preds = %for.inc64.1, %for.body46.preheader.new
%25 = phi i32 [ 0, %for.body46.preheader.new ], [ %29, %for.inc64.1 ]
%indvars.iv120 = phi i64 [ 0, %for.body46.preheader.new ], [ %indvars.iv.next121.1, %for.inc64.1 ]
%p.2108 = phi i32 [ 0, %for.body46.preheader.new ], [ %p.3.1, %for.inc64.1 ]
%niter = phi i64 [ 0, %for.body46.preheader.new ], [ %niter.next.1, %for.inc64.1 ]
%arrayidx51 = getelementptr inbounds [501 x [501 x i32]], ptr @a, i64 0, i64 %idxprom29, i64 %indvars.iv120
%26 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%cmp52 = icmp eq i32 %26, 0
br i1 %cmp52, label %if.then53, label %if.else61
if.then53: ; preds = %for.body46
%b.a.i99 = call i32 @llvm.smax.i32(i32 %25, i32 %p.2108)
store i32 %b.a.i99, ptr %arrayidx43, align 4, !tbaa !5
br label %for.inc64
if.else61: ; preds = %for.body46
%add62 = add nsw i32 %p.2108, 1
br label %for.inc64
for.inc64: ; preds = %if.then53, %if.else61
%27 = phi i32 [ %b.a.i99, %if.then53 ], [ %25, %if.else61 ]
%p.3 = phi i32 [ 0, %if.then53 ], [ %add62, %if.else61 ]
%indvars.iv.next121 = or i64 %indvars.iv120, 1
%arrayidx51.1 = getelementptr inbounds [501 x [501 x i32]], ptr @a, i64 0, i64 %idxprom29, i64 %indvars.iv.next121
%28 = load i32, ptr %arrayidx51.1, align 4, !tbaa !5
%cmp52.1 = icmp eq i32 %28, 0
br i1 %cmp52.1, label %if.then53.1, label %if.else61.1
if.else61.1: ; preds = %for.inc64
%add62.1 = add nsw i32 %p.3, 1
br label %for.inc64.1
if.then53.1: ; preds = %for.inc64
%b.a.i99.1 = call i32 @llvm.smax.i32(i32 %27, i32 %p.3)
store i32 %b.a.i99.1, ptr %arrayidx43, align 4, !tbaa !5
br label %for.inc64.1
for.inc64.1: ; preds = %if.then53.1, %if.else61.1
%29 = phi i32 [ %b.a.i99.1, %if.then53.1 ], [ %27, %if.else61.1 ]
%p.3.1 = phi i32 [ 0, %if.then53.1 ], [ %add62.1, %if.else61.1 ]
%indvars.iv.next121.1 = add nuw nsw i64 %indvars.iv120, 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.end66.loopexit.unr-lcssa, label %for.body46, !llvm.loop !19
for.end66.loopexit.unr-lcssa: ; preds = %for.inc64.1, %for.body46.preheader
%.lcssa.ph = phi i32 [ undef, %for.body46.preheader ], [ %29, %for.inc64.1 ]
%p.3.lcssa.ph = phi i32 [ undef, %for.body46.preheader ], [ %p.3.1, %for.inc64.1 ]
%.unr = phi i32 [ 0, %for.body46.preheader ], [ %29, %for.inc64.1 ]
%indvars.iv120.unr = phi i64 [ 0, %for.body46.preheader ], [ %indvars.iv.next121.1, %for.inc64.1 ]
%p.2108.unr = phi i32 [ 0, %for.body46.preheader ], [ %p.3.1, %for.inc64.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end66, label %for.body46.epil
for.body46.epil: ; preds = %for.end66.loopexit.unr-lcssa
%arrayidx51.epil = getelementptr inbounds [501 x [501 x i32]], ptr @a, i64 0, i64 %idxprom29, i64 %indvars.iv120.unr
%30 = load i32, ptr %arrayidx51.epil, align 4, !tbaa !5
%cmp52.epil = icmp eq i32 %30, 0
br i1 %cmp52.epil, label %if.then53.epil, label %if.else61.epil
if.else61.epil: ; preds = %for.body46.epil
%add62.epil = add nsw i32 %p.2108.unr, 1
br label %for.end66
if.then53.epil: ; preds = %for.body46.epil
%b.a.i99.epil = call i32 @llvm.smax.i32(i32 %.unr, i32 %p.2108.unr)
store i32 %b.a.i99.epil, ptr %arrayidx43, align 4, !tbaa !5
br label %for.end66
for.end66: ; preds = %for.end66.loopexit.unr-lcssa, %if.then53.epil, %if.else61.epil, %for.body27
%31 = phi i32 [ 0, %for.body27 ], [ %.lcssa.ph, %for.end66.loopexit.unr-lcssa ], [ %b.a.i99.epil, %if.then53.epil ], [ %.unr, %if.else61.epil ]
%p.2.lcssa = phi i32 [ 0, %for.body27 ], [ %p.3.lcssa.ph, %for.end66.loopexit.unr-lcssa ], [ 0, %if.then53.epil ], [ %add62.epil, %if.else61.epil ]
%b.a.i100 = call i32 @llvm.smax.i32(i32 %31, i32 %p.2.lcssa)
store i32 %b.a.i100, ptr %arrayidx43, align 4, !tbaa !5
%32 = load i32, ptr %n, align 4, !tbaa !5
%33 = load i32, ptr @d, align 16, !tbaa !5
%cmp8.i = icmp sgt i32 %32, 1
br i1 %cmp8.i, label %for.body.preheader.i, label %find_max.exit
for.body.preheader.i: ; preds = %for.end66
%wide.trip.count.i = zext i32 %32 to i64
%34 = add nsw i64 %wide.trip.count.i, -1
%min.iters.check132 = icmp ult i32 %32, 9
br i1 %min.iters.check132, label %for.body.i.preheader, label %vector.ph133
vector.ph133: ; preds = %for.body.preheader.i
%n.vec135 = and i64 %34, -8
%ind.end = or i64 %n.vec135, 1
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %33, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body138
vector.body138: ; preds = %vector.body138, %vector.ph133
%index139 = phi i64 [ 0, %vector.ph133 ], [ %index.next143, %vector.body138 ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph133 ], [ %37, %vector.body138 ]
%vec.phi140 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph133 ], [ %38, %vector.body138 ]
%offset.idx = or i64 %index139, 1
%35 = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %offset.idx
%wide.load141 = load <4 x i32>, ptr %35, align 4, !tbaa !5
%36 = getelementptr inbounds i32, ptr %35, i64 4
%wide.load142 = load <4 x i32>, ptr %36, align 4, !tbaa !5
%37 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load141, <4 x i32> %vec.phi)
%38 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load142, <4 x i32> %vec.phi140)
%index.next143 = add nuw i64 %index139, 8
%39 = icmp eq i64 %index.next143, %n.vec135
br i1 %39, label %middle.block130, label %vector.body138, !llvm.loop !20
middle.block130: ; preds = %vector.body138
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %37, <4 x i32> %38)
%40 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n137 = icmp eq i64 %34, %n.vec135
br i1 %cmp.n137, label %find_max.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block130
%indvars.iv.i.ph = phi i64 [ 1, %for.body.preheader.i ], [ %ind.end, %middle.block130 ]
%max.010.i.ph = phi i32 [ %33, %for.body.preheader.i ], [ %40, %middle.block130 ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%max.010.i = phi i32 [ %spec.select.i, %for.body.i ], [ %max.010.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds [501 x i32], ptr @d, i64 0, i64 %indvars.iv.i
%41 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%spec.select.i = call i32 @llvm.smax.i32(i32 %41, i32 %max.010.i)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %find_max.exit, label %for.body.i, !llvm.loop !21
find_max.exit: ; preds = %for.body.i, %middle.block130, %for.end66
%max.0.lcssa.i = phi i32 [ %33, %for.end66 ], [ %40, %middle.block130 ], [ %spec.select.i, %for.body.i ]
%call75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %max.0.lcssa.i)
%inc77 = add nuw nsw i32 %k.0111, 1
%42 = load i32, ptr %q, align 4, !tbaa !5
%cmp26 = icmp slt i32 %inc77, %42
br i1 %cmp26, label %for.body27, label %for.end78, !llvm.loop !22
for.end78: ; preds = %find_max.exit, %for.cond25.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !10, !12, !11}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
int main()
{
int a[100];
int n,k,i,j;
for(;;){
scanf("%d%d",&n,&k);
if(n==0 && k==0) break;
for(i=0;i<k;i++){
scanf("%d",&a[i]);
}
while(n--){
for(i=0;i<k;i++){
scanf("%d",&j);
a[i] -= j;
}
}
for(i=0;i<k;i++){
if(a[i] < 0) break;
}
if(i==k) printf("Yes\n");
else printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233650/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233650/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100 x i32], align 16
%n = alloca i32, align 4
%k = alloca i32, align 4
%j = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #4
%call53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp54 = icmp eq i32 %0, 0
%1 = load i32, ptr %k, align 4
%cmp155 = icmp eq i32 %1, 0
%or.cond56 = select i1 %cmp54, i1 %cmp155, i1 false
br i1 %or.cond56, label %for.end30, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %if.end29
%2 = phi i32 [ %21, %if.end29 ], [ %0, %entry ]
%3 = phi i32 [ %22, %if.end29 ], [ %1, %entry ]
%cmp341 = icmp sgt i32 %3, 0
br i1 %cmp341, label %for.body, label %while.cond.preheader
while.cond.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.loopexit, %for.cond2.preheader
%4 = phi i32 [ %7, %while.cond.preheader.loopexit ], [ %3, %for.cond2.preheader ]
%5 = phi i32 [ %.pre, %while.cond.preheader.loopexit ], [ %2, %for.cond2.preheader ]
%dec45 = add nsw i32 %5, -1
store i32 %dec45, ptr %n, align 4, !tbaa !5
%tobool.not46 = icmp eq i32 %5, 0
br i1 %tobool.not46, label %for.cond14.preheader, label %for.cond5.preheader.lr.ph
for.cond5.preheader.lr.ph: ; preds = %while.cond.preheader
%6 = icmp sgt i32 %4, 0
br i1 %6, label %for.cond5.preheader, label %for.cond14.preheader.thread
for.cond14.preheader.thread: ; preds = %for.cond5.preheader.lr.ph
store i32 -1, ptr %n, align 4, !tbaa !5
br label %for.end24
for.body: ; preds = %for.cond2.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond2.preheader ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %k, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp3, label %for.body, label %while.cond.preheader.loopexit, !llvm.loop !9
while.cond.loopexit.loopexit: ; preds = %for.body7
%.pre64 = load i32, ptr %n, align 4, !tbaa !5
br label %while.cond.loopexit
while.cond.loopexit: ; preds = %while.cond.loopexit.loopexit, %for.cond5.preheader
%9 = phi i32 [ %.pre64, %while.cond.loopexit.loopexit ], [ %12, %for.cond5.preheader ]
%10 = phi i32 [ %16, %while.cond.loopexit.loopexit ], [ %13, %for.cond5.preheader ]
%dec = add nsw i32 %9, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %9, 0
br i1 %tobool.not, label %for.cond14.preheader, label %for.cond5.preheader, !llvm.loop !11
for.cond14.preheader: ; preds = %while.cond.loopexit, %while.cond.preheader
%11 = phi i32 [ %4, %while.cond.preheader ], [ %10, %while.cond.loopexit ]
%cmp1548 = icmp sgt i32 %11, 0
br i1 %cmp1548, label %for.body16.preheader, label %for.end24
for.body16.preheader: ; preds = %for.cond14.preheader
%wide.trip.count = zext i32 %11 to i64
br label %for.body16
for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %while.cond.loopexit
%12 = phi i32 [ %dec, %while.cond.loopexit ], [ %dec45, %for.cond5.preheader.lr.ph ]
%13 = phi i32 [ %10, %while.cond.loopexit ], [ %4, %for.cond5.preheader.lr.ph ]
%cmp643 = icmp sgt i32 %13, 0
br i1 %cmp643, label %for.body7, label %while.cond.loopexit
for.body7: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.body7 ], [ 0, %for.cond5.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %j)
%14 = load i32, ptr %j, align 4, !tbaa !5
%arrayidx10 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv58
%15 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%sub = sub nsw i32 %15, %14
store i32 %sub, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%16 = load i32, ptr %k, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp6 = icmp slt i64 %indvars.iv.next59, %17
br i1 %cmp6, label %for.body7, label %while.cond.loopexit.loopexit, !llvm.loop !13
for.body16: ; preds = %for.body16.preheader, %for.inc22
%indvars.iv61 = phi i64 [ 0, %for.body16.preheader ], [ %indvars.iv.next62, %for.inc22 ]
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv61
%18 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%cmp19 = icmp slt i32 %18, 0
br i1 %cmp19, label %for.end24.loopexit, label %for.inc22
for.inc22: ; preds = %for.body16
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count
br i1 %exitcond.not, label %if.end29, label %for.body16, !llvm.loop !14
for.end24.loopexit: ; preds = %for.body16
%19 = trunc i64 %indvars.iv61 to i32
br label %for.end24
for.end24: ; preds = %for.end24.loopexit, %for.cond14.preheader.thread, %for.cond14.preheader
%20 = phi i32 [ %11, %for.cond14.preheader ], [ %4, %for.cond14.preheader.thread ], [ %11, %for.end24.loopexit ]
%i.2.lcssa = phi i32 [ 0, %for.cond14.preheader ], [ 0, %for.cond14.preheader.thread ], [ %19, %for.end24.loopexit ]
%cmp25 = icmp eq i32 %i.2.lcssa, %20
%spec.select = select i1 %cmp25, ptr @str.4, ptr @str
br label %if.end29
if.end29: ; preds = %for.inc22, %for.end24
%str.sink = phi ptr [ %spec.select, %for.end24 ], [ @str.4, %for.inc22 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%21 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %21, 0
%22 = load i32, ptr %k, align 4
%cmp1 = icmp eq i32 %22, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end30, label %for.cond2.preheader
for.end30: ; preds = %if.end29, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<string.h>
int main()
{
int N, M, cmp, i, j, key = 0;
char U[ 260 ][ 15 ], T[ 260 ][ 15 ];
scanf( "%d", &N );
for( i = 0; i < N; i++ ){
scanf( "%s", &U[ i ] );
}
scanf( "%d", &M );
for( i = 0; i < M; i++ ){
scanf( "%s", &T[ i ] );
for( j = 0; j < N; j++ ){
cmp = strcmp( U[ j ], T[ i ] );
if( cmp == 0 ){
if( key == 0 ){
printf("Opened by %s\n", U[ j ] );
key = 1;
}
else{
printf( "Closed by %s\n", U[ j ] );
key = 0;
}
break;
}
if( j == N -1 ) printf( "Unknown %s\n", T[ i ] );
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233700/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233700/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [14 x i8] c"Opened by %s\0A\00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"Closed by %s\0A\00", align 1
@.str.4 = private unnamed_addr constant [12 x i8] c"Unknown %s\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
%U = alloca [260 x [15 x i8]], align 16
%T = alloca [260 x [15 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.start.p0(i64 3900, ptr nonnull %U) #4
call void @llvm.lifetime.start.p0(i64 3900, ptr nonnull %T) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp156 = icmp sgt i32 %0, 0
br i1 %cmp156, 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 [260 x [15 x i8]], ptr %U, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M)
%3 = load i32, ptr %M, align 4, !tbaa !5
%cmp560 = icmp sgt i32 %3, 0
br i1 %cmp560, label %for.body6, label %for.end43
for.body6: ; preds = %for.end, %for.inc41
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %for.inc41 ], [ 0, %for.end ]
%key.062 = phi i32 [ %key.1, %for.inc41 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds [260 x [15 x i8]], ptr %T, i64 0, i64 %indvars.iv68
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8)
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp1158 = icmp sgt i32 %4, 0
br i1 %cmp1158, label %for.body12, label %for.inc41
for.body12: ; preds = %for.body6, %for.inc38
%5 = phi i32 [ %7, %for.inc38 ], [ %4, %for.body6 ]
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.inc38 ], [ 0, %for.body6 ]
%arrayidx14 = getelementptr inbounds [260 x [15 x i8]], ptr %U, i64 0, i64 %indvars.iv65
%call18 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx14, ptr noundef nonnull dereferenceable(1) %arrayidx8) #5
%cmp19 = icmp eq i32 %call18, 0
br i1 %cmp19, label %if.then, label %if.end30
if.then: ; preds = %for.body12
%cmp20 = icmp eq i32 %key.062, 0
%.str.2..str.3 = select i1 %cmp20, ptr @.str.2, ptr @.str.3
%. = zext i1 %cmp20 to i32
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3, ptr noundef nonnull %arrayidx14)
br label %for.inc41
if.end30: ; preds = %for.body12
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp31 = icmp eq i64 %indvars.iv65, %6
br i1 %cmp31, label %if.then32, label %for.inc38
if.then32: ; preds = %if.end30
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %arrayidx8)
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc38
for.inc38: ; preds = %if.end30, %if.then32
%7 = phi i32 [ %5, %if.end30 ], [ %.pre, %if.then32 ]
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%8 = sext i32 %7 to i64
%cmp11 = icmp slt i64 %indvars.iv.next66, %8
br i1 %cmp11, label %for.body12, label %for.inc41, !llvm.loop !11
for.inc41: ; preds = %for.inc38, %if.then, %for.body6
%key.1 = phi i32 [ %key.062, %for.body6 ], [ %., %if.then ], [ %key.062, %for.inc38 ]
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%9 = load i32, ptr %M, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp5 = icmp slt i64 %indvars.iv.next69, %10
br i1 %cmp5, label %for.body6, label %for.end43, !llvm.loop !12
for.end43: ; preds = %for.inc41, %for.end
call void @llvm.lifetime.end.p0(i64 3900, ptr nonnull %T) #4
call void @llvm.lifetime.end.p0(i64 3900, ptr nonnull %U) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, 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 = !{!"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)
{
char str[6];
scanf("%s",str);
str[4] = '\0';
if(str[0] == str[1] || str[1] == str[2]|| str[2] ==str[3])
{
printf("Bad\n");
}
else
printf("Good\n");
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233744/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233744/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [5 x i8] c"Good\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Bad\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [6 x i8], align 1
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%arrayidx = getelementptr inbounds [6 x i8], ptr %str, i64 0, i64 4
store i8 0, ptr %arrayidx, align 1, !tbaa !5
%0 = load i8, ptr %str, align 1, !tbaa !5
%arrayidx2 = getelementptr inbounds [6 x i8], ptr %str, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%arrayidx7 = getelementptr inbounds [6 x i8], ptr %str, i64 0, i64 2
%2 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %1, %2
%arrayidx14 = getelementptr inbounds [6 x i8], ptr %str, i64 0, i64 3
%3 = load i8, ptr %arrayidx14, align 1
%cmp16 = icmp eq i8 %2, %3
%or.cond = select i1 %cmp9, i1 true, i1 %cmp16
%spec.select = select i1 %or.cond, ptr @str.3, ptr @str
br label %if.end
if.end: ; preds = %lor.lhs.false, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ %spec.select, %lor.lhs.false ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 <stdlib.h>
int main(){
char key[5];
fgets(key,5,stdin);
int i,j;
char f = 1;
for(i = 0; i <= 3;i++){
if(key[i] == key[i+1]){
f = 0;
}
}
if(f){
printf("Good\n");
}else{
printf("Bad\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233788/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233788/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [4 x i8] c"Bad\00", align 1
@str.2 = private unnamed_addr constant [5 x i8] c"Good\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%key = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %key) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %key, i32 noundef 5, ptr noundef %0)
%1 = load i8, ptr %key, align 1, !tbaa !9
%arrayidx2 = getelementptr inbounds [5 x i8], ptr %key, i64 0, i64 1
%2 = load i8, ptr %arrayidx2, align 1, !tbaa !9
%cmp4 = icmp eq i8 %1, %2
%arrayidx2.1 = getelementptr inbounds [5 x i8], ptr %key, i64 0, i64 2
%3 = load i8, ptr %arrayidx2.1, align 1, !tbaa !9
%cmp4.1 = icmp eq i8 %2, %3
%arrayidx2.2 = getelementptr inbounds [5 x i8], ptr %key, i64 0, i64 3
%4 = load i8, ptr %arrayidx2.2, align 1, !tbaa !9
%cmp4.2 = icmp eq i8 %3, %4
%arrayidx2.3 = getelementptr inbounds [5 x i8], ptr %key, i64 0, i64 4
%5 = load i8, ptr %arrayidx2.3, align 1, !tbaa !9
%cmp4.3 = icmp eq i8 %4, %5
%.not = select i1 %cmp4.3, i1 true, i1 %cmp4.2
%6 = select i1 %.not, i1 true, i1 %cmp4.1
%narrow = select i1 %6, i1 true, i1 %cmp4
%str.str.2 = select i1 %narrow, ptr @str, ptr @str.2
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.2)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %key) #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 ptr @fgets(ptr noundef, i32 noundef, 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}
|
#include<stdio.h>
int main()
{
int i,c=0;
char s[5];
scanf("%s",s);
for(i=0;i<3;i++)
if(s[i]==s[i+1])
c++;
if(c)
printf("Bad\n");
else
printf("Good\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233838/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233838/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [5 x i8] c"Good\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Bad\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%arrayidx2 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4 = icmp eq i8 %0, %1
%inc = zext i1 %cmp4 to i32
%arrayidx2.1 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx2.1, align 1, !tbaa !5
%cmp4.1 = icmp eq i8 %1, %2
%inc.1 = zext i1 %cmp4.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx2.2 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx2.2, align 1, !tbaa !5
%cmp4.2 = icmp eq i8 %2, %3
%inc.2.neg = sext i1 %cmp4.2 to i32
%tobool.not = icmp eq i32 %spec.select.1, %inc.2.neg
%str.str.3 = select i1 %tobool.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
char chr[4] = {0};
int success = 1;
scanf("%s", chr);
for (int i=0; i<3; i++) {
if (chr[i] == chr[i+1]) {
success = 0;
}
}
if (success == 0) {
printf("%s", "Bad");
} else {
printf("%s", "Good");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233924/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233924/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Bad\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Good\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%chr = alloca [4 x i8], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %chr) #3
store i32 0, ptr %chr, align 4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %chr)
%0 = load i8, ptr %chr, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [4 x i8], ptr %chr, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4 = icmp eq i8 %0, %1
%arrayidx2.1 = getelementptr inbounds [4 x i8], ptr %chr, i64 0, i64 2
%2 = load i8, ptr %arrayidx2.1, align 2, !tbaa !5
%cmp4.1 = icmp eq i8 %1, %2
%arrayidx2.2 = getelementptr inbounds [4 x i8], ptr %chr, i64 0, i64 3
%3 = load i8, ptr %arrayidx2.2, align 1, !tbaa !5
%cmp4.2 = icmp eq i8 %2, %3
%.not = select i1 %cmp4.2, i1 true, i1 %cmp4.1
%narrow18 = select i1 %.not, i1 true, i1 %cmp4
%.str.1..str.2 = select i1 %narrow18, ptr @.str.1, ptr @.str.2
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %chr) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
/* ex4-4
takayanagi.y.aa
Yuta Takayanagi */
#include<stdio.h>
int main(void){
int number, bit1, bit2, i;
scanf( "%d" , &number);
bit1 = number % 10;
number = (number - bit1) / 10;
for(i=0; i < 3; i++){
bit2 = number % 10;
number = (number - bit2) / 10;
if(bit1==bit2){
printf( "Bad\n" );
return 0;
}
bit1 = bit2;
}
printf( "Good\n" );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_233975/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_233975/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [5 x i8] c"Good\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Bad\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%number = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%0 = load i32, ptr %number, align 4, !tbaa !5
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%rem1 = srem i32 %div, 10
%div3 = sdiv i32 %0, 100
%cmp4 = icmp eq i32 %rem, %rem1
br i1 %cmp4, label %if.then, label %for.cond
for.cond: ; preds = %entry
%rem1.1 = srem i32 %div3, 10
%div3.1 = sdiv i32 %0, 1000
%cmp4.1 = icmp eq i32 %rem1, %rem1.1
br i1 %cmp4.1, label %if.then, label %for.cond.1
for.cond.1: ; preds = %for.cond
%rem1.2 = srem i32 %div3.1, 10
%div3.2 = sdiv i32 %0, 10000
%cmp4.2 = icmp eq i32 %rem1.1, %rem1.2
br i1 %cmp4.2, label %if.then, label %cleanup
if.then: ; preds = %for.cond.1, %for.cond, %entry
%div3.lcssa = phi i32 [ %div3, %entry ], [ %div3.1, %for.cond ], [ %div3.2, %for.cond.1 ]
br label %cleanup
cleanup: ; preds = %for.cond.1, %if.then
%storemerge = phi i32 [ %div3.lcssa, %if.then ], [ %div3.2, %for.cond.1 ]
%str.sink = phi ptr [ @str.3, %if.then ], [ @str, %for.cond.1 ]
store i32 %storemerge, ptr %number, align 4, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %number) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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(){
char a[5];
scanf(" %s", a);
if(a[0] == a[1] || a[1] == a[2] || a[2] == a[3]){
puts("Bad");
} else {
puts("Good");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_234017/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_234017/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c" %s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Bad\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Good\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i8, ptr %a, align 1, !tbaa !5
%arrayidx1 = getelementptr inbounds [5 x i8], ptr %a, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%arrayidx6 = getelementptr inbounds [5 x i8], ptr %a, i64 0, i64 2
%2 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, %2
%arrayidx13 = getelementptr inbounds [5 x i8], ptr %a, i64 0, i64 3
%3 = load i8, ptr %arrayidx13, align 1
%cmp15 = icmp eq i8 %2, %3
%or.cond = select i1 %cmp8, i1 true, i1 %cmp15
%spec.select = select i1 %or.cond, ptr @.str.1, ptr @.str.2
br label %if.end
if.end: ; preds = %lor.lhs.false, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ %spec.select, %lor.lhs.false ]
%call18 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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(void) {
int S;
scanf("%d",&S);
if(S%10==(S%100-S%10)/10)
printf("Bad");
else if((S%100-S%10)/10==(S%1000-S%100)/100)
printf("Bad");
else if((S%1000-S%100)/100==(S-S%1000)/1000)
printf("Bad");
else
printf("Good");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_234060/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_234060/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Bad\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Good\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i32, ptr %S, align 4, !tbaa !5
%rem = srem i32 %0, 10
%rem1 = srem i32 %0, 100
%sub = sub nsw i32 %rem1, %rem
%div.lhs.trunc = trunc i32 %sub to i8
%div30 = sdiv i8 %div.lhs.trunc, 10
%div.sext = sext i8 %div30 to i32
%cmp = icmp eq i32 %rem, %div.sext
br i1 %cmp, label %if.end29, label %if.else
if.else: ; preds = %entry
%rem8 = srem i32 %0, 1000
%div22 = sdiv i32 %0, 1000
%sub10 = sub nsw i32 %rem8, %rem1
%div11.lhs.trunc = trunc i32 %sub10 to i16
%div1131 = sdiv i16 %div11.lhs.trunc, 100
%div11.sext = sext i16 %div1131 to i32
%cmp12 = icmp eq i32 %div.sext, %div11.sext
br i1 %cmp12, label %if.end29, label %if.else15
if.else15: ; preds = %if.else
%cmp23 = icmp eq i32 %div22, %div11.sext
%.str.1..str.2 = select i1 %cmp23, ptr @.str.1, ptr @.str.2
br label %if.end29
if.end29: ; preds = %if.else15, %if.else, %entry
%.str.1.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %if.else ], [ %.str.1..str.2, %if.else15 ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
// return *(int*)a - *(int*)b;
return *(long long*)a - *(long long*)b;
}
// qsort(A, b, sizeof(int), compare_int);
long long factorial(long long n) {
if (n > 0) {
return n * factorial(n - 1);
} else {
return 1;
}
}
int main()
{
// int a ,b, c, d, e, X, Y;
long long a, b, c, d, e, X, Y;
// double c;
// int A[200003]={};
long long A[100003]={};
// long long B[100003]={};
int C[100003][11]={};
int flag[1003]={};
// long long a, b, c, d, X, Y;
char s[101][101]={};
char t[101]={};
// int N, M;
// int A[1000000001]={};
// long long C[101]={};
int i,j,k;
long long p,q;
// int flag=0;
// int tmp=0;
char tmp[101]={};
long long min=10000000000;
// long long min=100000001;
int len=0;
int l=0;
int r=1000001;
int cnt=1;
int num=1;
int num1=0;
int num2=0;
long long ans=1;
int max=0;
int addr=0;
int ptn=0;
// bool on_off[100]={};
// char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
// a=0;
// scanf("%lld %lld", &a, &b);
// scanf("%d%d", &a,&c);
// cnt = strlen(t);
// printf("%d\n",a);
for(i=0;i<4;i++){
scanf("%c", &t[i]);
if(t[i-1]==t[i]){
printf("Bad\n");
return 0;
}
}
printf("Good\n");
// printf("%s %d %d\n", s[i],C[i][0],C[i][1]);
// printf("%d\n", C[i][1]);
/* for(i=0;i<addr;i++){
// scanf("%lld%lld", &B[0][i],&B[1][i]);
// ans=ans+A[i];
printf("%lld ", A[i]);
}
*/
// printf("%d ", cnt);
// ans=a*3;
// ans=(ans+b)/2;
// printf("%d\n", ans);
// printf("%lf\n",ans);
// // if(flag==0) printf("TLE\n");
// if(max < cnt - max) printf("Yes\n");
// else printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_234110/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_234110/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [5 x i8] c"Good\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Bad\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) 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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @factorial(i64 noundef %n) local_unnamed_addr #1 {
entry:
%cmp3 = icmp sgt i64 %n, 0
br i1 %cmp3, label %if.then.preheader, label %return
if.then.preheader: ; preds = %entry
%xtraiter = and i64 %n, 7
%0 = icmp ult i64 %n, 8
br i1 %0, label %return.loopexit.unr-lcssa, label %if.then.preheader.new
if.then.preheader.new: ; preds = %if.then.preheader
%unroll_iter = and i64 %n, -8
br label %if.then
if.then: ; preds = %if.then, %if.then.preheader.new
%n.tr5 = phi i64 [ %n, %if.then.preheader.new ], [ %sub.7, %if.then ]
%accumulator.tr4 = phi i64 [ 1, %if.then.preheader.new ], [ %mul.7, %if.then ]
%niter = phi i64 [ 0, %if.then.preheader.new ], [ %niter.next.7, %if.then ]
%sub = add nsw i64 %n.tr5, -1
%mul = mul nsw i64 %n.tr5, %accumulator.tr4
%sub.1 = add nsw i64 %n.tr5, -2
%mul.1 = mul nsw i64 %sub, %mul
%sub.2 = add nsw i64 %n.tr5, -3
%mul.2 = mul nsw i64 %sub.1, %mul.1
%sub.3 = add nsw i64 %n.tr5, -4
%mul.3 = mul nsw i64 %sub.2, %mul.2
%sub.4 = add nsw i64 %n.tr5, -5
%mul.4 = mul nsw i64 %sub.3, %mul.3
%sub.5 = add nsw i64 %n.tr5, -6
%mul.5 = mul nsw i64 %sub.4, %mul.4
%sub.6 = add nsw i64 %n.tr5, -7
%mul.6 = mul nsw i64 %sub.5, %mul.5
%sub.7 = add nsw i64 %n.tr5, -8
%mul.7 = mul nsw i64 %sub.6, %mul.6
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7.not = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7.not, label %return.loopexit.unr-lcssa, label %if.then
return.loopexit.unr-lcssa: ; preds = %if.then, %if.then.preheader
%mul.lcssa.ph = phi i64 [ undef, %if.then.preheader ], [ %mul.7, %if.then ]
%n.tr5.unr = phi i64 [ %n, %if.then.preheader ], [ %sub.7, %if.then ]
%accumulator.tr4.unr = phi i64 [ 1, %if.then.preheader ], [ %mul.7, %if.then ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %return, label %if.then.epil
if.then.epil: ; preds = %return.loopexit.unr-lcssa, %if.then.epil
%n.tr5.epil = phi i64 [ %sub.epil, %if.then.epil ], [ %n.tr5.unr, %return.loopexit.unr-lcssa ]
%accumulator.tr4.epil = phi i64 [ %mul.epil, %if.then.epil ], [ %accumulator.tr4.unr, %return.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %if.then.epil ], [ 0, %return.loopexit.unr-lcssa ]
%sub.epil = add nsw i64 %n.tr5.epil, -1
%mul.epil = mul nsw i64 %n.tr5.epil, %accumulator.tr4.epil
%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 %return, label %if.then.epil, !llvm.loop !9
return: ; preds = %return.loopexit.unr-lcssa, %if.then.epil, %entry
%accumulator.tr.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %return.loopexit.unr-lcssa ], [ %mul.epil, %if.then.epil ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%t = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %t) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(101) %t, i8 0, i64 101, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%arrayidx2 = getelementptr inbounds [101 x i8], ptr %t, i64 0, i64 -1
%0 = load i8, ptr %arrayidx2, align 1, !tbaa !11
%1 = load i8, ptr %t, align 16, !tbaa !11
%cmp6 = icmp eq i8 %0, %1
br i1 %cmp6, label %if.then, label %for.cond
for.cond: ; preds = %entry
%arrayidx.1 = getelementptr inbounds [101 x i8], ptr %t, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%2 = load i8, ptr %t, align 16, !tbaa !11
%3 = load i8, ptr %arrayidx.1, align 1, !tbaa !11
%cmp6.1 = icmp eq i8 %2, %3
br i1 %cmp6.1, label %if.then, label %for.cond.1
for.cond.1: ; preds = %for.cond
%arrayidx.2 = getelementptr inbounds [101 x i8], ptr %t, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !11
%5 = load i8, ptr %arrayidx.2, align 2, !tbaa !11
%cmp6.2 = icmp eq i8 %4, %5
br i1 %cmp6.2, label %if.then, label %for.cond.2
for.cond.2: ; preds = %for.cond.1
%arrayidx.3 = getelementptr inbounds [101 x i8], ptr %t, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%6 = load i8, ptr %arrayidx.2, align 2, !tbaa !11
%7 = load i8, ptr %arrayidx.3, align 1, !tbaa !11
%cmp6.3 = icmp eq i8 %6, %7
br i1 %cmp6.3, label %if.then, label %cleanup
if.then: ; preds = %for.cond.2, %for.cond.1, %for.cond, %entry
br label %cleanup
cleanup: ; preds = %for.cond.2, %if.then
%str.sink = phi ptr [ @str.3, %if.then ], [ @str, %for.cond.2 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %t) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = !{!7, !7, i64 0}
|
#include<stdio.h>
int main(){
char s[5];
scanf("%s",s);
if(s[0]==s[1]){
puts("Bad");
}else if(s[1]==s[2]){
puts("Bad");
}else if(s[2]==s[3]){
puts("Bad");
}else puts("Good");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_234161/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_234161/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Bad\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Good\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%arrayidx1 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %if.end25, label %if.else
if.else: ; preds = %entry
%arrayidx7 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %1, %2
br i1 %cmp9, label %if.end25, label %if.else13
if.else13: ; preds = %if.else
%arrayidx16 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx16, align 1, !tbaa !5
%cmp18 = icmp eq i8 %2, %3
%.str.1..str.2 = select i1 %cmp18, ptr @.str.1, ptr @.str.2
br label %if.end25
if.end25: ; preds = %if.else13, %if.else, %entry
%.str.1.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %if.else ], [ %.str.1..str.2, %if.else13 ]
%call12 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @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"}
|
/*
submission # - User: herp_sy
https://atcoder.jp/contests/
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007
int main(int argc, char const *argv[])
{
TLong x;
TLong t = 1;
scanf("%lld",&x);
while(t * (t + 1) / 2 < x) ++t;
printf("%lld\n", t);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_234211/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_234211/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i64, ptr %x, align 8, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%t.0 = phi i64 [ 1, %entry ], [ %add, %while.cond ]
%add = add nuw nsw i64 %t.0, 1
%mul = mul nsw i64 %add, %t.0
%div5 = lshr i64 %mul, 1
%cmp = icmp slt i64 %div5, %0
br i1 %cmp, label %while.cond, label %while.end, !llvm.loop !9
while.end: ; preds = %while.cond
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %t.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.