Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main()
{
int d,l,a,b;
scanf("%d %d",&d,&l);
a=d/l;
b=d%l;
printf("%d\n",a+b);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283576/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283576/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%d = alloca i32, align 4
%l = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d, ptr noundef nonnull %l)
%0 = load i32, ptr %d, align 4, !tbaa !5
%1 = load i32, ptr %l, align 4, !tbaa !5
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%add = add nsw i32 %rem, %div
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int *fG[100000];
int *bG[100000];
int label[100000], mcnts[100000] = {0}, mpos[100000] = {0}, kcnts[100000] = {0},
kpos[100000] = {0}, a[100000] = {0}, b[100000] = {0},
c[100000] = {0}, d[100000] = {0};
int nextL = 1;
void dfs(int node, int l) {
if (label[node] != 0)
return;
int i = 0;
label[node] = l;
while (fG[node][i] != -1) {
dfs(fG[node][i], l);
i++;
}
if (nextL == l)
nextL++;
return;
}
int main() {
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
for (int i = 0; i < m; i++) {
scanf("%d%d", &a[i], &b[i]);
a[i]--;
b[i]--;
mcnts[a[i]]++;
mcnts[b[i]]++;
}
for (int i = 0; i < n; i++) {
fG[i] = malloc(sizeof(int) * (mcnts[i] + 1));
if (fG[i] == NULL) {
return -1;
}
}
for (int i = 0; i < m; i++) {
fG[a[i]][mpos[a[i]]] = b[i];
mpos[a[i]]++;
fG[b[i]][mpos[b[i]]] = a[i];
mpos[b[i]]++;
}
for (int i = 0; i < n; i++) {
fG[i][mpos[i]] = -1;
}
for (int i = 0; i < k; i++) {
scanf("%d%d", &c[i], &d[i]);
c[i]--;
d[i]--;
kcnts[c[i]]++;
kcnts[d[i]]++;
}
for (int i = 0; i < n; i++) {
bG[i] = malloc(sizeof(int) * (kcnts[i] + 1));
if (bG[i] == NULL) {
return -1;
}
}
for (int i = 0; i < k; i++) {
bG[c[i]][kpos[c[i]]] = d[i];
kpos[c[i]]++;
bG[d[i]][kpos[d[i]]] = c[i];
kpos[d[i]]++;
}
for (int i = 0; i < n; i++) {
bG[i][kpos[i]] = -1;
}
for (int i = 0; i < n; i++) {
dfs(i, nextL);
}
int labelCnt[100000] = {0};
for (int i = 0; i < n; i++) {
// printf("%d ", label[i]);
labelCnt[label[i] - 1]++;
}
// printf("\n");
for (int i = 0; i < n; i++) {
int ans, fCnt = 0, fbCnt = 0, bCnt = 0;
while (fG[i][fCnt] != -1)
fCnt++;
while (bG[i][bCnt] != -1) {
if (label[bG[i][bCnt]] == label[i])
fbCnt++;
bCnt++;
}
// printf("l:%d f:%d b:%d ", labelCnt[label[i] - 1], fCnt, fbCnt);
ans = labelCnt[label[i] - 1] - fCnt - fbCnt - 1;
printf("%d ", ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283619/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283619/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@mcnts = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@mpos = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@kcnts = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@kpos = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@a = dso_local global [100000 x i32] zeroinitializer, align 16
@b = dso_local global [100000 x i32] zeroinitializer, align 16
@c = dso_local global [100000 x i32] zeroinitializer, align 16
@d = dso_local global [100000 x i32] zeroinitializer, align 16
@nextL = dso_local local_unnamed_addr global i32 1, align 4
@label = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@fG = dso_local local_unnamed_addr global [100000 x ptr] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@bG = dso_local local_unnamed_addr global [100000 x ptr] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @dfs(i32 noundef %node, i32 noundef %l) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %node to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @label, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, 0
br i1 %cmp.not, label %if.end, label %return
if.end: ; preds = %entry
store i32 %l, ptr %arrayidx, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds [100000 x ptr], ptr @fG, i64 0, i64 %idxprom
%1 = load ptr, ptr %arrayidx4, align 8, !tbaa !9
%2 = load i32, ptr %1, align 4, !tbaa !5
%cmp7.not24 = icmp eq i32 %2, -1
br i1 %cmp7.not24, label %while.end, label %while.body
while.body: ; preds = %if.end, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %if.end ]
%3 = phi i32 [ %5, %while.body ], [ %2, %if.end ]
tail call void @dfs(i32 noundef %3, i32 noundef %l)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%4 = load ptr, ptr %arrayidx4, align 8, !tbaa !9
%arrayidx6 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv.next
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7.not = icmp eq i32 %5, -1
br i1 %cmp7.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %if.end
%6 = load i32, ptr @nextL, align 4, !tbaa !5
%cmp12 = icmp eq i32 %6, %l
br i1 %cmp12, label %if.then13, label %return
if.then13: ; preds = %while.end
%inc14 = add nsw i32 %l, 1
store i32 %inc14, ptr @nextL, align 4, !tbaa !5
br label %return
return: ; preds = %while.end, %if.then13, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%k = alloca i32, align 4
%labelCnt = alloca [100000 x i32], align 16
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 %k) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %k)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp356 = icmp sgt i32 %0, 0
br i1 %cmp356, label %for.body, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %7, %for.body ]
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp21.not358 = icmp sgt i32 %2, 0
br i1 %cmp21.not358, label %for.body23.preheader, label %for.cond37.preheader
for.body23.preheader: ; preds = %for.cond20.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.body23
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100000 x i32], ptr @b, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %arrayidx, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%dec8 = add nsw i32 %4, -1
store i32 %dec8, ptr %arrayidx2, align 4, !tbaa !5
%idxprom11 = sext i32 %dec to i64
%arrayidx12 = getelementptr inbounds [100000 x i32], ptr @mcnts, i64 0, i64 %idxprom11
%5 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%inc = add nsw i32 %5, 1
store i32 %inc, ptr %arrayidx12, align 4, !tbaa !5
%idxprom15 = sext i32 %dec8 to i64
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr @mcnts, i64 0, i64 %idxprom15
%6 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%inc17 = add nsw i32 %6, 1
store i32 %inc17, ptr %arrayidx16, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %m, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond20.preheader, !llvm.loop !13
for.cond20: ; preds = %for.body23
%indvars.iv.next386 = add nuw nsw i64 %indvars.iv385, 1
%exitcond.not = icmp eq i64 %indvars.iv.next386, %wide.trip.count
br i1 %exitcond.not, label %for.cond37.preheader, label %for.body23, !llvm.loop !14
for.cond37.preheader: ; preds = %for.cond20, %for.cond20.preheader
%cmp38360 = icmp sgt i32 %1, 0
br i1 %cmp38360, label %for.body41, label %for.cond81.preheader
for.body23: ; preds = %for.body23.preheader, %for.cond20
%indvars.iv385 = phi i64 [ 0, %for.body23.preheader ], [ %indvars.iv.next386, %for.cond20 ]
%arrayidx25 = getelementptr inbounds [100000 x i32], ptr @mcnts, i64 0, i64 %indvars.iv385
%9 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%add = add nsw i32 %9, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call26 = call noalias ptr @malloc(i64 noundef %mul) #7
%arrayidx28 = getelementptr inbounds [100000 x ptr], ptr @fG, i64 0, i64 %indvars.iv385
store ptr %call26, ptr %arrayidx28, align 8, !tbaa !9
%cmp31 = icmp eq ptr %call26, null
br i1 %cmp31, label %cleanup287, label %for.cond20
for.cond81.preheader.loopexit: ; preds = %for.body41
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond81.preheader
for.cond81.preheader: ; preds = %for.cond81.preheader.loopexit, %for.cond37.preheader
%10 = phi i32 [ %.pre, %for.cond81.preheader.loopexit ], [ %2, %for.cond37.preheader ]
%cmp82362 = icmp sgt i32 %10, 0
br i1 %cmp82362, label %for.body85, label %for.cond97.preheader
for.body41: ; preds = %for.cond37.preheader, %for.body41
%indvars.iv388 = phi i64 [ %indvars.iv.next389, %for.body41 ], [ 0, %for.cond37.preheader ]
%arrayidx43 = getelementptr inbounds [100000 x i32], ptr @b, i64 0, i64 %indvars.iv388
%11 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%arrayidx45 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %indvars.iv388
%12 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%idxprom46 = sext i32 %12 to i64
%arrayidx47 = getelementptr inbounds [100000 x ptr], ptr @fG, i64 0, i64 %idxprom46
%13 = load ptr, ptr %arrayidx47, align 8, !tbaa !9
%arrayidx51 = getelementptr inbounds [100000 x i32], ptr @mpos, i64 0, i64 %idxprom46
%14 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%idxprom52 = sext i32 %14 to i64
%arrayidx53 = getelementptr inbounds i32, ptr %13, i64 %idxprom52
store i32 %11, ptr %arrayidx53, align 4, !tbaa !5
%15 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%idxprom56 = sext i32 %15 to i64
%arrayidx57 = getelementptr inbounds [100000 x i32], ptr @mpos, i64 0, i64 %idxprom56
%16 = load i32, ptr %arrayidx57, align 4, !tbaa !5
%inc58 = add nsw i32 %16, 1
store i32 %inc58, ptr %arrayidx57, align 4, !tbaa !5
%17 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%idxprom63 = sext i32 %17 to i64
%arrayidx64 = getelementptr inbounds [100000 x ptr], ptr @fG, i64 0, i64 %idxprom63
%18 = load ptr, ptr %arrayidx64, align 8, !tbaa !9
%arrayidx68 = getelementptr inbounds [100000 x i32], ptr @mpos, i64 0, i64 %idxprom63
%19 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%idxprom69 = sext i32 %19 to i64
%arrayidx70 = getelementptr inbounds i32, ptr %18, i64 %idxprom69
store i32 %15, ptr %arrayidx70, align 4, !tbaa !5
%20 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%idxprom73 = sext i32 %20 to i64
%arrayidx74 = getelementptr inbounds [100000 x i32], ptr @mpos, i64 0, i64 %idxprom73
%21 = load i32, ptr %arrayidx74, align 4, !tbaa !5
%inc75 = add nsw i32 %21, 1
store i32 %inc75, ptr %arrayidx74, align 4, !tbaa !5
%indvars.iv.next389 = add nuw nsw i64 %indvars.iv388, 1
%22 = load i32, ptr %m, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp38 = icmp slt i64 %indvars.iv.next389, %23
br i1 %cmp38, label %for.body41, label %for.cond81.preheader.loopexit, !llvm.loop !15
for.cond97.preheader: ; preds = %for.body85, %for.cond81.preheader
%24 = phi i32 [ %10, %for.cond81.preheader ], [ %28, %for.body85 ]
%25 = load i32, ptr %k, align 4, !tbaa !5
%cmp98364 = icmp sgt i32 %25, 0
br i1 %cmp98364, label %for.body101, label %for.cond128.preheader
for.body85: ; preds = %for.cond81.preheader, %for.body85
%indvars.iv391 = phi i64 [ %indvars.iv.next392, %for.body85 ], [ 0, %for.cond81.preheader ]
%arrayidx87 = getelementptr inbounds [100000 x ptr], ptr @fG, i64 0, i64 %indvars.iv391
%26 = load ptr, ptr %arrayidx87, align 8, !tbaa !9
%arrayidx89 = getelementptr inbounds [100000 x i32], ptr @mpos, i64 0, i64 %indvars.iv391
%27 = load i32, ptr %arrayidx89, align 4, !tbaa !5
%idxprom90 = sext i32 %27 to i64
%arrayidx91 = getelementptr inbounds i32, ptr %26, i64 %idxprom90
store i32 -1, ptr %arrayidx91, align 4, !tbaa !5
%indvars.iv.next392 = add nuw nsw i64 %indvars.iv391, 1
%28 = load i32, ptr %n, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp82 = icmp slt i64 %indvars.iv.next392, %29
br i1 %cmp82, label %for.body85, label %for.cond97.preheader, !llvm.loop !16
for.cond128.preheader.loopexit: ; preds = %for.body101
%.pre422 = load i32, ptr %n, align 4, !tbaa !5
%30 = icmp sgt i32 %36, 0
br label %for.cond128.preheader
for.cond128.preheader: ; preds = %for.cond128.preheader.loopexit, %for.cond97.preheader
%cmp154368 = phi i1 [ %30, %for.cond128.preheader.loopexit ], [ false, %for.cond97.preheader ]
%31 = phi i32 [ %.pre422, %for.cond128.preheader.loopexit ], [ %24, %for.cond97.preheader ]
%cmp129.not366 = icmp sgt i32 %31, 0
br i1 %cmp129.not366, label %for.body132.preheader, label %for.cond153.preheader
for.body132.preheader: ; preds = %for.cond128.preheader
%wide.trip.count400 = zext i32 %31 to i64
br label %for.body132
for.body101: ; preds = %for.cond97.preheader, %for.body101
%indvars.iv394 = phi i64 [ %indvars.iv.next395, %for.body101 ], [ 0, %for.cond97.preheader ]
%arrayidx103 = getelementptr inbounds [100000 x i32], ptr @c, i64 0, i64 %indvars.iv394
%arrayidx105 = getelementptr inbounds [100000 x i32], ptr @d, i64 0, i64 %indvars.iv394
%call106 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx103, ptr noundef nonnull %arrayidx105)
%32 = load i32, ptr %arrayidx103, align 4, !tbaa !5
%dec109 = add nsw i32 %32, -1
store i32 %dec109, ptr %arrayidx103, align 4, !tbaa !5
%33 = load i32, ptr %arrayidx105, align 4, !tbaa !5
%dec112 = add nsw i32 %33, -1
store i32 %dec112, ptr %arrayidx105, align 4, !tbaa !5
%idxprom115 = sext i32 %dec109 to i64
%arrayidx116 = getelementptr inbounds [100000 x i32], ptr @kcnts, i64 0, i64 %idxprom115
%34 = load i32, ptr %arrayidx116, align 4, !tbaa !5
%inc117 = add nsw i32 %34, 1
store i32 %inc117, ptr %arrayidx116, align 4, !tbaa !5
%idxprom120 = sext i32 %dec112 to i64
%arrayidx121 = getelementptr inbounds [100000 x i32], ptr @kcnts, i64 0, i64 %idxprom120
%35 = load i32, ptr %arrayidx121, align 4, !tbaa !5
%inc122 = add nsw i32 %35, 1
store i32 %inc122, ptr %arrayidx121, align 4, !tbaa !5
%indvars.iv.next395 = add nuw nsw i64 %indvars.iv394, 1
%36 = load i32, ptr %k, align 4, !tbaa !5
%37 = sext i32 %36 to i64
%cmp98 = icmp slt i64 %indvars.iv.next395, %37
br i1 %cmp98, label %for.body101, label %for.cond128.preheader.loopexit, !llvm.loop !17
for.cond128: ; preds = %for.body132
%indvars.iv.next398 = add nuw nsw i64 %indvars.iv397, 1
%exitcond401.not = icmp eq i64 %indvars.iv.next398, %wide.trip.count400
br i1 %exitcond401.not, label %for.cond153.preheader, label %for.body132, !llvm.loop !18
for.cond153.preheader: ; preds = %for.cond128, %for.cond128.preheader
br i1 %cmp154368, label %for.body157, label %for.cond197.preheader
for.body132: ; preds = %for.body132.preheader, %for.cond128
%indvars.iv397 = phi i64 [ 0, %for.body132.preheader ], [ %indvars.iv.next398, %for.cond128 ]
%arrayidx134 = getelementptr inbounds [100000 x i32], ptr @kcnts, i64 0, i64 %indvars.iv397
%38 = load i32, ptr %arrayidx134, align 4, !tbaa !5
%add135 = add nsw i32 %38, 1
%conv136 = sext i32 %add135 to i64
%mul137 = shl nsw i64 %conv136, 2
%call138 = call noalias ptr @malloc(i64 noundef %mul137) #7
%arrayidx140 = getelementptr inbounds [100000 x ptr], ptr @bG, i64 0, i64 %indvars.iv397
store ptr %call138, ptr %arrayidx140, align 8, !tbaa !9
%cmp143 = icmp eq ptr %call138, null
br i1 %cmp143, label %cleanup287, label %for.cond128
for.cond197.preheader.loopexit: ; preds = %for.body157
%.pre423 = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond197.preheader
for.cond197.preheader: ; preds = %for.cond197.preheader.loopexit, %for.cond153.preheader
%39 = phi i32 [ %.pre423, %for.cond197.preheader.loopexit ], [ %31, %for.cond153.preheader ]
%cmp198370 = icmp sgt i32 %39, 0
br i1 %cmp198370, label %for.body201, label %for.cond.cleanup216.thread
for.body157: ; preds = %for.cond153.preheader, %for.body157
%indvars.iv402 = phi i64 [ %indvars.iv.next403, %for.body157 ], [ 0, %for.cond153.preheader ]
%arrayidx159 = getelementptr inbounds [100000 x i32], ptr @d, i64 0, i64 %indvars.iv402
%40 = load i32, ptr %arrayidx159, align 4, !tbaa !5
%arrayidx161 = getelementptr inbounds [100000 x i32], ptr @c, i64 0, i64 %indvars.iv402
%41 = load i32, ptr %arrayidx161, align 4, !tbaa !5
%idxprom162 = sext i32 %41 to i64
%arrayidx163 = getelementptr inbounds [100000 x ptr], ptr @bG, i64 0, i64 %idxprom162
%42 = load ptr, ptr %arrayidx163, align 8, !tbaa !9
%arrayidx167 = getelementptr inbounds [100000 x i32], ptr @kpos, i64 0, i64 %idxprom162
%43 = load i32, ptr %arrayidx167, align 4, !tbaa !5
%idxprom168 = sext i32 %43 to i64
%arrayidx169 = getelementptr inbounds i32, ptr %42, i64 %idxprom168
store i32 %40, ptr %arrayidx169, align 4, !tbaa !5
%44 = load i32, ptr %arrayidx161, align 4, !tbaa !5
%idxprom172 = sext i32 %44 to i64
%arrayidx173 = getelementptr inbounds [100000 x i32], ptr @kpos, i64 0, i64 %idxprom172
%45 = load i32, ptr %arrayidx173, align 4, !tbaa !5
%inc174 = add nsw i32 %45, 1
store i32 %inc174, ptr %arrayidx173, align 4, !tbaa !5
%46 = load i32, ptr %arrayidx159, align 4, !tbaa !5
%idxprom179 = sext i32 %46 to i64
%arrayidx180 = getelementptr inbounds [100000 x ptr], ptr @bG, i64 0, i64 %idxprom179
%47 = load ptr, ptr %arrayidx180, align 8, !tbaa !9
%arrayidx184 = getelementptr inbounds [100000 x i32], ptr @kpos, i64 0, i64 %idxprom179
%48 = load i32, ptr %arrayidx184, align 4, !tbaa !5
%idxprom185 = sext i32 %48 to i64
%arrayidx186 = getelementptr inbounds i32, ptr %47, i64 %idxprom185
store i32 %44, ptr %arrayidx186, align 4, !tbaa !5
%49 = load i32, ptr %arrayidx159, align 4, !tbaa !5
%idxprom189 = sext i32 %49 to i64
%arrayidx190 = getelementptr inbounds [100000 x i32], ptr @kpos, i64 0, i64 %idxprom189
%50 = load i32, ptr %arrayidx190, align 4, !tbaa !5
%inc191 = add nsw i32 %50, 1
store i32 %inc191, ptr %arrayidx190, align 4, !tbaa !5
%indvars.iv.next403 = add nuw nsw i64 %indvars.iv402, 1
%51 = load i32, ptr %k, align 4, !tbaa !5
%52 = sext i32 %51 to i64
%cmp154 = icmp slt i64 %indvars.iv.next403, %52
br i1 %cmp154, label %for.body157, label %for.cond197.preheader.loopexit, !llvm.loop !19
for.cond213.preheader: ; preds = %for.body201
%cmp214372 = icmp sgt i32 %55, 0
br i1 %cmp214372, label %for.body217, label %for.cond.cleanup216.thread
for.body201: ; preds = %for.cond197.preheader, %for.body201
%indvars.iv405 = phi i64 [ %indvars.iv.next406, %for.body201 ], [ 0, %for.cond197.preheader ]
%arrayidx203 = getelementptr inbounds [100000 x ptr], ptr @bG, i64 0, i64 %indvars.iv405
%53 = load ptr, ptr %arrayidx203, align 8, !tbaa !9
%arrayidx205 = getelementptr inbounds [100000 x i32], ptr @kpos, i64 0, i64 %indvars.iv405
%54 = load i32, ptr %arrayidx205, align 4, !tbaa !5
%idxprom206 = sext i32 %54 to i64
%arrayidx207 = getelementptr inbounds i32, ptr %53, i64 %idxprom206
store i32 -1, ptr %arrayidx207, align 4, !tbaa !5
%indvars.iv.next406 = add nuw nsw i64 %indvars.iv405, 1
%55 = load i32, ptr %n, align 4, !tbaa !5
%56 = sext i32 %55 to i64
%cmp198 = icmp slt i64 %indvars.iv.next406, %56
br i1 %cmp198, label %for.body201, label %for.cond213.preheader, !llvm.loop !20
for.cond.cleanup216.thread: ; preds = %for.cond213.preheader, %for.cond197.preheader
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %labelCnt) #6
br label %for.cond.cleanup241
for.cond.cleanup216: ; preds = %for.body217
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %labelCnt) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %labelCnt, i8 0, i64 400000, i1 false)
%cmp224374 = icmp sgt i32 %59, 0
br i1 %cmp224374, label %for.body227.preheader, label %for.cond.cleanup241
for.body227.preheader: ; preds = %for.cond.cleanup216
%wide.trip.count411 = zext i32 %59 to i64
%xtraiter = and i64 %wide.trip.count411, 1
%57 = icmp eq i32 %59, 1
br i1 %57, label %for.cond238.preheader.unr-lcssa, label %for.body227.preheader.new
for.body227.preheader.new: ; preds = %for.body227.preheader
%unroll_iter = and i64 %wide.trip.count411, 4294967294
br label %for.body227
for.body217: ; preds = %for.cond213.preheader, %for.body217
%i212.0373 = phi i32 [ %inc219, %for.body217 ], [ 0, %for.cond213.preheader ]
%58 = load i32, ptr @nextL, align 4, !tbaa !5
call void @dfs(i32 noundef %i212.0373, i32 noundef %58)
%inc219 = add nuw nsw i32 %i212.0373, 1
%59 = load i32, ptr %n, align 4, !tbaa !5
%cmp214 = icmp slt i32 %inc219, %59
br i1 %cmp214, label %for.body217, label %for.cond.cleanup216, !llvm.loop !21
for.cond238.preheader.unr-lcssa: ; preds = %for.body227, %for.body227.preheader
%indvars.iv408.unr = phi i64 [ 0, %for.body227.preheader ], [ %indvars.iv.next409.1, %for.body227 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond238.preheader, label %for.body227.epil
for.body227.epil: ; preds = %for.cond238.preheader.unr-lcssa
%arrayidx229.epil = getelementptr inbounds [100000 x i32], ptr @label, i64 0, i64 %indvars.iv408.unr
%60 = load i32, ptr %arrayidx229.epil, align 4, !tbaa !5
%sub.epil = add nsw i32 %60, -1
%idxprom230.epil = sext i32 %sub.epil to i64
%arrayidx231.epil = getelementptr inbounds [100000 x i32], ptr %labelCnt, i64 0, i64 %idxprom230.epil
%61 = load i32, ptr %arrayidx231.epil, align 4, !tbaa !5
%inc232.epil = add nsw i32 %61, 1
store i32 %inc232.epil, ptr %arrayidx231.epil, align 4, !tbaa !5
br label %for.cond238.preheader
for.cond238.preheader: ; preds = %for.cond238.preheader.unr-lcssa, %for.body227.epil
br i1 %cmp224374, label %while.cond.preheader, label %for.cond.cleanup241
for.body227: ; preds = %for.body227, %for.body227.preheader.new
%indvars.iv408 = phi i64 [ 0, %for.body227.preheader.new ], [ %indvars.iv.next409.1, %for.body227 ]
%niter = phi i64 [ 0, %for.body227.preheader.new ], [ %niter.next.1, %for.body227 ]
%arrayidx229 = getelementptr inbounds [100000 x i32], ptr @label, i64 0, i64 %indvars.iv408
%62 = load i32, ptr %arrayidx229, align 8, !tbaa !5
%sub = add nsw i32 %62, -1
%idxprom230 = sext i32 %sub to i64
%arrayidx231 = getelementptr inbounds [100000 x i32], ptr %labelCnt, i64 0, i64 %idxprom230
%63 = load i32, ptr %arrayidx231, align 4, !tbaa !5
%inc232 = add nsw i32 %63, 1
store i32 %inc232, ptr %arrayidx231, align 4, !tbaa !5
%indvars.iv.next409 = or i64 %indvars.iv408, 1
%arrayidx229.1 = getelementptr inbounds [100000 x i32], ptr @label, i64 0, i64 %indvars.iv.next409
%64 = load i32, ptr %arrayidx229.1, align 4, !tbaa !5
%sub.1 = add nsw i32 %64, -1
%idxprom230.1 = sext i32 %sub.1 to i64
%arrayidx231.1 = getelementptr inbounds [100000 x i32], ptr %labelCnt, i64 0, i64 %idxprom230.1
%65 = load i32, ptr %arrayidx231.1, align 4, !tbaa !5
%inc232.1 = add nsw i32 %65, 1
store i32 %inc232.1, ptr %arrayidx231.1, align 4, !tbaa !5
%indvars.iv.next409.1 = add nuw nsw i64 %indvars.iv408, 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.cond238.preheader.unr-lcssa, label %for.body227, !llvm.loop !22
while.cond.preheader: ; preds = %for.cond238.preheader, %while.end272
%indvars.iv419 = phi i64 [ %indvars.iv.next420, %while.end272 ], [ 0, %for.cond238.preheader ]
%arrayidx244 = getelementptr inbounds [100000 x ptr], ptr @fG, i64 0, i64 %indvars.iv419
%66 = load ptr, ptr %arrayidx244, align 8, !tbaa !9
br label %while.cond
for.cond.cleanup241: ; preds = %while.end272, %for.cond.cleanup216, %for.cond.cleanup216.thread, %for.cond238.preheader
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %labelCnt) #6
br label %cleanup287
while.cond: ; preds = %while.cond, %while.cond.preheader
%indvars.iv413 = phi i64 [ %indvars.iv.next414, %while.cond ], [ 0, %while.cond.preheader ]
%arrayidx246 = getelementptr inbounds i32, ptr %66, i64 %indvars.iv413
%67 = load i32, ptr %arrayidx246, align 4, !tbaa !5
%cmp247.not = icmp eq i32 %67, -1
%indvars.iv.next414 = add nuw i64 %indvars.iv413, 1
br i1 %cmp247.not, label %while.cond250.preheader, label %while.cond, !llvm.loop !23
while.cond250.preheader: ; preds = %while.cond
%68 = trunc i64 %indvars.iv413 to i32
%arrayidx252 = getelementptr inbounds [100000 x ptr], ptr @bG, i64 0, i64 %indvars.iv419
%69 = load ptr, ptr %arrayidx252, align 8, !tbaa !9
%70 = load i32, ptr %69, align 4, !tbaa !5
%cmp255.not376 = icmp eq i32 %70, -1
%arrayidx274.phi.trans.insert = getelementptr inbounds [100000 x i32], ptr @label, i64 0, i64 %indvars.iv419
%.pre424 = load i32, ptr %arrayidx274.phi.trans.insert, align 4, !tbaa !5
br i1 %cmp255.not376, label %while.end272, label %while.body257
while.body257: ; preds = %while.cond250.preheader, %while.body257
%indvars.iv416 = phi i64 [ %indvars.iv.next417, %while.body257 ], [ 0, %while.cond250.preheader ]
%71 = phi i32 [ %73, %while.body257 ], [ %70, %while.cond250.preheader ]
%fbCnt.0377 = phi i32 [ %spec.select, %while.body257 ], [ 0, %while.cond250.preheader ]
%idxprom262 = sext i32 %71 to i64
%arrayidx263 = getelementptr inbounds [100000 x i32], ptr @label, i64 0, i64 %idxprom262
%72 = load i32, ptr %arrayidx263, align 4, !tbaa !5
%cmp266 = icmp eq i32 %72, %.pre424
%inc269 = zext i1 %cmp266 to i32
%spec.select = add nuw nsw i32 %fbCnt.0377, %inc269
%indvars.iv.next417 = add nuw nsw i64 %indvars.iv416, 1
%arrayidx254 = getelementptr inbounds i32, ptr %69, i64 %indvars.iv.next417
%73 = load i32, ptr %arrayidx254, align 4, !tbaa !5
%cmp255.not = icmp eq i32 %73, -1
br i1 %cmp255.not, label %while.end272, label %while.body257, !llvm.loop !24
while.end272: ; preds = %while.body257, %while.cond250.preheader
%fbCnt.0.lcssa = phi i32 [ 0, %while.cond250.preheader ], [ %spec.select, %while.body257 ]
%sub275 = add nsw i32 %.pre424, -1
%idxprom276 = sext i32 %sub275 to i64
%arrayidx277 = getelementptr inbounds [100000 x i32], ptr %labelCnt, i64 0, i64 %idxprom276
%74 = load i32, ptr %arrayidx277, align 4, !tbaa !5
%75 = add nuw i32 %fbCnt.0.lcssa, %68
%76 = xor i32 %75, -1
%sub280 = add i32 %74, %76
%call281 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub280)
%indvars.iv.next420 = add nuw nsw i64 %indvars.iv419, 1
%77 = load i32, ptr %n, align 4, !tbaa !5
%78 = sext i32 %77 to i64
%cmp239 = icmp slt i64 %indvars.iv.next420, %78
br i1 %cmp239, label %while.cond.preheader, label %for.cond.cleanup241, !llvm.loop !25
cleanup287: ; preds = %for.body23, %for.body132, %for.cond.cleanup241
%retval.2 = phi i32 [ 0, %for.cond.cleanup241 ], [ -1, %for.body132 ], [ -1, %for.body23 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 %retval.2
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: 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 #3
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!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}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int t,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{
int n,a,b,c,d,x,y,l,u;
scanf("%d",&n);
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
x=n*(a-b);
y=n*(a+b);
l=c-d;
u=c+d;
if((x>u))
{
printf("NO\n");
}
else if(y<l)
{
printf("NO\n");
}
else
printf("YES\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28367/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28367/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%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 %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end16
%i.021 = phi i32 [ %inc, %if.end16 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %2, %3
%mul = mul nsw i32 %sub, %1
%4 = load i32, ptr %c, align 4, !tbaa !5
%5 = load i32, ptr %d, align 4, !tbaa !5
%add8 = add nsw i32 %5, %4
%cmp9 = icmp sgt i32 %mul, %add8
br i1 %cmp9, label %if.end16, label %if.else
if.else: ; preds = %for.body
%sub7 = sub nsw i32 %4, %5
%add = add nsw i32 %3, %2
%mul6 = mul nsw i32 %add, %1
%cmp11 = icmp slt i32 %mul6, %sub7
%str.3.str = select i1 %cmp11, ptr @str.4, ptr @str
br label %if.end16
if.end16: ; preds = %if.else, %for.body
%str.3.sink = phi ptr [ @str.4, %for.body ], [ %str.3.str, %if.else ]
%puts18 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
%inc = add nuw nsw i32 %i.021, 1
%6 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end16, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
/*以下便利なマクロを定義する。*/
#define rep(i, min, max) for(i=min; i<=max; i=i+1)
#define if_forall(i, min, max, prop)\
\
rep(i, min, max)\
{\
if(!(prop))\
{\
break;\
}\
}\
\
if(i==max+1)\
#define if_exists(i, min, max, prop)\
\
rep(i, min, max)\
{\
if(prop)\
{\
break;\
}\
}\
\
if(i<max+1)\
/*以下便利な関数を定義する。*/
void ini_int(int array[], int num)
{
int i=0;
for(i=0; i<=num; i=i+1)
{
array[i]=0;
}
}
void ini_char(char array[], int num)
{
int i=0;
for(i=0; i<=num; i=i+1)
{
array[i]='\0';
}
}
int max_int(int var1, int var2)
{
int answer=var1;
if(answer<var2)
{
answer=var2;
}
return answer;
}
int min_int(int var1, int var2)
{
int answer=var1;
if(answer>var2)
{
answer=var2;
}
return answer;
}
long long int pow_int(int base, unsigned int exponent)
{
long long int answer=1;
answer=(int)pow((double)base, (double)exponent);
return answer;
}
long long int pow_int_mod(int base, unsigned int exponent, int mod)
{
long long int answer=1;
while (exponent>0)
{
if (exponent&1)
{
answer=(answer*(base%mod))%mod;
if(answer==0)
{
break;
}
}
base=(base*base)%mod;
exponent=exponent>>1;
}
return answer;
}
unsigned long long int factorial(unsigned int num)
{
unsigned int i=0;
unsigned long long int answer=1;
rep(i, 2, num)
{
answer=answer*i;
}
return answer;
}
unsigned long long int factorial_mod(unsigned int num, int mod)
{
unsigned int i=0;
unsigned long long int answer=1;
rep(i, 2, num)
{
answer=(answer*(i%mod))%mod;
if(answer==0)
{
break;
}
}
return answer;
}
unsigned long long int combination(unsigned int n, unsigned int k)
{
unsigned int i;
unsigned long int numerator=1;
unsigned long int denominator=1;
k=min_int(k, n-k);
rep(i, 1, k)
{
numerator=numerator*(n+1-i);
denominator=denominator*i;
}
return numerator/denominator;
}
double combination_general(double alpha, unsigned int k)
{
unsigned int i;
double numerator=1;
unsigned long int denominator=1;
rep(i, 1, k)
{
numerator=numerator*(alpha+1-i);
denominator=denominator*i;
}
return numerator/denominator;
}
int convert_adic_int(char num[], unsigned int p_adic, unsigned int q_adic)
{
int i=0;
int answer=0;
bool sgn=0;
long int tmp=strtol(num, NULL, p_adic);
if(tmp<0)
{
sgn=1;
tmp=-tmp;
}
while(tmp>0)
{
answer=answer+(tmp%q_adic)*pow_int(10, i);
tmp=tmp/q_adic;
i=i+1;
}
if(sgn==0)
{
return answer;
}
else
{
return -answer;
}
}
void convert_adic_char(char num[], unsigned int p_adic, unsigned int q_adic)
{
int i=0;
int mod[32]={0};
bool sgn=0;
int digit=0;
long int tmp=strtol(num, NULL, p_adic);
if(tmp<0)
{
sgn=1;
tmp=-tmp;
}
while(tmp>0)
{
mod[i]=tmp%q_adic;
digit=i;
tmp=tmp/q_adic;
i=i+1;
}
ini_char(num, strlen(num)-1);
if(sgn==1)
{
num[0]='-';
}
rep(i, 0, digit)
{
if(mod[i]<10)
{
num[sgn+digit-i]='0'+mod[i];
}
else if(mod[i]<q_adic)
{
num[sgn+digit-i]='a'+(mod[i]-10);
}
}
}
int count_mod(int min, int max, int num)
{
if(min>0)
{
return max/num-(min-1)/num;
}
else if(min==0)
{
return max/num+1;
}
else
{
return -1;
}
}
void swap_int(int* x, int* y)
{
int tmp;
tmp = *x;
*x = *y;
*y = tmp;
}
void swap_int_array(int x[], int y[], int min, int max)
{
int i;
rep(i, min, max)
{
swap_int(&x[i], &y[i]);
}
}
void swap_char(char* x, char* y)
{
char tmp;
tmp = *x;
*x = *y;
*y = tmp;
}
void swap_char_array(char x[], char y[], int min, int max)
{
int i;
rep(i, min, max)
{
swap_char(&x[i], &y[i]);
}
}
void reverse_char(char array[], int min, int max)
{
int i;
rep(i, min, (min+max)/2)
{
swap_char(&array[i], &array[min+max-i]);
}
}
void shift_char(char array[], int min, int max, int num)
{
int i;
for(i=max; i>=min; i=i-1)
{
array[i+num]=array[i];
}
rep(i, min, min+num-1)
{
array[i]='\0';
}
}
void convert_char(char array[], int min, int max, char pre, char post)
{
int i=min;
rep(i, min, max)
{
if(array[i]==pre)
{
array[i]=post;
}
}
}
void sort_asc_int(int array[], int min, int max)
{
int i, j;
rep(i, min, max)
{
rep(j, i+1, max)
{
if(array[i]>array[j])
{
swap_int(&array[i], &array[j]);
}
}
}
}
void sort_des_int(int array[], int min, int max)
{
int i, j;
rep(i, min, max)
{
rep(j, i+1, max)
{
if(array[i]<array[j])
{
swap_int(&array[i], &array[j]);
}
}
}
}
void sort_asc_char_dic(int size, char array[][size], int min, int max)
{
int i, j;
rep(i, min, max)
{
rep(j, i+1, max)
{
if(strcmp(array[i], array[j])>0)
{
swap_char_array(array[i], array[j], 0, size-1);
}
}
}
}
void sort_des_char_dic(int size, char array[][size], int min, int max)
{
int i, j;
rep(i, min, max)
{
rep(j, i+1, max)
{
if(strcmp(array[i], array[j])<0)
{
swap_char_array(array[i], array[j], 0, size-1);
}
}
}
}
int max_int_array(int array[], int min, int max)
{
int i;
int answer;
answer=array[min];
for(i=min+1; i<=max; i=i+1)
{
answer=max_int(answer, array[i]);
}
return answer;
}
int min_int_array(int array[], int min, int max)
{
int i;
int answer;
answer=array[min];
for(i=min+1; i<=max; i=i+1)
{
answer=min_int(answer, array[i]);
}
return answer;
}
int max_char_dic(int size, char array[][size], int min, int max)
{
int i;
int answer=min;
rep(i, min+1, max)
{
if(strcmp(array[answer], array[i])<0)
{
answer=i;
}
}
return answer;
}
int min_char_dic(int size, char array[][size], int min, int max)
{
int i;
int answer=min;
rep(i, min+1, max)
{
if(strcmp(array[answer], array[i])>0)
{
answer=i;
}
}
return answer;
}
int sum_array(int array[], int min, int max)
{
int i=min;
int answer=0;
rep(i, min, max)
{
answer=answer+array[i];
}
return answer;
}
bool detect_int(int array[], int min, int max, int element)
{
int i;
bool answer=0;
if_exists(i, min, max, array[i]==element)
{
answer=1;
}
return answer;
}
bool detect_char(char array[], int min, int max, char element[], int start, int goal)
{
int i, j;
bool answer=0;
if(goal-start<=max-min)
{
for(i=min; i<=max-(goal-start); i=i+1)
{
if_forall(j, start, goal, array[i+j-start]==element[j])
{
answer=1;
break;
}
}
}
return answer;
}
int count_differentelement_int(int array[], int min, int max)
{
int i=min;
int pickup[max];
ini_int(pickup, max);
int answer=0;
rep(i, min, max)
{
if(detect_int(pickup, 0, answer-1, array[i])==0)
{
pickup[answer]=array[i];
answer=answer+1;
}
}
return answer;
}
int count_equalelement_int(int array[], int min, int max, int element)
{
int i;
int answer=0;
rep(i, min, max)
{
if(array[i]==element)
{
answer=answer+1;
}
}
return answer;
}
int count_equalelement_char(char array[], int min, int max, char element)
{
int i;
int answer=0;
rep(i, min, max)
{
if(array[i]==element)
{
answer=answer+1;
}
}
return answer;
}
void scanf_int_array(int array[], int min, int max)
{
int i;
rep(i, min, max)
{
scanf("%d", &array[i]);
}
}
void scanf_int_array_2(int array1[], int array2[], int min, int max)
{
int i;
rep(i, min, max)
{
scanf("%d %d", &array1[i], &array2[i]);
}
}
void scanf_int_array_3(int array1[], int array2[], int array3[], int min, int max)
{
int i;
rep(i, min, max)
{
scanf("%d %d %d", &array1[i], &array2[i], &array3[i]);
}
}
void scanf_char_array(char array[], int num)
{
scanf("%s", array);
shift_char(array, 0, strlen(array)-1, num);
}
void printf_char_array(char array[], int min, int max)
{
int i;
for(i=min; i<=max; i=i+1)
{
printf("%c", array[i]);
}
}
int main()
{
int W, a, b;
scanf("%d %d %d", &W, &a, &b);
if(a+W<b)
{
printf("%d\n", b-(a+W));
}
else if(b+W<a)
{
printf("%d\n", a-(b+W));
}
else
{
printf("0\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283712/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283712/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.5 = 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: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @ini_int(ptr nocapture noundef writeonly %array, i32 noundef %num) local_unnamed_addr #0 {
entry:
%cmp.not3 = icmp slt i32 %num, 0
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = add nuw i32 %num, 1
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %array, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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(argmem: write) uwtable
define dso_local void @ini_char(ptr nocapture noundef writeonly %array, i32 noundef %num) local_unnamed_addr #0 {
entry:
%cmp.not3 = icmp slt i32 %num, 0
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = add nuw i32 %num, 1
%1 = zext i32 %0 to i64
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %array, i8 0, i64 %1, i1 false), !tbaa !9
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max_int(i32 noundef %var1, i32 noundef %var2) local_unnamed_addr #2 {
entry:
%spec.select = tail call i32 @llvm.smax.i32(i32 %var1, i32 %var2)
ret i32 %spec.select
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min_int(i32 noundef %var1, i32 noundef %var2) local_unnamed_addr #2 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %var1, i32 %var2)
ret i32 %spec.select
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local i64 @pow_int(i32 noundef %base, i32 noundef %exponent) local_unnamed_addr #3 {
entry:
%conv = sitofp i32 %base to double
%conv1 = uitofp i32 %exponent to double
%call = tail call double @pow(double noundef %conv, double noundef %conv1) #22
%conv2 = fptosi double %call to i32
%conv3 = sext i32 %conv2 to i64
ret i64 %conv3
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @pow_int_mod(i32 noundef %base, i32 noundef %exponent, i32 noundef %mod) local_unnamed_addr #5 {
entry:
%cmp.not17 = icmp eq i32 %exponent, 0
br i1 %cmp.not17, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%conv1 = sext i32 %mod to i64
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end6
%answer.020 = phi i64 [ 1, %while.body.lr.ph ], [ %answer.1, %if.end6 ]
%base.addr.019 = phi i32 [ %base, %while.body.lr.ph ], [ %rem8, %if.end6 ]
%exponent.addr.018 = phi i32 [ %exponent, %while.body.lr.ph ], [ %shr, %if.end6 ]
%and = and i32 %exponent.addr.018, 1
%tobool.not = icmp eq i32 %and, 0
br i1 %tobool.not, label %if.end6, label %if.then
if.then: ; preds = %while.body
%rem = srem i32 %base.addr.019, %mod
%conv = sext i32 %rem to i64
%mul = mul nsw i64 %answer.020, %conv
%rem2 = srem i64 %mul, %conv1
%cmp3 = icmp eq i64 %rem2, 0
br i1 %cmp3, label %while.end, label %if.end6
if.end6: ; preds = %if.then, %while.body
%answer.1 = phi i64 [ %rem2, %if.then ], [ %answer.020, %while.body ]
%mul7 = mul nsw i32 %base.addr.019, %base.addr.019
%rem8 = srem i32 %mul7, %mod
%shr = lshr i32 %exponent.addr.018, 1
%cmp.not = icmp ult i32 %exponent.addr.018, 2
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end6, %if.then, %entry
%answer.2 = phi i64 [ 1, %entry ], [ 0, %if.then ], [ %answer.1, %if.end6 ]
ret i64 %answer.2
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @factorial(i32 noundef %num) local_unnamed_addr #6 {
entry:
%cmp.not4 = icmp ult i32 %num, 2
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = add i32 %num, 1
%umax = tail call i32 @llvm.umax.i32(i32 %0, i32 3)
%wide.trip.count = zext i32 %umax to i64
%1 = add nsw i64 %wide.trip.count, -2
%2 = add nsw i64 %wide.trip.count, -3
%xtraiter = and i64 %1, 7
%3 = icmp ult i64 %2, 7
br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %1, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.7, %for.body ]
%answer.06 = 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 i64 %answer.06, %indvars.iv
%indvars.iv.next = or i64 %indvars.iv, 1
%mul.1 = mul i64 %mul, %indvars.iv.next
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%mul.2 = mul i64 %mul.1, %indvars.iv.next.1
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%mul.3 = mul i64 %mul.2, %indvars.iv.next.2
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%mul.4 = mul i64 %mul.3, %indvars.iv.next.3
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
%mul.5 = mul i64 %mul.4, %indvars.iv.next.4
%indvars.iv.next.5 = add nuw nsw i64 %indvars.iv, 6
%mul.6 = mul i64 %mul.5, %indvars.iv.next.5
%indvars.iv.next.6 = add nuw nsw i64 %indvars.iv, 7
%mul.7 = mul i64 %mul.6, %indvars.iv.next.6
%indvars.iv.next.7 = add nuw nsw i64 %indvars.iv, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !12
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.7, %for.body ]
%answer.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ]
%answer.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %answer.06.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul i64 %answer.06.epil, %indvars.iv.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !13
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%answer.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %answer.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @factorial_mod(i32 noundef %num, i32 noundef %mod) local_unnamed_addr #5 {
entry:
%cmp.not10 = icmp ult i32 %num, 2
br i1 %cmp.not10, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%conv1 = sext i32 %mod to i64
br label %for.body
for.cond: ; preds = %for.body
%add = add i32 %i.011, 1
%cmp.not = icmp ugt i32 %add, %num
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !15
for.body: ; preds = %for.body.lr.ph, %for.cond
%answer.012 = phi i64 [ 1, %for.body.lr.ph ], [ %rem2, %for.cond ]
%i.011 = phi i32 [ 2, %for.body.lr.ph ], [ %add, %for.cond ]
%rem = urem i32 %i.011, %mod
%conv = zext i32 %rem to i64
%mul = mul i64 %answer.012, %conv
%rem2 = urem i64 %mul, %conv1
%cmp3 = icmp eq i64 %rem2, 0
br i1 %cmp3, label %for.end, label %for.cond
for.end: ; preds = %for.cond, %for.body, %entry
%answer.1 = phi i64 [ 1, %entry ], [ 0, %for.body ], [ %rem2, %for.cond ]
ret i64 %answer.1
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @combination(i32 noundef %n, i32 noundef %k) local_unnamed_addr #6 {
entry:
%sub = sub i32 %n, %k
%spec.select.i = tail call i32 @llvm.smin.i32(i32 %k, i32 %sub)
%cmp.not13 = icmp eq i32 %spec.select.i, 0
br i1 %cmp.not13, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add i32 %n, 1
%0 = add i32 %spec.select.i, 1
%umax = tail call i32 @llvm.umax.i32(i32 %0, i32 2)
%wide.trip.count = zext i32 %umax to i64
%1 = add nsw i64 %wide.trip.count, -1
%2 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %1, 3
%3 = icmp ult i64 %2, 3
br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %1, -4
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%indvars.iv = phi i64 [ 1, %for.body.lr.ph.new ], [ %indvars.iv.next.3, %for.body ]
%denominator.016 = phi i64 [ 1, %for.body.lr.ph.new ], [ %mul3.3, %for.body ]
%numerator.015 = phi i64 [ 1, %for.body.lr.ph.new ], [ %mul.3, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%4 = trunc i64 %indvars.iv to i32
%sub1 = sub i32 %add, %4
%conv = zext i32 %sub1 to i64
%mul = mul i64 %numerator.015, %conv
%mul3 = mul i64 %denominator.016, %indvars.iv
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = trunc i64 %indvars.iv.next to i32
%sub1.1 = sub i32 %add, %5
%conv.1 = zext i32 %sub1.1 to i64
%mul.1 = mul i64 %mul, %conv.1
%mul3.1 = mul i64 %mul3, %indvars.iv.next
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%6 = trunc i64 %indvars.iv.next.1 to i32
%sub1.2 = sub i32 %add, %6
%conv.2 = zext i32 %sub1.2 to i64
%mul.2 = mul i64 %mul.1, %conv.2
%mul3.2 = mul i64 %mul3.1, %indvars.iv.next.1
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%7 = trunc i64 %indvars.iv.next.2 to i32
%sub1.3 = sub i32 %add, %7
%conv.3 = zext i32 %sub1.3 to i64
%mul.3 = mul i64 %mul.2, %conv.3
%mul3.3 = mul i64 %mul3.2, %indvars.iv.next.2
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !16
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%mul.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %mul.3, %for.body ]
%mul3.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %mul3.3, %for.body ]
%indvars.iv.unr = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next.3, %for.body ]
%denominator.016.unr = phi i64 [ 1, %for.body.lr.ph ], [ %mul3.3, %for.body ]
%numerator.015.unr = phi i64 [ 1, %for.body.lr.ph ], [ %mul.3, %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, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ]
%denominator.016.epil = phi i64 [ %mul3.epil, %for.body.epil ], [ %denominator.016.unr, %for.end.loopexit.unr-lcssa ]
%numerator.015.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %numerator.015.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%8 = trunc i64 %indvars.iv.epil to i32
%sub1.epil = sub i32 %add, %8
%conv.epil = zext i32 %sub1.epil to i64
%mul.epil = mul i64 %numerator.015.epil, %conv.epil
%mul3.epil = mul i64 %denominator.016.epil, %indvars.iv.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end.loopexit, label %for.body.epil, !llvm.loop !17
for.end.loopexit: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa
%mul.lcssa = phi i64 [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
%mul3.lcssa = phi i64 [ %mul3.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul3.epil, %for.body.epil ]
%9 = udiv i64 %mul.lcssa, %mul3.lcssa
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%div = phi i64 [ 1, %entry ], [ %9, %for.end.loopexit ]
ret i64 %div
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local double @combination_general(double noundef %alpha, i32 noundef %k) local_unnamed_addr #6 {
entry:
%cmp.not10 = icmp eq i32 %k, 0
br i1 %cmp.not10, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = fadd double %alpha, 1.000000e+00
%0 = add i32 %k, 1
%umax = tail call i32 @llvm.umax.i32(i32 %0, i32 2)
%wide.trip.count = zext i32 %umax to i64
%1 = add nsw i64 %wide.trip.count, -1
%2 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %1, 3
%3 = icmp ult i64 %2, 3
br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %1, -4
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%indvars.iv = phi i64 [ 1, %for.body.lr.ph.new ], [ %indvars.iv.next.3, %for.body ]
%denominator.013 = phi i64 [ 1, %for.body.lr.ph.new ], [ %mul2.3, %for.body ]
%numerator.012 = phi double [ 1.000000e+00, %for.body.lr.ph.new ], [ %mul.3, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ]
%4 = trunc i64 %indvars.iv to i32
%conv = uitofp i32 %4 to double
%sub = fsub double %add, %conv
%mul = fmul double %numerator.012, %sub
%mul2 = mul i64 %denominator.013, %indvars.iv
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = trunc i64 %indvars.iv.next to i32
%conv.1 = uitofp i32 %5 to double
%sub.1 = fsub double %add, %conv.1
%mul.1 = fmul double %mul, %sub.1
%mul2.1 = mul i64 %mul2, %indvars.iv.next
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%6 = trunc i64 %indvars.iv.next.1 to i32
%conv.2 = uitofp i32 %6 to double
%sub.2 = fsub double %add, %conv.2
%mul.2 = fmul double %mul.1, %sub.2
%mul2.2 = mul i64 %mul2.1, %indvars.iv.next.1
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%7 = trunc i64 %indvars.iv.next.2 to i32
%conv.3 = uitofp i32 %7 to double
%sub.3 = fsub double %add, %conv.3
%mul.3 = fmul double %mul.2, %sub.3
%mul2.3 = mul i64 %mul2.2, %indvars.iv.next.2
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%mul.lcssa.ph = phi double [ undef, %for.body.lr.ph ], [ %mul.3, %for.body ]
%mul2.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %mul2.3, %for.body ]
%indvars.iv.unr = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next.3, %for.body ]
%denominator.013.unr = phi i64 [ 1, %for.body.lr.ph ], [ %mul2.3, %for.body ]
%numerator.012.unr = phi double [ 1.000000e+00, %for.body.lr.ph ], [ %mul.3, %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, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ]
%denominator.013.epil = phi i64 [ %mul2.epil, %for.body.epil ], [ %denominator.013.unr, %for.end.loopexit.unr-lcssa ]
%numerator.012.epil = phi double [ %mul.epil, %for.body.epil ], [ %numerator.012.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%8 = trunc i64 %indvars.iv.epil to i32
%conv.epil = uitofp i32 %8 to double
%sub.epil = fsub double %add, %conv.epil
%mul.epil = fmul double %numerator.012.epil, %sub.epil
%mul2.epil = mul i64 %denominator.013.epil, %indvars.iv.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end.loopexit, label %for.body.epil, !llvm.loop !19
for.end.loopexit: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa
%mul.lcssa = phi double [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
%mul2.lcssa = phi i64 [ %mul2.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul2.epil, %for.body.epil ]
%9 = uitofp i64 %mul2.lcssa to double
%10 = fdiv double %mul.lcssa, %9
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%div = phi double [ 1.000000e+00, %entry ], [ %10, %for.end.loopexit ]
ret double %div
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @convert_adic_int(ptr nocapture noundef readonly %num, i32 noundef %p_adic, i32 noundef %q_adic) local_unnamed_addr #7 {
entry:
%call = tail call i64 @strtol(ptr nocapture noundef %num, ptr noundef null, i32 noundef %p_adic) #22
%cmp124.not = icmp eq i64 %call, 0
br i1 %cmp124.not, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%spec.select = tail call i64 @llvm.abs.i64(i64 %call, i1 true)
%conv2 = zext i32 %q_adic to i64
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%tmp.127 = phi i64 [ %spec.select, %while.body.lr.ph ], [ %div, %while.body ]
%answer.026 = phi i32 [ 0, %while.body.lr.ph ], [ %conv4, %while.body ]
%i.025 = phi i32 [ 0, %while.body.lr.ph ], [ %add6, %while.body ]
%rem = urem i64 %tmp.127, %conv2
%conv1.i = uitofp i32 %i.025 to double
%call.i = tail call double @pow(double noundef 1.000000e+01, double noundef %conv1.i) #22
%conv2.i = fptosi double %call.i to i32
%0 = trunc i64 %rem to i32
%1 = mul i32 %conv2.i, %0
%conv4 = add i32 %1, %answer.026
%div = udiv i64 %tmp.127, %conv2
%add6 = add nuw nsw i32 %i.025, 1
%cmp1.not = icmp ult i64 %tmp.127, %conv2
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %while.body, %entry
%answer.0.lcssa = phi i32 [ 0, %entry ], [ %conv4, %while.body ]
%sub11 = sub nsw i32 0, %answer.0.lcssa
%cmp823 = icmp slt i64 %call, 0
%retval.0 = select i1 %cmp823, i32 %sub11, i32 %answer.0.lcssa
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind uwtable
define dso_local void @convert_adic_char(ptr nocapture noundef %num, i32 noundef %p_adic, i32 noundef %q_adic) local_unnamed_addr #7 {
entry:
%mod = alloca [32 x i32], align 16
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %mod) #22
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(128) %mod, i8 0, i64 128, i1 false)
%call = tail call i64 @strtol(ptr nocapture noundef %num, ptr noundef null, i32 noundef %p_adic) #22
%cmp = icmp slt i64 %call, 0
%cmp174.not = icmp eq i64 %call, 0
br i1 %cmp174.not, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%spec.select = tail call i64 @llvm.abs.i64(i64 %call, i1 true)
%conv = zext i32 %q_adic to i64
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%indvars.iv = phi i64 [ 0, %while.body.lr.ph ], [ %indvars.iv.next, %while.body ]
%tmp.176 = phi i64 [ %spec.select, %while.body.lr.ph ], [ %div, %while.body ]
%rem = urem i64 %tmp.176, %conv
%conv2 = trunc i64 %rem to i32
%arrayidx = getelementptr inbounds [32 x i32], ptr %mod, i64 0, i64 %indvars.iv
store i32 %conv2, ptr %arrayidx, align 4, !tbaa !5
%div = udiv i64 %tmp.176, %conv
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp1.not = icmp ult i64 %tmp.176, %conv
br i1 %cmp1.not, label %while.end.loopexit, label %while.body, !llvm.loop !21
while.end.loopexit: ; preds = %while.body
%0 = trunc i64 %indvars.iv to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%digit.0.lcssa = phi i32 [ 0, %entry ], [ %0, %while.end.loopexit ]
%call4 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num) #23
%1 = trunc i64 %call4 to i32
%conv6 = add i32 %1, -1
%cmp.not3.i = icmp slt i32 %conv6, 0
br i1 %cmp.not3.i, label %ini_char.exit, label %for.body.preheader.i
for.body.preheader.i: ; preds = %while.end
%2 = and i64 %call4, 4294967295
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %num, i8 0, i64 %2, i1 false), !tbaa !9
br label %ini_char.exit
ini_char.exit: ; preds = %while.end, %for.body.preheader.i
%call.lobit = lshr i64 %call, 63
%conv7 = trunc i64 %call.lobit to i32
br i1 %cmp, label %if.then10, label %if.end12
if.then10: ; preds = %ini_char.exit
store i8 45, ptr %num, align 1, !tbaa !9
br label %if.end12
if.end12: ; preds = %if.then10, %ini_char.exit
%add42 = add nuw nsw i32 %digit.0.lcssa, %conv7
%3 = add i32 %digit.0.lcssa, 1
%wide.trip.count = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 16
br i1 %min.iters.check, label %for.body.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %if.end12
%4 = add nsw i64 %wide.trip.count, -1
%5 = add i32 %digit.0.lcssa, %conv7
%6 = trunc i64 %4 to i32
%7 = sub i32 %5, %6
%8 = icmp sgt i32 %7, %5
%9 = icmp ugt i64 %4, 4294967295
%10 = or i1 %8, %9
br i1 %10, label %for.body.preheader, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %wide.trip.count, 4294967292
%ind.end = sub nsw i64 0, %n.vec
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %q_adic, 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 = %pred.store.continue95, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue95 ]
%11 = trunc i64 %index to i32
%12 = getelementptr inbounds [32 x i32], ptr %mod, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = icmp slt <4 x i32> %wide.load, <i32 10, i32 10, i32 10, i32 10>
%14 = icmp ult <4 x i32> %wide.load, %broadcast.splat
%15 = xor <4 x i1> %13, <i1 true, i1 true, i1 true, i1 true>
%16 = select <4 x i1> %15, <4 x i1> %14, <4 x i1> zeroinitializer
%predphi = select <4 x i1> %16, <4 x i8> <i8 87, i8 87, i8 87, i8 87>, <4 x i8> <i8 48, i8 48, i8 48, i8 48>
%17 = or <4 x i1> %16, %13
%18 = extractelement <4 x i1> %17, i64 0
br i1 %18, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%19 = sub i32 %add42, %11
%20 = sext i32 %19 to i64
%21 = bitcast <4 x i32> %wide.load to <16 x i8>
%22 = extractelement <16 x i8> %21, i64 0
%23 = getelementptr inbounds i8, ptr %num, i64 %20
%24 = extractelement <4 x i8> %predphi, i64 0
%25 = add i8 %24, %22
store i8 %25, ptr %23, align 1, !tbaa !9
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%26 = extractelement <4 x i1> %17, i64 1
br i1 %26, label %pred.store.if90, label %pred.store.continue91
pred.store.if90: ; preds = %pred.store.continue
%27 = xor i32 %11, -1
%28 = add i32 %add42, %27
%29 = sext i32 %28 to i64
%30 = bitcast <4 x i32> %wide.load to <16 x i8>
%31 = extractelement <16 x i8> %30, i64 4
%32 = getelementptr inbounds i8, ptr %num, i64 %29
%33 = extractelement <4 x i8> %predphi, i64 1
%34 = add i8 %33, %31
store i8 %34, ptr %32, align 1, !tbaa !9
br label %pred.store.continue91
pred.store.continue91: ; preds = %pred.store.if90, %pred.store.continue
%35 = extractelement <4 x i1> %17, i64 2
br i1 %35, label %pred.store.if92, label %pred.store.continue93
pred.store.if92: ; preds = %pred.store.continue91
%reass.sub = sub i32 %add42, %11
%36 = add i32 %reass.sub, -2
%37 = sext i32 %36 to i64
%38 = bitcast <4 x i32> %wide.load to <16 x i8>
%39 = extractelement <16 x i8> %38, i64 8
%40 = getelementptr inbounds i8, ptr %num, i64 %37
%41 = extractelement <4 x i8> %predphi, i64 2
%42 = add i8 %41, %39
store i8 %42, ptr %40, align 1, !tbaa !9
br label %pred.store.continue93
pred.store.continue93: ; preds = %pred.store.if92, %pred.store.continue91
%43 = extractelement <4 x i1> %17, i64 3
br i1 %43, label %pred.store.if94, label %pred.store.continue95
pred.store.if94: ; preds = %pred.store.continue93
%reass.sub96 = sub i32 %add42, %11
%44 = add i32 %reass.sub96, -3
%45 = sext i32 %44 to i64
%46 = bitcast <4 x i32> %wide.load to <16 x i8>
%47 = extractelement <16 x i8> %46, i64 12
%48 = getelementptr inbounds i8, ptr %num, i64 %45
%49 = extractelement <4 x i8> %predphi, i64 3
%50 = add i8 %49, %47
store i8 %50, ptr %48, align 1, !tbaa !9
br label %pred.store.continue95
pred.store.continue95: ; preds = %pred.store.if94, %pred.store.continue93
%index.next = add nuw i64 %index, 4
%51 = icmp eq i64 %index.next, %n.vec
br i1 %51, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %pred.store.continue95
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %vector.scevcheck, %if.end12, %middle.block
%indvars.iv82.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %if.end12 ], [ %n.vec, %middle.block ]
%indvars.iv80.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %if.end12 ], [ %ind.end, %middle.block ]
%xtraiter = and i64 %wide.trip.count, 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
%arrayidx16.prol = getelementptr inbounds [32 x i32], ptr %mod, i64 0, i64 %indvars.iv82.ph
%52 = load i32, ptr %arrayidx16.prol, align 16, !tbaa !5
%cmp17.prol = icmp slt i32 %52, 10
br i1 %cmp17.prol, label %for.inc.sink.split.prol, label %if.else.prol
if.else.prol: ; preds = %for.body.prol
%cmp32.prol = icmp ult i32 %52, %q_adic
br i1 %cmp32.prol, label %for.inc.sink.split.prol, label %for.inc.prol
for.inc.sink.split.prol: ; preds = %if.else.prol, %for.body.prol
%.sink88.prol = phi i8 [ 48, %for.body.prol ], [ 87, %if.else.prol ]
%53 = trunc i32 %52 to i8
%conv23.prol = add i8 %.sink88.prol, %53
%54 = trunc i64 %indvars.iv80.ph to i32
%sub27.prol = add i32 %add42, %54
%idxprom28.prol = sext i32 %sub27.prol to i64
%arrayidx29.prol = getelementptr inbounds i8, ptr %num, i64 %idxprom28.prol
store i8 %conv23.prol, ptr %arrayidx29.prol, align 1, !tbaa !9
br label %for.inc.prol
for.inc.prol: ; preds = %for.inc.sink.split.prol, %if.else.prol
%indvars.iv.next83.prol = or i64 %indvars.iv82.ph, 1
%indvars.iv.next81.prol = add nsw i64 %indvars.iv80.ph, -1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.inc.prol, %for.body.preheader
%indvars.iv82.unr = phi i64 [ %indvars.iv82.ph, %for.body.preheader ], [ %indvars.iv.next83.prol, %for.inc.prol ]
%indvars.iv80.unr = phi i64 [ %indvars.iv80.ph, %for.body.preheader ], [ %indvars.iv.next81.prol, %for.inc.prol ]
%55 = sub nsw i64 0, %wide.trip.count
%56 = xor i64 %indvars.iv82.ph, %55
%57 = icmp eq i64 %56, -1
br i1 %57, label %for.end, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.inc.1
%indvars.iv82 = phi i64 [ %indvars.iv.next83.1, %for.inc.1 ], [ %indvars.iv82.unr, %for.body.prol.loopexit ]
%indvars.iv80 = phi i64 [ %indvars.iv.next81.1, %for.inc.1 ], [ %indvars.iv80.unr, %for.body.prol.loopexit ]
%arrayidx16 = getelementptr inbounds [32 x i32], ptr %mod, i64 0, i64 %indvars.iv82
%58 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%cmp17 = icmp slt i32 %58, 10
br i1 %cmp17, label %for.inc.sink.split, label %if.else
if.else: ; preds = %for.body
%cmp32 = icmp ult i32 %58, %q_adic
br i1 %cmp32, label %for.inc.sink.split, label %for.inc
for.inc.sink.split: ; preds = %if.else, %for.body
%.sink88 = phi i8 [ 48, %for.body ], [ 87, %if.else ]
%59 = trunc i32 %58 to i8
%conv23 = add i8 %.sink88, %59
%60 = trunc i64 %indvars.iv80 to i32
%sub27 = add i32 %add42, %60
%idxprom28 = sext i32 %sub27 to i64
%arrayidx29 = getelementptr inbounds i8, ptr %num, i64 %idxprom28
store i8 %conv23, ptr %arrayidx29, align 1, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %if.else
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%arrayidx16.1 = getelementptr inbounds [32 x i32], ptr %mod, i64 0, i64 %indvars.iv.next83
%61 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
%cmp17.1 = icmp slt i32 %61, 10
br i1 %cmp17.1, label %for.inc.sink.split.1, label %if.else.1
if.else.1: ; preds = %for.inc
%cmp32.1 = icmp ult i32 %61, %q_adic
br i1 %cmp32.1, label %for.inc.sink.split.1, label %for.inc.1
for.inc.sink.split.1: ; preds = %if.else.1, %for.inc
%.sink88.1 = phi i8 [ 48, %for.inc ], [ 87, %if.else.1 ]
%62 = trunc i32 %61 to i8
%conv23.1 = add i8 %.sink88.1, %62
%63 = trunc i64 %indvars.iv80 to i32
%64 = add i32 %63, -1
%sub27.1 = add i32 %add42, %64
%idxprom28.1 = sext i32 %sub27.1 to i64
%arrayidx29.1 = getelementptr inbounds i8, ptr %num, i64 %idxprom28.1
store i8 %conv23.1, ptr %arrayidx29.1, align 1, !tbaa !9
br label %for.inc.1
for.inc.1: ; preds = %for.inc.sink.split.1, %if.else.1
%indvars.iv.next83.1 = add nuw nsw i64 %indvars.iv82, 2
%indvars.iv.next81.1 = add nsw i64 %indvars.iv80, -2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next83.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !25
for.end: ; preds = %for.body.prol.loopexit, %for.inc.1, %middle.block
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %mod) #22
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #9
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #10
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @count_mod(i32 noundef %min, i32 noundef %max, i32 noundef %num) local_unnamed_addr #11 {
entry:
%cmp = icmp sgt i32 %min, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%div = sdiv i32 %max, %num
%sub = add nsw i32 %min, -1
%div1 = sdiv i32 %sub, %num
%sub2 = sub nsw i32 %div, %div1
br label %return
if.else: ; preds = %entry
%cmp3 = icmp eq i32 %min, 0
br i1 %cmp3, label %if.then4, label %return
if.then4: ; preds = %if.else
%div5 = sdiv i32 %max, %num
%add = add nsw i32 %div5, 1
br label %return
return: ; preds = %if.else, %if.then4, %if.then
%retval.0 = phi i32 [ %sub2, %if.then ], [ %add, %if.then4 ], [ -1, %if.else ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap_int(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #12 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @swap_int_array(ptr nocapture noundef %x, ptr nocapture noundef %y, i32 noundef %min, i32 noundef %max) local_unnamed_addr #13 {
entry:
%cmp.not6 = icmp sgt i32 %min, %max
br i1 %cmp.not6, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
%2 = sub i32 %max, %min
%3 = zext i32 %2 to i64
%4 = add nuw nsw i64 %3, 1
%min.iters.check = icmp ult i32 %2, 15
br i1 %min.iters.check, label %for.body.preheader15, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%5 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %x, i64 %5
%6 = sub i32 %max, %min
%7 = zext i32 %6 to i64
%8 = add nsw i64 %0, %7
%9 = shl nsw i64 %8, 2
%10 = add nsw i64 %9, 4
%scevgep9 = getelementptr i8, ptr %x, i64 %10
%scevgep10 = getelementptr i8, ptr %y, i64 %5
%scevgep11 = getelementptr i8, ptr %y, i64 %10
%bound0 = icmp ult ptr %scevgep, %scevgep11
%bound1 = icmp ult ptr %scevgep10, %scevgep9
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %4, 8589934584
%ind.end = add nsw i64 %n.vec, %0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %index, %0
%11 = getelementptr inbounds i32, ptr %x, i64 %offset.idx
%12 = getelementptr inbounds i32, ptr %y, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %11, align 4, !tbaa !5, !alias.scope !26, !noalias !29
%13 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load12 = load <4 x i32>, ptr %13, align 4, !tbaa !5, !alias.scope !26, !noalias !29
%wide.load13 = load <4 x i32>, ptr %12, align 4, !tbaa !5, !alias.scope !29
%14 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load14 = load <4 x i32>, ptr %14, align 4, !tbaa !5, !alias.scope !29
store <4 x i32> %wide.load13, ptr %11, align 4, !tbaa !5, !alias.scope !26, !noalias !29
store <4 x i32> %wide.load14, ptr %13, align 4, !tbaa !5, !alias.scope !26, !noalias !29
store <4 x i32> %wide.load, ptr %12, align 4, !tbaa !5, !alias.scope !29
store <4 x i32> %wide.load12, ptr %14, align 4, !tbaa !5, !alias.scope !29
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !31
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader15
for.body.preheader15: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %0, %vector.memcheck ], [ %0, %for.body.preheader ], [ %ind.end, %middle.block ]
%16 = add i32 %max, 1
%17 = trunc i64 %indvars.iv.ph to i32
%18 = sub i32 %16, %17
%xtraiter = and i32 %18, 1
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader15
%arrayidx.prol = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.ph
%arrayidx2.prol = getelementptr inbounds i32, ptr %y, i64 %indvars.iv.ph
%19 = load i32, ptr %arrayidx.prol, align 4, !tbaa !5
%20 = load i32, ptr %arrayidx2.prol, align 4, !tbaa !5
store i32 %20, ptr %arrayidx.prol, align 4, !tbaa !5
store i32 %19, ptr %arrayidx2.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nsw i64 %indvars.iv.ph, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader15
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader15 ], [ %indvars.iv.next.prol, %for.body.prol ]
%21 = icmp eq i32 %17, %max
br i1 %21, label %for.end, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds i32, ptr %y, i64 %indvars.iv
%22 = load i32, ptr %arrayidx, align 4, !tbaa !5
%23 = load i32, ptr %arrayidx2, align 4, !tbaa !5
store i32 %23, ptr %arrayidx, align 4, !tbaa !5
store i32 %22, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.next
%arrayidx2.1 = getelementptr inbounds i32, ptr %y, i64 %indvars.iv.next
%24 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%25 = load i32, ptr %arrayidx2.1, align 4, !tbaa !5
store i32 %25, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %24, ptr %arrayidx2.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%lftr.wideiv.1 = trunc i64 %indvars.iv.next.1 to i32
%exitcond.not.1 = icmp eq i32 %1, %lftr.wideiv.1
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !32
for.end: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap_char(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #12 {
entry:
%0 = load i8, ptr %x, align 1, !tbaa !9
%1 = load i8, ptr %y, align 1, !tbaa !9
store i8 %1, ptr %x, align 1, !tbaa !9
store i8 %0, ptr %y, align 1, !tbaa !9
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @swap_char_array(ptr nocapture noundef %x, ptr nocapture noundef %y, i32 noundef %min, i32 noundef %max) local_unnamed_addr #13 {
entry:
%cmp.not6 = icmp sgt i32 %min, %max
br i1 %cmp.not6, label %for.end, label %iter.check
iter.check: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
%2 = sub i32 %max, %min
%3 = zext i32 %2 to i64
%4 = add nuw nsw i64 %3, 1
%min.iters.check = icmp ult i32 %2, 7
br i1 %min.iters.check, label %for.body.preheader, label %vector.memcheck
vector.memcheck: ; preds = %iter.check
%scevgep = getelementptr i8, ptr %x, i64 %0
%5 = sub i32 %max, %min
%6 = zext i32 %5 to i64
%7 = add nsw i64 %0, %6
%8 = add nsw i64 %7, 1
%scevgep9 = getelementptr i8, ptr %x, i64 %8
%scevgep10 = getelementptr i8, ptr %y, i64 %0
%scevgep11 = getelementptr i8, ptr %y, i64 %8
%bound0 = icmp ult ptr %scevgep, %scevgep11
%bound1 = icmp ult ptr %scevgep10, %scevgep9
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.memcheck
%min.iters.check12 = icmp ult i32 %2, 31
br i1 %min.iters.check12, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %4, 8589934560
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %index, %0
%9 = getelementptr inbounds i8, ptr %x, i64 %offset.idx
%10 = getelementptr inbounds i8, ptr %y, i64 %offset.idx
%wide.load = load <16 x i8>, ptr %9, align 1, !tbaa !9, !alias.scope !33, !noalias !36
%11 = getelementptr inbounds i8, ptr %9, i64 16
%wide.load13 = load <16 x i8>, ptr %11, align 1, !tbaa !9, !alias.scope !33, !noalias !36
%wide.load14 = load <16 x i8>, ptr %10, align 1, !tbaa !9, !alias.scope !36
%12 = getelementptr inbounds i8, ptr %10, i64 16
%wide.load15 = load <16 x i8>, ptr %12, align 1, !tbaa !9, !alias.scope !36
store <16 x i8> %wide.load14, ptr %9, align 1, !tbaa !9, !alias.scope !33, !noalias !36
store <16 x i8> %wide.load15, ptr %11, align 1, !tbaa !9, !alias.scope !33, !noalias !36
store <16 x i8> %wide.load, ptr %10, align 1, !tbaa !9, !alias.scope !36
store <16 x i8> %wide.load13, ptr %12, align 1, !tbaa !9, !alias.scope !36
%index.next = add nuw i64 %index, 32
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !38
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%ind.end18 = add nsw i64 %n.vec, %0
%n.vec.remaining = and i64 %4, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec17 = and i64 %4, 8589934584
%ind.end = add nsw i64 %n.vec17, %0
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index20 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next24, %vec.epilog.vector.body ]
%offset.idx21 = add i64 %index20, %0
%14 = getelementptr inbounds i8, ptr %x, i64 %offset.idx21
%15 = getelementptr inbounds i8, ptr %y, i64 %offset.idx21
%wide.load22 = load <8 x i8>, ptr %14, align 1, !tbaa !9, !alias.scope !39, !noalias !42
%wide.load23 = load <8 x i8>, ptr %15, align 1, !tbaa !9, !alias.scope !42
store <8 x i8> %wide.load23, ptr %14, align 1, !tbaa !9, !alias.scope !39, !noalias !42
store <8 x i8> %wide.load22, ptr %15, align 1, !tbaa !9, !alias.scope !42
%index.next24 = add nuw i64 %index20, 8
%16 = icmp eq i64 %index.next24, %n.vec17
br i1 %16, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !44
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n19 = icmp eq i64 %4, %n.vec17
br i1 %cmp.n19, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %vector.memcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ %0, %iter.check ], [ %0, %vector.memcheck ], [ %ind.end18, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
%17 = add i32 %max, 1
%18 = trunc i64 %indvars.iv.ph to i32
%19 = sub i32 %17, %18
%xtraiter = and i32 %19, 1
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader
%arrayidx.prol = getelementptr inbounds i8, ptr %x, i64 %indvars.iv.ph
%arrayidx2.prol = getelementptr inbounds i8, ptr %y, i64 %indvars.iv.ph
%20 = load i8, ptr %arrayidx.prol, align 1, !tbaa !9
%21 = load i8, ptr %arrayidx2.prol, align 1, !tbaa !9
store i8 %21, ptr %arrayidx.prol, align 1, !tbaa !9
store i8 %20, ptr %arrayidx2.prol, align 1, !tbaa !9
%indvars.iv.next.prol = add nsw i64 %indvars.iv.ph, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ]
%22 = icmp eq i32 %18, %max
br i1 %22, label %for.end, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i8, ptr %x, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds i8, ptr %y, i64 %indvars.iv
%23 = load i8, ptr %arrayidx, align 1, !tbaa !9
%24 = load i8, ptr %arrayidx2, align 1, !tbaa !9
store i8 %24, ptr %arrayidx, align 1, !tbaa !9
store i8 %23, ptr %arrayidx2, align 1, !tbaa !9
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %x, i64 %indvars.iv.next
%arrayidx2.1 = getelementptr inbounds i8, ptr %y, i64 %indvars.iv.next
%25 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%26 = load i8, ptr %arrayidx2.1, align 1, !tbaa !9
store i8 %26, ptr %arrayidx.1, align 1, !tbaa !9
store i8 %25, ptr %arrayidx2.1, align 1, !tbaa !9
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%lftr.wideiv.1 = trunc i64 %indvars.iv.next.1 to i32
%exitcond.not.1 = icmp eq i32 %1, %lftr.wideiv.1
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !45
for.end: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %vec.epilog.middle.block, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @reverse_char(ptr nocapture noundef %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #13 {
entry:
%add = add nsw i32 %max, %min
%div = sdiv i32 %add, 2
%cmp.not12 = icmp slt i32 %div, %min
br i1 %cmp.not12, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = sext i32 %add to i64
%2 = add nsw i32 %div, 1
%3 = add nsw i32 %div, 1
%4 = sub i32 %3, %min
%xtraiter = and i32 %4, 1
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader
%arrayidx.prol = getelementptr inbounds i8, ptr %array, i64 %0
%5 = sub nsw i64 %1, %0
%arrayidx3.prol = getelementptr inbounds i8, ptr %array, i64 %5
%6 = load i8, ptr %arrayidx.prol, align 1, !tbaa !9
%7 = load i8, ptr %arrayidx3.prol, align 1, !tbaa !9
store i8 %7, ptr %arrayidx.prol, align 1, !tbaa !9
store i8 %6, ptr %arrayidx3.prol, align 1, !tbaa !9
%indvars.iv.next.prol = add nsw i64 %0, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv.unr = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ]
%8 = icmp eq i32 %div, %min
br i1 %8, label %for.end, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %indvars.iv
%9 = sub nsw i64 %1, %indvars.iv
%arrayidx3 = getelementptr inbounds i8, ptr %array, i64 %9
%10 = load i8, ptr %arrayidx, align 1, !tbaa !9
%11 = load i8, ptr %arrayidx3, align 1, !tbaa !9
store i8 %11, ptr %arrayidx, align 1, !tbaa !9
store i8 %10, ptr %arrayidx3, align 1, !tbaa !9
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %array, i64 %indvars.iv.next
%12 = sub nsw i64 %1, %indvars.iv.next
%arrayidx3.1 = getelementptr inbounds i8, ptr %array, i64 %12
%13 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%14 = load i8, ptr %arrayidx3.1, align 1, !tbaa !9
store i8 %14, ptr %arrayidx.1, align 1, !tbaa !9
store i8 %13, ptr %arrayidx3.1, align 1, !tbaa !9
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%lftr.wideiv.1 = trunc i64 %indvars.iv.next.1 to i32
%exitcond.not.1 = icmp eq i32 %2, %lftr.wideiv.1
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !46
for.end: ; preds = %for.body.prol.loopexit, %for.body, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @shift_char(ptr nocapture noundef %array, i32 noundef %min, i32 noundef %max, i32 noundef %num) local_unnamed_addr #14 {
entry:
%array39 = ptrtoint ptr %array to i64
%cmp.not24 = icmp slt i32 %max, %min
br i1 %cmp.not24, label %for.cond3.preheader, label %iter.check
iter.check: ; preds = %entry
%0 = sext i32 %max to i64
%1 = sext i32 %num to i64
%2 = sext i32 %min to i64
%invariant.gep = getelementptr i8, ptr %array, i64 %1
%3 = add nsw i64 %0, 1
%4 = sub nsw i64 %3, %2
%min.iters.check = icmp ult i64 %4, 4
br i1 %min.iters.check, label %for.body.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %iter.check
%5 = sub nsw i64 %0, %2
%6 = getelementptr i8, ptr %array, i64 %1
%scevgep34 = getelementptr i8, ptr %6, i64 %0
%7 = sub nsw i64 0, %5
%8 = getelementptr i8, ptr %scevgep34, i64 %7
%9 = icmp ugt ptr %8, %scevgep34
%scevgep35 = getelementptr i8, ptr %array, i64 %0
%10 = sub nsw i64 0, %5
%11 = getelementptr i8, ptr %scevgep35, i64 %10
%12 = icmp ugt ptr %11, %scevgep35
%13 = or i1 %9, %12
br i1 %13, label %for.body.preheader, label %vector.memcheck
vector.memcheck: ; preds = %vector.scevcheck
%14 = add i64 %array39, %0
%15 = add i64 %array39, %1
%16 = add i64 %15, %0
%17 = sub i64 %14, %16
%diff.check = icmp ult i64 %17, 16
br i1 %diff.check, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.memcheck
%min.iters.check40 = icmp ult i64 %4, 16
br i1 %min.iters.check40, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %4, -16
%invariant.gep52 = getelementptr i8, ptr %array, i64 -15
%invariant.gep54 = getelementptr i8, ptr %invariant.gep, i64 -15
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = sub i64 %0, %index
%gep53 = getelementptr i8, ptr %invariant.gep52, i64 %offset.idx
%wide.load = load <16 x i8>, ptr %gep53, align 1, !tbaa !9
%gep55 = getelementptr i8, ptr %invariant.gep54, i64 %offset.idx
store <16 x i8> %wide.load, ptr %gep55, align 1, !tbaa !9
%index.next = add nuw i64 %index, 16
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !47
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.cond3.preheader, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%ind.end44 = sub nsw i64 %0, %n.vec
%n.vec.remaining = and i64 %4, 12
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec43 = and i64 %4, -4
%ind.end = sub nsw i64 %0, %n.vec43
%invariant.gep56 = getelementptr i8, ptr %array, i64 -3
%invariant.gep58 = getelementptr i8, ptr %invariant.gep, i64 -3
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index46 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next51, %vec.epilog.vector.body ]
%offset.idx47 = sub i64 %0, %index46
%gep57 = getelementptr i8, ptr %invariant.gep56, i64 %offset.idx47
%wide.load48 = load <4 x i8>, ptr %gep57, align 1, !tbaa !9
%gep59 = getelementptr i8, ptr %invariant.gep58, i64 %offset.idx47
store <4 x i8> %wide.load48, ptr %gep59, align 1, !tbaa !9
%index.next51 = add nuw i64 %index46, 4
%19 = icmp eq i64 %index.next51, %n.vec43
br i1 %19, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !48
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n45 = icmp eq i64 %4, %n.vec43
br i1 %cmp.n45, label %for.cond3.preheader, label %for.body.preheader
for.body.preheader: ; preds = %vector.memcheck, %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ %0, %iter.check ], [ %0, %vector.memcheck ], [ %0, %vector.scevcheck ], [ %ind.end44, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
br label %for.body
for.cond3.preheader: ; preds = %for.body, %middle.block, %vec.epilog.middle.block, %entry
%cmp6.not.not26 = icmp sgt i32 %num, 0
br i1 %cmp6.not.not26, label %for.body7.preheader, label %for.end12
for.body7.preheader: ; preds = %for.cond3.preheader
%add4 = add i32 %num, %min
%20 = sext i32 %min to i64
%scevgep = getelementptr i8, ptr %array, i64 %20
%21 = add i32 %min, 1
%smax = tail call i32 @llvm.smax.i32(i32 %add4, i32 %21)
%22 = xor i32 %min, -1
%23 = add i32 %smax, %22
%24 = zext i32 %23 to i64
%25 = add nuw nsw i64 %24, 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i8 0, i64 %25, i1 false), !tbaa !9
br label %for.end12
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader ]
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %indvars.iv
%26 = load i8, ptr %arrayidx, align 1, !tbaa !9
%gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv
store i8 %26, ptr %gep, align 1, !tbaa !9
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp.not.not = icmp sgt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !49
for.end12: ; preds = %for.body7.preheader, %for.cond3.preheader
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @convert_char(ptr nocapture noundef %array, i32 noundef %min, i32 noundef %max, i8 noundef signext %pre, i8 noundef signext %post) local_unnamed_addr #13 {
entry:
%cmp.not11 = icmp sgt i32 %min, %max
br i1 %cmp.not11, label %for.end, label %iter.check
iter.check: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
%2 = sub i32 %max, %min
%3 = zext i32 %2 to i64
%4 = add nuw nsw i64 %3, 1
%min.iters.check = icmp ult i32 %2, 7
br i1 %min.iters.check, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check14 = icmp ult i32 %2, 31
br i1 %min.iters.check14, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %4, 8589934560
%broadcast.splatinsert = insertelement <16 x i8> poison, i8 %pre, i64 0
%broadcast.splat = shufflevector <16 x i8> %broadcast.splatinsert, <16 x i8> poison, <16 x i32> zeroinitializer
%invariant.gep = getelementptr i8, ptr %array, i64 1
%invariant.gep104 = getelementptr i8, ptr %array, i64 2
%invariant.gep106 = getelementptr i8, ptr %array, i64 3
%invariant.gep108 = getelementptr i8, ptr %array, i64 4
%invariant.gep110 = getelementptr i8, ptr %array, i64 5
%invariant.gep112 = getelementptr i8, ptr %array, i64 6
%invariant.gep114 = getelementptr i8, ptr %array, i64 7
%invariant.gep116 = getelementptr i8, ptr %array, i64 8
%invariant.gep118 = getelementptr i8, ptr %array, i64 9
%invariant.gep120 = getelementptr i8, ptr %array, i64 10
%invariant.gep122 = getelementptr i8, ptr %array, i64 11
%invariant.gep124 = getelementptr i8, ptr %array, i64 12
%invariant.gep126 = getelementptr i8, ptr %array, i64 13
%invariant.gep128 = getelementptr i8, ptr %array, i64 14
%invariant.gep130 = getelementptr i8, ptr %array, i64 15
%invariant.gep132 = getelementptr i8, ptr %array, i64 16
%invariant.gep134 = getelementptr i8, ptr %array, i64 17
%invariant.gep136 = getelementptr i8, ptr %array, i64 18
%invariant.gep138 = getelementptr i8, ptr %array, i64 19
%invariant.gep140 = getelementptr i8, ptr %array, i64 20
%invariant.gep142 = getelementptr i8, ptr %array, i64 21
%invariant.gep144 = getelementptr i8, ptr %array, i64 22
%invariant.gep146 = getelementptr i8, ptr %array, i64 23
%invariant.gep148 = getelementptr i8, ptr %array, i64 24
%invariant.gep150 = getelementptr i8, ptr %array, i64 25
%invariant.gep152 = getelementptr i8, ptr %array, i64 26
%invariant.gep154 = getelementptr i8, ptr %array, i64 27
%invariant.gep156 = getelementptr i8, ptr %array, i64 28
%invariant.gep158 = getelementptr i8, ptr %array, i64 29
%invariant.gep160 = getelementptr i8, ptr %array, i64 30
%invariant.gep162 = getelementptr i8, ptr %array, i64 31
br label %vector.body
vector.body: ; preds = %pred.store.continue77, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue77 ]
%offset.idx = add i64 %index, %0
%5 = getelementptr inbounds i8, ptr %array, i64 %offset.idx
%wide.load = load <16 x i8>, ptr %5, align 1, !tbaa !9
%6 = getelementptr inbounds i8, ptr %5, i64 16
%wide.load15 = load <16 x i8>, ptr %6, align 1, !tbaa !9
%7 = icmp eq <16 x i8> %wide.load, %broadcast.splat
%8 = icmp eq <16 x i8> %wide.load15, %broadcast.splat
%9 = extractelement <16 x i1> %7, i64 0
br i1 %9, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%10 = getelementptr inbounds i8, ptr %array, i64 %offset.idx
store i8 %post, ptr %10, align 1, !tbaa !9
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%11 = extractelement <16 x i1> %7, i64 1
br i1 %11, label %pred.store.if16, label %pred.store.continue17
pred.store.if16: ; preds = %pred.store.continue
%gep = getelementptr i8, ptr %invariant.gep, i64 %offset.idx
store i8 %post, ptr %gep, align 1, !tbaa !9
br label %pred.store.continue17
pred.store.continue17: ; preds = %pred.store.if16, %pred.store.continue
%12 = extractelement <16 x i1> %7, i64 2
br i1 %12, label %pred.store.if18, label %pred.store.continue19
pred.store.if18: ; preds = %pred.store.continue17
%gep105 = getelementptr i8, ptr %invariant.gep104, i64 %offset.idx
store i8 %post, ptr %gep105, align 1, !tbaa !9
br label %pred.store.continue19
pred.store.continue19: ; preds = %pred.store.if18, %pred.store.continue17
%13 = extractelement <16 x i1> %7, i64 3
br i1 %13, label %pred.store.if20, label %pred.store.continue21
pred.store.if20: ; preds = %pred.store.continue19
%gep107 = getelementptr i8, ptr %invariant.gep106, i64 %offset.idx
store i8 %post, ptr %gep107, align 1, !tbaa !9
br label %pred.store.continue21
pred.store.continue21: ; preds = %pred.store.if20, %pred.store.continue19
%14 = extractelement <16 x i1> %7, i64 4
br i1 %14, label %pred.store.if22, label %pred.store.continue23
pred.store.if22: ; preds = %pred.store.continue21
%gep109 = getelementptr i8, ptr %invariant.gep108, i64 %offset.idx
store i8 %post, ptr %gep109, align 1, !tbaa !9
br label %pred.store.continue23
pred.store.continue23: ; preds = %pred.store.if22, %pred.store.continue21
%15 = extractelement <16 x i1> %7, i64 5
br i1 %15, label %pred.store.if24, label %pred.store.continue25
pred.store.if24: ; preds = %pred.store.continue23
%gep111 = getelementptr i8, ptr %invariant.gep110, i64 %offset.idx
store i8 %post, ptr %gep111, align 1, !tbaa !9
br label %pred.store.continue25
pred.store.continue25: ; preds = %pred.store.if24, %pred.store.continue23
%16 = extractelement <16 x i1> %7, i64 6
br i1 %16, label %pred.store.if26, label %pred.store.continue27
pred.store.if26: ; preds = %pred.store.continue25
%gep113 = getelementptr i8, ptr %invariant.gep112, i64 %offset.idx
store i8 %post, ptr %gep113, align 1, !tbaa !9
br label %pred.store.continue27
pred.store.continue27: ; preds = %pred.store.if26, %pred.store.continue25
%17 = extractelement <16 x i1> %7, i64 7
br i1 %17, label %pred.store.if28, label %pred.store.continue29
pred.store.if28: ; preds = %pred.store.continue27
%gep115 = getelementptr i8, ptr %invariant.gep114, i64 %offset.idx
store i8 %post, ptr %gep115, align 1, !tbaa !9
br label %pred.store.continue29
pred.store.continue29: ; preds = %pred.store.if28, %pred.store.continue27
%18 = extractelement <16 x i1> %7, i64 8
br i1 %18, label %pred.store.if30, label %pred.store.continue31
pred.store.if30: ; preds = %pred.store.continue29
%gep117 = getelementptr i8, ptr %invariant.gep116, i64 %offset.idx
store i8 %post, ptr %gep117, align 1, !tbaa !9
br label %pred.store.continue31
pred.store.continue31: ; preds = %pred.store.if30, %pred.store.continue29
%19 = extractelement <16 x i1> %7, i64 9
br i1 %19, label %pred.store.if32, label %pred.store.continue33
pred.store.if32: ; preds = %pred.store.continue31
%gep119 = getelementptr i8, ptr %invariant.gep118, i64 %offset.idx
store i8 %post, ptr %gep119, align 1, !tbaa !9
br label %pred.store.continue33
pred.store.continue33: ; preds = %pred.store.if32, %pred.store.continue31
%20 = extractelement <16 x i1> %7, i64 10
br i1 %20, label %pred.store.if34, label %pred.store.continue35
pred.store.if34: ; preds = %pred.store.continue33
%gep121 = getelementptr i8, ptr %invariant.gep120, i64 %offset.idx
store i8 %post, ptr %gep121, align 1, !tbaa !9
br label %pred.store.continue35
pred.store.continue35: ; preds = %pred.store.if34, %pred.store.continue33
%21 = extractelement <16 x i1> %7, i64 11
br i1 %21, label %pred.store.if36, label %pred.store.continue37
pred.store.if36: ; preds = %pred.store.continue35
%gep123 = getelementptr i8, ptr %invariant.gep122, i64 %offset.idx
store i8 %post, ptr %gep123, align 1, !tbaa !9
br label %pred.store.continue37
pred.store.continue37: ; preds = %pred.store.if36, %pred.store.continue35
%22 = extractelement <16 x i1> %7, i64 12
br i1 %22, label %pred.store.if38, label %pred.store.continue39
pred.store.if38: ; preds = %pred.store.continue37
%gep125 = getelementptr i8, ptr %invariant.gep124, i64 %offset.idx
store i8 %post, ptr %gep125, align 1, !tbaa !9
br label %pred.store.continue39
pred.store.continue39: ; preds = %pred.store.if38, %pred.store.continue37
%23 = extractelement <16 x i1> %7, i64 13
br i1 %23, label %pred.store.if40, label %pred.store.continue41
pred.store.if40: ; preds = %pred.store.continue39
%gep127 = getelementptr i8, ptr %invariant.gep126, i64 %offset.idx
store i8 %post, ptr %gep127, align 1, !tbaa !9
br label %pred.store.continue41
pred.store.continue41: ; preds = %pred.store.if40, %pred.store.continue39
%24 = extractelement <16 x i1> %7, i64 14
br i1 %24, label %pred.store.if42, label %pred.store.continue43
pred.store.if42: ; preds = %pred.store.continue41
%gep129 = getelementptr i8, ptr %invariant.gep128, i64 %offset.idx
store i8 %post, ptr %gep129, align 1, !tbaa !9
br label %pred.store.continue43
pred.store.continue43: ; preds = %pred.store.if42, %pred.store.continue41
%25 = extractelement <16 x i1> %7, i64 15
br i1 %25, label %pred.store.if44, label %pred.store.continue45
pred.store.if44: ; preds = %pred.store.continue43
%gep131 = getelementptr i8, ptr %invariant.gep130, i64 %offset.idx
store i8 %post, ptr %gep131, align 1, !tbaa !9
br label %pred.store.continue45
pred.store.continue45: ; preds = %pred.store.if44, %pred.store.continue43
%26 = extractelement <16 x i1> %8, i64 0
br i1 %26, label %pred.store.if46, label %pred.store.continue47
pred.store.if46: ; preds = %pred.store.continue45
%gep133 = getelementptr i8, ptr %invariant.gep132, i64 %offset.idx
store i8 %post, ptr %gep133, align 1, !tbaa !9
br label %pred.store.continue47
pred.store.continue47: ; preds = %pred.store.if46, %pred.store.continue45
%27 = extractelement <16 x i1> %8, i64 1
br i1 %27, label %pred.store.if48, label %pred.store.continue49
pred.store.if48: ; preds = %pred.store.continue47
%gep135 = getelementptr i8, ptr %invariant.gep134, i64 %offset.idx
store i8 %post, ptr %gep135, align 1, !tbaa !9
br label %pred.store.continue49
pred.store.continue49: ; preds = %pred.store.if48, %pred.store.continue47
%28 = extractelement <16 x i1> %8, i64 2
br i1 %28, label %pred.store.if50, label %pred.store.continue51
pred.store.if50: ; preds = %pred.store.continue49
%gep137 = getelementptr i8, ptr %invariant.gep136, i64 %offset.idx
store i8 %post, ptr %gep137, align 1, !tbaa !9
br label %pred.store.continue51
pred.store.continue51: ; preds = %pred.store.if50, %pred.store.continue49
%29 = extractelement <16 x i1> %8, i64 3
br i1 %29, label %pred.store.if52, label %pred.store.continue53
pred.store.if52: ; preds = %pred.store.continue51
%gep139 = getelementptr i8, ptr %invariant.gep138, i64 %offset.idx
store i8 %post, ptr %gep139, align 1, !tbaa !9
br label %pred.store.continue53
pred.store.continue53: ; preds = %pred.store.if52, %pred.store.continue51
%30 = extractelement <16 x i1> %8, i64 4
br i1 %30, label %pred.store.if54, label %pred.store.continue55
pred.store.if54: ; preds = %pred.store.continue53
%gep141 = getelementptr i8, ptr %invariant.gep140, i64 %offset.idx
store i8 %post, ptr %gep141, align 1, !tbaa !9
br label %pred.store.continue55
pred.store.continue55: ; preds = %pred.store.if54, %pred.store.continue53
%31 = extractelement <16 x i1> %8, i64 5
br i1 %31, label %pred.store.if56, label %pred.store.continue57
pred.store.if56: ; preds = %pred.store.continue55
%gep143 = getelementptr i8, ptr %invariant.gep142, i64 %offset.idx
store i8 %post, ptr %gep143, align 1, !tbaa !9
br label %pred.store.continue57
pred.store.continue57: ; preds = %pred.store.if56, %pred.store.continue55
%32 = extractelement <16 x i1> %8, i64 6
br i1 %32, label %pred.store.if58, label %pred.store.continue59
pred.store.if58: ; preds = %pred.store.continue57
%gep145 = getelementptr i8, ptr %invariant.gep144, i64 %offset.idx
store i8 %post, ptr %gep145, align 1, !tbaa !9
br label %pred.store.continue59
pred.store.continue59: ; preds = %pred.store.if58, %pred.store.continue57
%33 = extractelement <16 x i1> %8, i64 7
br i1 %33, label %pred.store.if60, label %pred.store.continue61
pred.store.if60: ; preds = %pred.store.continue59
%gep147 = getelementptr i8, ptr %invariant.gep146, i64 %offset.idx
store i8 %post, ptr %gep147, align 1, !tbaa !9
br label %pred.store.continue61
pred.store.continue61: ; preds = %pred.store.if60, %pred.store.continue59
%34 = extractelement <16 x i1> %8, i64 8
br i1 %34, label %pred.store.if62, label %pred.store.continue63
pred.store.if62: ; preds = %pred.store.continue61
%gep149 = getelementptr i8, ptr %invariant.gep148, i64 %offset.idx
store i8 %post, ptr %gep149, align 1, !tbaa !9
br label %pred.store.continue63
pred.store.continue63: ; preds = %pred.store.if62, %pred.store.continue61
%35 = extractelement <16 x i1> %8, i64 9
br i1 %35, label %pred.store.if64, label %pred.store.continue65
pred.store.if64: ; preds = %pred.store.continue63
%gep151 = getelementptr i8, ptr %invariant.gep150, i64 %offset.idx
store i8 %post, ptr %gep151, align 1, !tbaa !9
br label %pred.store.continue65
pred.store.continue65: ; preds = %pred.store.if64, %pred.store.continue63
%36 = extractelement <16 x i1> %8, i64 10
br i1 %36, label %pred.store.if66, label %pred.store.continue67
pred.store.if66: ; preds = %pred.store.continue65
%gep153 = getelementptr i8, ptr %invariant.gep152, i64 %offset.idx
store i8 %post, ptr %gep153, align 1, !tbaa !9
br label %pred.store.continue67
pred.store.continue67: ; preds = %pred.store.if66, %pred.store.continue65
%37 = extractelement <16 x i1> %8, i64 11
br i1 %37, label %pred.store.if68, label %pred.store.continue69
pred.store.if68: ; preds = %pred.store.continue67
%gep155 = getelementptr i8, ptr %invariant.gep154, i64 %offset.idx
store i8 %post, ptr %gep155, align 1, !tbaa !9
br label %pred.store.continue69
pred.store.continue69: ; preds = %pred.store.if68, %pred.store.continue67
%38 = extractelement <16 x i1> %8, i64 12
br i1 %38, label %pred.store.if70, label %pred.store.continue71
pred.store.if70: ; preds = %pred.store.continue69
%gep157 = getelementptr i8, ptr %invariant.gep156, i64 %offset.idx
store i8 %post, ptr %gep157, align 1, !tbaa !9
br label %pred.store.continue71
pred.store.continue71: ; preds = %pred.store.if70, %pred.store.continue69
%39 = extractelement <16 x i1> %8, i64 13
br i1 %39, label %pred.store.if72, label %pred.store.continue73
pred.store.if72: ; preds = %pred.store.continue71
%gep159 = getelementptr i8, ptr %invariant.gep158, i64 %offset.idx
store i8 %post, ptr %gep159, align 1, !tbaa !9
br label %pred.store.continue73
pred.store.continue73: ; preds = %pred.store.if72, %pred.store.continue71
%40 = extractelement <16 x i1> %8, i64 14
br i1 %40, label %pred.store.if74, label %pred.store.continue75
pred.store.if74: ; preds = %pred.store.continue73
%gep161 = getelementptr i8, ptr %invariant.gep160, i64 %offset.idx
store i8 %post, ptr %gep161, align 1, !tbaa !9
br label %pred.store.continue75
pred.store.continue75: ; preds = %pred.store.if74, %pred.store.continue73
%41 = extractelement <16 x i1> %8, i64 15
br i1 %41, label %pred.store.if76, label %pred.store.continue77
pred.store.if76: ; preds = %pred.store.continue75
%gep163 = getelementptr i8, ptr %invariant.gep162, i64 %offset.idx
store i8 %post, ptr %gep163, align 1, !tbaa !9
br label %pred.store.continue77
pred.store.continue77: ; preds = %pred.store.if76, %pred.store.continue75
%index.next = add nuw i64 %index, 32
%42 = icmp eq i64 %index.next, %n.vec
br i1 %42, label %middle.block, label %vector.body, !llvm.loop !50
middle.block: ; preds = %pred.store.continue77
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%ind.end80 = add nsw i64 %n.vec, %0
%n.vec.remaining = and i64 %4, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec79 = and i64 %4, 8589934584
%ind.end = add nsw i64 %n.vec79, %0
%broadcast.splatinsert85 = insertelement <8 x i8> poison, i8 %pre, i64 0
%broadcast.splat86 = shufflevector <8 x i8> %broadcast.splatinsert85, <8 x i8> poison, <8 x i32> zeroinitializer
%invariant.gep164 = getelementptr i8, ptr %array, i64 1
%invariant.gep166 = getelementptr i8, ptr %array, i64 2
%invariant.gep168 = getelementptr i8, ptr %array, i64 3
%invariant.gep170 = getelementptr i8, ptr %array, i64 4
%invariant.gep172 = getelementptr i8, ptr %array, i64 5
%invariant.gep174 = getelementptr i8, ptr %array, i64 6
%invariant.gep176 = getelementptr i8, ptr %array, i64 7
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %pred.store.continue102, %vec.epilog.ph
%index82 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next103, %pred.store.continue102 ]
%offset.idx83 = add i64 %index82, %0
%43 = getelementptr inbounds i8, ptr %array, i64 %offset.idx83
%wide.load84 = load <8 x i8>, ptr %43, align 1, !tbaa !9
%44 = icmp eq <8 x i8> %wide.load84, %broadcast.splat86
%45 = extractelement <8 x i1> %44, i64 0
br i1 %45, label %pred.store.if87, label %pred.store.continue88
pred.store.if87: ; preds = %vec.epilog.vector.body
%46 = getelementptr inbounds i8, ptr %array, i64 %offset.idx83
store i8 %post, ptr %46, align 1, !tbaa !9
br label %pred.store.continue88
pred.store.continue88: ; preds = %pred.store.if87, %vec.epilog.vector.body
%47 = extractelement <8 x i1> %44, i64 1
br i1 %47, label %pred.store.if89, label %pred.store.continue90
pred.store.if89: ; preds = %pred.store.continue88
%gep165 = getelementptr i8, ptr %invariant.gep164, i64 %offset.idx83
store i8 %post, ptr %gep165, align 1, !tbaa !9
br label %pred.store.continue90
pred.store.continue90: ; preds = %pred.store.if89, %pred.store.continue88
%48 = extractelement <8 x i1> %44, i64 2
br i1 %48, label %pred.store.if91, label %pred.store.continue92
pred.store.if91: ; preds = %pred.store.continue90
%gep167 = getelementptr i8, ptr %invariant.gep166, i64 %offset.idx83
store i8 %post, ptr %gep167, align 1, !tbaa !9
br label %pred.store.continue92
pred.store.continue92: ; preds = %pred.store.if91, %pred.store.continue90
%49 = extractelement <8 x i1> %44, i64 3
br i1 %49, label %pred.store.if93, label %pred.store.continue94
pred.store.if93: ; preds = %pred.store.continue92
%gep169 = getelementptr i8, ptr %invariant.gep168, i64 %offset.idx83
store i8 %post, ptr %gep169, align 1, !tbaa !9
br label %pred.store.continue94
pred.store.continue94: ; preds = %pred.store.if93, %pred.store.continue92
%50 = extractelement <8 x i1> %44, i64 4
br i1 %50, label %pred.store.if95, label %pred.store.continue96
pred.store.if95: ; preds = %pred.store.continue94
%gep171 = getelementptr i8, ptr %invariant.gep170, i64 %offset.idx83
store i8 %post, ptr %gep171, align 1, !tbaa !9
br label %pred.store.continue96
pred.store.continue96: ; preds = %pred.store.if95, %pred.store.continue94
%51 = extractelement <8 x i1> %44, i64 5
br i1 %51, label %pred.store.if97, label %pred.store.continue98
pred.store.if97: ; preds = %pred.store.continue96
%gep173 = getelementptr i8, ptr %invariant.gep172, i64 %offset.idx83
store i8 %post, ptr %gep173, align 1, !tbaa !9
br label %pred.store.continue98
pred.store.continue98: ; preds = %pred.store.if97, %pred.store.continue96
%52 = extractelement <8 x i1> %44, i64 6
br i1 %52, label %pred.store.if99, label %pred.store.continue100
pred.store.if99: ; preds = %pred.store.continue98
%gep175 = getelementptr i8, ptr %invariant.gep174, i64 %offset.idx83
store i8 %post, ptr %gep175, align 1, !tbaa !9
br label %pred.store.continue100
pred.store.continue100: ; preds = %pred.store.if99, %pred.store.continue98
%53 = extractelement <8 x i1> %44, i64 7
br i1 %53, label %pred.store.if101, label %pred.store.continue102
pred.store.if101: ; preds = %pred.store.continue100
%gep177 = getelementptr i8, ptr %invariant.gep176, i64 %offset.idx83
store i8 %post, ptr %gep177, align 1, !tbaa !9
br label %pred.store.continue102
pred.store.continue102: ; preds = %pred.store.if101, %pred.store.continue100
%index.next103 = add nuw i64 %index82, 8
%54 = icmp eq i64 %index.next103, %n.vec79
br i1 %54, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !51
vec.epilog.middle.block: ; preds = %pred.store.continue102
%cmp.n81 = icmp eq i64 %4, %n.vec79
br i1 %cmp.n81, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ %0, %iter.check ], [ %ind.end80, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %indvars.iv.ph, %for.body.preheader ]
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %indvars.iv
%55 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %55, %pre
br i1 %cmp2, label %if.then, label %for.inc
if.then: ; preds = %for.body
store i8 %post, ptr %arrayidx, align 1, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !52
for.end: ; preds = %for.inc, %middle.block, %vec.epilog.middle.block, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort_asc_int(ptr nocapture noundef %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #13 {
entry:
%cmp.not28 = icmp sgt i32 %min, %max
br i1 %cmp.not28, label %for.end14, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %max to i64
%1 = sext i32 %min to i64
%2 = add i32 %max, 1
br label %for.body
for.cond.loopexit: ; preds = %for.inc, %for.body
%lftr.wideiv = trunc i64 %indvars.iv.next34 to i32
%exitcond.not = icmp eq i32 %2, %lftr.wideiv
br i1 %exitcond.not, label %for.end14, label %for.body, !llvm.loop !53
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvars.iv33 = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next34, %for.cond.loopexit ]
%indvars.iv.in = phi i32 [ %min, %for.body.preheader ], [ %indvars.iv, %for.cond.loopexit ]
%indvars.iv = add i32 %indvars.iv.in, 1
%indvars.iv.next34 = add nsw i64 %indvars.iv33, 1
%cmp2.not26.not = icmp slt i64 %indvars.iv33, %0
br i1 %cmp2.not26.not, label %for.body3.lr.ph, label %for.cond.loopexit
for.body3.lr.ph: ; preds = %for.body
%3 = sext i32 %indvars.iv to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv33
br label %for.body3
for.body3: ; preds = %for.body3.lr.ph, %for.inc
%indvars.iv30 = phi i64 [ %3, %for.body3.lr.ph ], [ %indvars.iv.next31, %for.inc ]
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv30
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %4, %5
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.body3
store i32 %5, ptr %arrayidx, align 4, !tbaa !5
store i32 %4, ptr %arrayidx5, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next31 = add nsw i64 %indvars.iv30, 1
%cmp2.not.not = icmp slt i64 %indvars.iv30, %0
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !54
for.end14: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort_des_int(ptr nocapture noundef %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #13 {
entry:
%cmp.not28 = icmp sgt i32 %min, %max
br i1 %cmp.not28, label %for.end14, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %max to i64
%1 = sext i32 %min to i64
%2 = add i32 %max, 1
br label %for.body
for.cond.loopexit: ; preds = %for.inc, %for.body
%lftr.wideiv = trunc i64 %indvars.iv.next34 to i32
%exitcond.not = icmp eq i32 %2, %lftr.wideiv
br i1 %exitcond.not, label %for.end14, label %for.body, !llvm.loop !55
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvars.iv33 = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next34, %for.cond.loopexit ]
%indvars.iv.in = phi i32 [ %min, %for.body.preheader ], [ %indvars.iv, %for.cond.loopexit ]
%indvars.iv = add i32 %indvars.iv.in, 1
%indvars.iv.next34 = add nsw i64 %indvars.iv33, 1
%cmp2.not26.not = icmp slt i64 %indvars.iv33, %0
br i1 %cmp2.not26.not, label %for.body3.lr.ph, label %for.cond.loopexit
for.body3.lr.ph: ; preds = %for.body
%3 = sext i32 %indvars.iv to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv33
br label %for.body3
for.body3: ; preds = %for.body3.lr.ph, %for.inc
%indvars.iv30 = phi i64 [ %3, %for.body3.lr.ph ], [ %indvars.iv.next31, %for.inc ]
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv30
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp slt i32 %4, %5
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.body3
store i32 %5, ptr %arrayidx, align 4, !tbaa !5
store i32 %4, ptr %arrayidx5, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next31 = add nsw i64 %indvars.iv30, 1
%cmp2.not.not = icmp slt i64 %indvars.iv30, %0
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !56
for.end14: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: nofree nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort_asc_char_dic(i32 noundef %size, ptr nocapture noundef %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #15 {
entry:
%0 = zext i32 %size to i64
%cmp.not29 = icmp sgt i32 %min, %max
%cmp.not6.i = icmp slt i32 %size, 1
%or.cond = or i1 %cmp.not29, %cmp.not6.i
br i1 %or.cond, label %for.end14, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = sext i32 %max to i64
%2 = sext i32 %min to i64
%3 = add i32 %max, 1
%4 = add nsw i64 %2, 1
%5 = add i32 %min, 1
%min.iters.check = icmp ult i32 %size, 8
%min.iters.check45 = icmp ult i32 %size, 32
%n.vec = and i64 %0, 4294967264
%cmp.n = icmp eq i64 %n.vec, %0
%n.vec.remaining = and i64 %0, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
%n.vec50 = and i64 %0, 4294967288
%cmp.n51 = icmp eq i64 %n.vec50, %0
%xtraiter = and i64 %0, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%6 = sub nsw i64 0, %0
br label %for.body
for.cond.loopexit: ; preds = %for.inc, %for.body
%lftr.wideiv = trunc i64 %indvars.iv.next38 to i32
%exitcond.not = icmp eq i32 %3, %lftr.wideiv
%indvar.next = add i64 %indvar, 1
br i1 %exitcond.not, label %for.end14, label %for.body, !llvm.loop !57
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvar = phi i64 [ 0, %for.body.preheader ], [ %indvar.next, %for.cond.loopexit ]
%indvars.iv37 = phi i64 [ %2, %for.body.preheader ], [ %indvars.iv.next38, %for.cond.loopexit ]
%indvars.iv.in = phi i32 [ %min, %for.body.preheader ], [ %indvars.iv, %for.cond.loopexit ]
%7 = add i64 %indvar, %2
%8 = mul i64 %7, %0
%scevgep = getelementptr i8, ptr %array, i64 %8
%9 = add i64 %4, %indvar
%10 = mul i64 %9, %0
%scevgep40 = getelementptr i8, ptr %array, i64 %10
%11 = trunc i64 %indvar to i32
%12 = add i32 %5, %11
%13 = sext i32 %12 to i64
%14 = add nsw i64 %13, 1
%indvars.iv = add i32 %indvars.iv.in, 1
%indvars.iv.next38 = add nsw i64 %indvars.iv37, 1
%cmp2.not27.not = icmp slt i64 %indvars.iv37, %1
br i1 %cmp2.not27.not, label %for.body3.lr.ph, label %for.cond.loopexit
for.body3.lr.ph: ; preds = %for.body
%15 = sext i32 %indvars.iv to i64
%16 = mul nsw i64 %indvars.iv37, %0
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %16
br label %for.body3
for.body3: ; preds = %for.body3.lr.ph, %for.inc
%indvar41 = phi i64 [ 0, %for.body3.lr.ph ], [ %indvar.next42, %for.inc ]
%indvars.iv34 = phi i64 [ %15, %for.body3.lr.ph ], [ %indvars.iv.next35, %for.inc ]
%17 = add i64 %indvar41, %13
%18 = mul i64 %17, %0
%scevgep43 = getelementptr i8, ptr %array, i64 %18
%19 = add i64 %14, %indvar41
%20 = mul i64 %19, %0
%scevgep44 = getelementptr i8, ptr %array, i64 %20
%21 = mul nsw i64 %indvars.iv34, %0
%arrayidx5 = getelementptr inbounds i8, ptr %array, i64 %21
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %arrayidx5) #23
%cmp6 = icmp slt i32 %call, 1
br i1 %cmp6, label %for.inc, label %iter.check
iter.check: ; preds = %for.body3
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %iter.check
%bound0 = icmp ult ptr %scevgep, %scevgep44
%bound1 = icmp ult ptr %scevgep43, %scevgep40
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body.i.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.memcheck
br i1 %min.iters.check45, label %vec.epilog.ph, label %vector.body
vector.body: ; preds = %vector.main.loop.iter.check, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.main.loop.iter.check ]
%22 = getelementptr inbounds i8, ptr %arrayidx, i64 %index
%23 = getelementptr inbounds i8, ptr %arrayidx5, i64 %index
%wide.load = load <16 x i8>, ptr %22, align 1, !tbaa !9, !alias.scope !58, !noalias !61
%24 = getelementptr inbounds i8, ptr %22, i64 16
%wide.load46 = load <16 x i8>, ptr %24, align 1, !tbaa !9, !alias.scope !58, !noalias !61
%wide.load47 = load <16 x i8>, ptr %23, align 1, !tbaa !9, !alias.scope !61
%25 = getelementptr inbounds i8, ptr %23, i64 16
%wide.load48 = load <16 x i8>, ptr %25, align 1, !tbaa !9, !alias.scope !61
store <16 x i8> %wide.load47, ptr %22, align 1, !tbaa !9, !alias.scope !58, !noalias !61
store <16 x i8> %wide.load48, ptr %24, align 1, !tbaa !9, !alias.scope !58, !noalias !61
store <16 x i8> %wide.load, ptr %23, align 1, !tbaa !9, !alias.scope !61
store <16 x i8> %wide.load46, ptr %25, align 1, !tbaa !9, !alias.scope !61
%index.next = add nuw i64 %index, 32
%26 = icmp eq i64 %index.next, %n.vec
br i1 %26, label %middle.block, label %vector.body, !llvm.loop !63
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.inc, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
br i1 %min.epilog.iters.check, label %for.body.i.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index52 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next55, %vec.epilog.vector.body ]
%27 = getelementptr inbounds i8, ptr %arrayidx, i64 %index52
%28 = getelementptr inbounds i8, ptr %arrayidx5, i64 %index52
%wide.load53 = load <8 x i8>, ptr %27, align 1, !tbaa !9, !alias.scope !64, !noalias !67
%wide.load54 = load <8 x i8>, ptr %28, align 1, !tbaa !9, !alias.scope !67
store <8 x i8> %wide.load54, ptr %27, align 1, !tbaa !9, !alias.scope !64, !noalias !67
store <8 x i8> %wide.load53, ptr %28, align 1, !tbaa !9, !alias.scope !67
%index.next55 = add nuw i64 %index52, 8
%29 = icmp eq i64 %index.next55, %n.vec50
br i1 %29, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !69
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
br i1 %cmp.n51, label %for.inc, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.i.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec50, %vec.epilog.middle.block ]
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader
%arrayidx.i.prol = getelementptr inbounds i8, ptr %arrayidx, i64 %indvars.iv.i.ph
%arrayidx2.i.prol = getelementptr inbounds i8, ptr %arrayidx5, i64 %indvars.iv.i.ph
%30 = load i8, ptr %arrayidx.i.prol, align 1, !tbaa !9
%31 = load i8, ptr %arrayidx2.i.prol, align 1, !tbaa !9
store i8 %31, ptr %arrayidx.i.prol, align 1, !tbaa !9
store i8 %30, ptr %arrayidx2.i.prol, align 1, !tbaa !9
%indvars.iv.next.i.prol = or i64 %indvars.iv.i.ph, 1
br label %for.body.i.prol.loopexit
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%32 = xor i64 %indvars.iv.i.ph, %6
%33 = icmp eq i64 %32, -1
br i1 %33, label %for.inc, label %for.body.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.1, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%arrayidx.i = getelementptr inbounds i8, ptr %arrayidx, i64 %indvars.iv.i
%arrayidx2.i = getelementptr inbounds i8, ptr %arrayidx5, i64 %indvars.iv.i
%34 = load i8, ptr %arrayidx.i, align 1, !tbaa !9
%35 = load i8, ptr %arrayidx2.i, align 1, !tbaa !9
store i8 %35, ptr %arrayidx.i, align 1, !tbaa !9
store i8 %34, ptr %arrayidx2.i, align 1, !tbaa !9
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %arrayidx, i64 %indvars.iv.next.i
%arrayidx2.i.1 = getelementptr inbounds i8, ptr %arrayidx5, i64 %indvars.iv.next.i
%36 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !9
%37 = load i8, ptr %arrayidx2.i.1, align 1, !tbaa !9
store i8 %37, ptr %arrayidx.i.1, align 1, !tbaa !9
store i8 %36, ptr %arrayidx2.i.1, align 1, !tbaa !9
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%38 = icmp eq i64 %indvars.iv.next.i.1, %0
br i1 %38, label %for.inc, label %for.body.i, !llvm.loop !70
for.inc: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %vec.epilog.middle.block, %for.body3
%indvars.iv.next35 = add nsw i64 %indvars.iv34, 1
%cmp2.not.not = icmp slt i64 %indvars.iv34, %1
%indvar.next42 = add i64 %indvar41, 1
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !71
for.end14: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #10
; Function Attrs: nofree nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort_des_char_dic(i32 noundef %size, ptr nocapture noundef %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #15 {
entry:
%0 = zext i32 %size to i64
%cmp.not29 = icmp sgt i32 %min, %max
%cmp.not6.i = icmp slt i32 %size, 1
%or.cond = or i1 %cmp.not29, %cmp.not6.i
br i1 %or.cond, label %for.end14, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = sext i32 %max to i64
%2 = sext i32 %min to i64
%3 = add i32 %max, 1
%4 = add nsw i64 %2, 1
%5 = add i32 %min, 1
%min.iters.check = icmp ult i32 %size, 8
%min.iters.check45 = icmp ult i32 %size, 32
%n.vec = and i64 %0, 4294967264
%cmp.n = icmp eq i64 %n.vec, %0
%n.vec.remaining = and i64 %0, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
%n.vec50 = and i64 %0, 4294967288
%cmp.n51 = icmp eq i64 %n.vec50, %0
%xtraiter = and i64 %0, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%6 = sub nsw i64 0, %0
br label %for.body
for.cond.loopexit: ; preds = %for.inc, %for.body
%lftr.wideiv = trunc i64 %indvars.iv.next38 to i32
%exitcond.not = icmp eq i32 %3, %lftr.wideiv
%indvar.next = add i64 %indvar, 1
br i1 %exitcond.not, label %for.end14, label %for.body, !llvm.loop !72
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvar = phi i64 [ 0, %for.body.preheader ], [ %indvar.next, %for.cond.loopexit ]
%indvars.iv37 = phi i64 [ %2, %for.body.preheader ], [ %indvars.iv.next38, %for.cond.loopexit ]
%indvars.iv.in = phi i32 [ %min, %for.body.preheader ], [ %indvars.iv, %for.cond.loopexit ]
%7 = add i64 %indvar, %2
%8 = mul i64 %7, %0
%scevgep = getelementptr i8, ptr %array, i64 %8
%9 = add i64 %4, %indvar
%10 = mul i64 %9, %0
%scevgep40 = getelementptr i8, ptr %array, i64 %10
%11 = trunc i64 %indvar to i32
%12 = add i32 %5, %11
%13 = sext i32 %12 to i64
%14 = add nsw i64 %13, 1
%indvars.iv = add i32 %indvars.iv.in, 1
%indvars.iv.next38 = add nsw i64 %indvars.iv37, 1
%cmp2.not27.not = icmp slt i64 %indvars.iv37, %1
br i1 %cmp2.not27.not, label %for.body3.lr.ph, label %for.cond.loopexit
for.body3.lr.ph: ; preds = %for.body
%15 = sext i32 %indvars.iv to i64
%16 = mul nsw i64 %indvars.iv37, %0
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %16
br label %for.body3
for.body3: ; preds = %for.body3.lr.ph, %for.inc
%indvar41 = phi i64 [ 0, %for.body3.lr.ph ], [ %indvar.next42, %for.inc ]
%indvars.iv34 = phi i64 [ %15, %for.body3.lr.ph ], [ %indvars.iv.next35, %for.inc ]
%17 = add i64 %indvar41, %13
%18 = mul i64 %17, %0
%scevgep43 = getelementptr i8, ptr %array, i64 %18
%19 = add i64 %14, %indvar41
%20 = mul i64 %19, %0
%scevgep44 = getelementptr i8, ptr %array, i64 %20
%21 = mul nsw i64 %indvars.iv34, %0
%arrayidx5 = getelementptr inbounds i8, ptr %array, i64 %21
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %arrayidx5) #23
%cmp6 = icmp sgt i32 %call, -1
br i1 %cmp6, label %for.inc, label %iter.check
iter.check: ; preds = %for.body3
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %iter.check
%bound0 = icmp ult ptr %scevgep, %scevgep44
%bound1 = icmp ult ptr %scevgep43, %scevgep40
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body.i.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.memcheck
br i1 %min.iters.check45, label %vec.epilog.ph, label %vector.body
vector.body: ; preds = %vector.main.loop.iter.check, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.main.loop.iter.check ]
%22 = getelementptr inbounds i8, ptr %arrayidx, i64 %index
%23 = getelementptr inbounds i8, ptr %arrayidx5, i64 %index
%wide.load = load <16 x i8>, ptr %22, align 1, !tbaa !9, !alias.scope !73, !noalias !76
%24 = getelementptr inbounds i8, ptr %22, i64 16
%wide.load46 = load <16 x i8>, ptr %24, align 1, !tbaa !9, !alias.scope !73, !noalias !76
%wide.load47 = load <16 x i8>, ptr %23, align 1, !tbaa !9, !alias.scope !76
%25 = getelementptr inbounds i8, ptr %23, i64 16
%wide.load48 = load <16 x i8>, ptr %25, align 1, !tbaa !9, !alias.scope !76
store <16 x i8> %wide.load47, ptr %22, align 1, !tbaa !9, !alias.scope !73, !noalias !76
store <16 x i8> %wide.load48, ptr %24, align 1, !tbaa !9, !alias.scope !73, !noalias !76
store <16 x i8> %wide.load, ptr %23, align 1, !tbaa !9, !alias.scope !76
store <16 x i8> %wide.load46, ptr %25, align 1, !tbaa !9, !alias.scope !76
%index.next = add nuw i64 %index, 32
%26 = icmp eq i64 %index.next, %n.vec
br i1 %26, label %middle.block, label %vector.body, !llvm.loop !78
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.inc, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
br i1 %min.epilog.iters.check, label %for.body.i.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index52 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next55, %vec.epilog.vector.body ]
%27 = getelementptr inbounds i8, ptr %arrayidx, i64 %index52
%28 = getelementptr inbounds i8, ptr %arrayidx5, i64 %index52
%wide.load53 = load <8 x i8>, ptr %27, align 1, !tbaa !9, !alias.scope !79, !noalias !82
%wide.load54 = load <8 x i8>, ptr %28, align 1, !tbaa !9, !alias.scope !82
store <8 x i8> %wide.load54, ptr %27, align 1, !tbaa !9, !alias.scope !79, !noalias !82
store <8 x i8> %wide.load53, ptr %28, align 1, !tbaa !9, !alias.scope !82
%index.next55 = add nuw i64 %index52, 8
%29 = icmp eq i64 %index.next55, %n.vec50
br i1 %29, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !84
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
br i1 %cmp.n51, label %for.inc, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.i.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec50, %vec.epilog.middle.block ]
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader
%arrayidx.i.prol = getelementptr inbounds i8, ptr %arrayidx, i64 %indvars.iv.i.ph
%arrayidx2.i.prol = getelementptr inbounds i8, ptr %arrayidx5, i64 %indvars.iv.i.ph
%30 = load i8, ptr %arrayidx.i.prol, align 1, !tbaa !9
%31 = load i8, ptr %arrayidx2.i.prol, align 1, !tbaa !9
store i8 %31, ptr %arrayidx.i.prol, align 1, !tbaa !9
store i8 %30, ptr %arrayidx2.i.prol, align 1, !tbaa !9
%indvars.iv.next.i.prol = or i64 %indvars.iv.i.ph, 1
br label %for.body.i.prol.loopexit
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%32 = xor i64 %indvars.iv.i.ph, %6
%33 = icmp eq i64 %32, -1
br i1 %33, label %for.inc, label %for.body.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.1, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%arrayidx.i = getelementptr inbounds i8, ptr %arrayidx, i64 %indvars.iv.i
%arrayidx2.i = getelementptr inbounds i8, ptr %arrayidx5, i64 %indvars.iv.i
%34 = load i8, ptr %arrayidx.i, align 1, !tbaa !9
%35 = load i8, ptr %arrayidx2.i, align 1, !tbaa !9
store i8 %35, ptr %arrayidx.i, align 1, !tbaa !9
store i8 %34, ptr %arrayidx2.i, align 1, !tbaa !9
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %arrayidx, i64 %indvars.iv.next.i
%arrayidx2.i.1 = getelementptr inbounds i8, ptr %arrayidx5, i64 %indvars.iv.next.i
%36 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !9
%37 = load i8, ptr %arrayidx2.i.1, align 1, !tbaa !9
store i8 %37, ptr %arrayidx.i.1, align 1, !tbaa !9
store i8 %36, ptr %arrayidx2.i.1, align 1, !tbaa !9
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%38 = icmp eq i64 %indvars.iv.next.i.1, %0
br i1 %38, label %for.inc, label %for.body.i, !llvm.loop !85
for.inc: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %vec.epilog.middle.block, %for.body3
%indvars.iv.next35 = add nsw i64 %indvars.iv34, 1
%cmp2.not.not = icmp slt i64 %indvars.iv34, %1
%indvar.next42 = add i64 %indvar41, 1
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !86
for.end14: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @max_int_array(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #16 {
entry:
%idxprom = sext i32 %min to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.not.not9 = icmp slt i32 %min, %max
br i1 %cmp.not.not9, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = sext i32 %max to i64
%1 = sub nsw i64 %wide.trip.count, %idxprom
%min.iters.check = icmp ult i64 %1, 8
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -8
%ind.end = add nsw i64 %n.vec, %idxprom
%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
%invariant.gep = getelementptr i32, ptr %array, i64 %idxprom
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.phi13 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %5, %vector.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %index
%2 = getelementptr i32, ptr %gep, i64 1
%wide.load = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = getelementptr i32, ptr %gep, i64 5
%wide.load14 = load <4 x i32>, ptr %3, align 4, !tbaa !5
%4 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%5 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi13, <4 x i32> %wide.load14)
%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 !87
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.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %idxprom, %for.body.preheader ], [ %ind.end, %middle.block ]
%answer.011.ph = phi i32 [ %0, %for.body.preheader ], [ %7, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader15, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader15 ]
%answer.011 = phi i32 [ %spec.select.i, %for.body ], [ %answer.011.ph, %for.body.preheader15 ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.next
%8 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%spec.select.i = tail call i32 @llvm.smax.i32(i32 %answer.011, i32 %8)
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !88
for.end: ; preds = %for.body, %middle.block, %entry
%answer.0.lcssa = phi i32 [ %0, %entry ], [ %7, %middle.block ], [ %spec.select.i, %for.body ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @min_int_array(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #16 {
entry:
%idxprom = sext i32 %min to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.not.not9 = icmp slt i32 %min, %max
br i1 %cmp.not.not9, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = sext i32 %max to i64
%1 = sub nsw i64 %wide.trip.count, %idxprom
%min.iters.check = icmp ult i64 %1, 8
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -8
%ind.end = add nsw i64 %n.vec, %idxprom
%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
%invariant.gep = getelementptr i32, ptr %array, i64 %idxprom
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.phi13 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %5, %vector.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %index
%2 = getelementptr i32, ptr %gep, i64 1
%wide.load = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = getelementptr i32, ptr %gep, i64 5
%wide.load14 = load <4 x i32>, ptr %3, align 4, !tbaa !5
%4 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%5 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi13, <4 x i32> %wide.load14)
%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 !89
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %4, <4 x i32> %5)
%7 = tail call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %idxprom, %for.body.preheader ], [ %ind.end, %middle.block ]
%answer.011.ph = phi i32 [ %0, %for.body.preheader ], [ %7, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader15, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader15 ]
%answer.011 = phi i32 [ %spec.select.i, %for.body ], [ %answer.011.ph, %for.body.preheader15 ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds i32, ptr %array, i64 %indvars.iv.next
%8 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%spec.select.i = tail call i32 @llvm.smin.i32(i32 %answer.011, i32 %8)
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !90
for.end: ; preds = %for.body, %middle.block, %entry
%answer.0.lcssa = phi i32 [ %0, %entry ], [ %7, %middle.block ], [ %spec.select.i, %for.body ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i32 @max_char_dic(i32 noundef %size, ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #17 {
entry:
%0 = zext i32 %size to i64
%cmp.not.not11 = icmp slt i32 %min, %max
br i1 %cmp.not.not11, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%1 = sext i32 %min to i64
%wide.trip.count = sext i32 %max to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%answer.013 = phi i32 [ %min, %for.body.preheader ], [ %spec.select, %for.body ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%idxprom = sext i32 %answer.013 to i64
%2 = mul nsw i64 %idxprom, %0
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %2
%3 = mul nsw i64 %indvars.iv.next, %0
%arrayidx2 = getelementptr inbounds i8, ptr %array, i64 %3
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %arrayidx2) #23
%cmp3 = icmp slt i32 %call, 0
%4 = trunc i64 %indvars.iv.next to i32
%spec.select = select i1 %cmp3, i32 %4, i32 %answer.013
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !91
for.end: ; preds = %for.body, %entry
%answer.0.lcssa = phi i32 [ %min, %entry ], [ %spec.select, %for.body ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i32 @min_char_dic(i32 noundef %size, ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #17 {
entry:
%0 = zext i32 %size to i64
%cmp.not.not11 = icmp slt i32 %min, %max
br i1 %cmp.not.not11, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%1 = sext i32 %min to i64
%wide.trip.count = sext i32 %max to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%answer.013 = phi i32 [ %min, %for.body.preheader ], [ %spec.select, %for.body ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%idxprom = sext i32 %answer.013 to i64
%2 = mul nsw i64 %idxprom, %0
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %2
%3 = mul nsw i64 %indvars.iv.next, %0
%arrayidx2 = getelementptr inbounds i8, ptr %array, i64 %3
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %arrayidx2) #23
%cmp3 = icmp sgt i32 %call, 0
%4 = trunc i64 %indvars.iv.next to i32
%spec.select = select i1 %cmp3, i32 %4, i32 %answer.013
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !92
for.end: ; preds = %for.body, %entry
%answer.0.lcssa = phi i32 [ %min, %entry ], [ %spec.select, %for.body ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @sum_array(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #18 {
entry:
%cmp.not6 = icmp sgt i32 %min, %max
br i1 %cmp.not6, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
%2 = sub i32 %max, %min
%3 = zext i32 %2 to i64
%4 = add nuw nsw i64 %3, 1
%min.iters.check = icmp ult i32 %2, 7
br i1 %min.iters.check, label %for.body.preheader12, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %4, 8589934584
%ind.end = add nsw i64 %n.vec, %0
%invariant.gep = getelementptr i32, ptr %array, i64 %0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi10 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %gep, align 4, !tbaa !5
%5 = getelementptr inbounds i32, ptr %gep, i64 4
%wide.load11 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = add <4 x i32> %wide.load, %vec.phi
%7 = add <4 x i32> %wide.load11, %vec.phi10
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !93
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader12
for.body.preheader12: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %0, %for.body.preheader ], [ %ind.end, %middle.block ]
%answer.08.ph = phi i32 [ 0, %for.body.preheader ], [ %9, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader12, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader12 ]
%answer.08 = phi i32 [ %add, %for.body ], [ %answer.08.ph, %for.body.preheader12 ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%10 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %10, %answer.08
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !94
for.end: ; preds = %for.body, %middle.block, %entry
%answer.0.lcssa = phi i32 [ 0, %entry ], [ %9, %middle.block ], [ %add, %for.body ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local zeroext i1 @detect_int(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max, i32 noundef %element) local_unnamed_addr #18 {
entry:
%cmp.not10 = icmp sgt i32 %min, %max
br i1 %cmp.not10, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %2, %element
br i1 %cmp1, label %for.end.loopexit.split.loop.exit, label %for.inc
for.inc: ; preds = %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 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !95
for.end.loopexit.split.loop.exit: ; preds = %for.body
%3 = trunc i64 %indvars.iv to i32
br label %for.end
for.end: ; preds = %for.inc, %for.end.loopexit.split.loop.exit, %entry
%i.0.lcssa = phi i32 [ %min, %entry ], [ %3, %for.end.loopexit.split.loop.exit ], [ %1, %for.inc ]
%cmp3.not = icmp sle i32 %i.0.lcssa, %max
ret i1 %cmp3.not
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local zeroext i1 @detect_char(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max, ptr nocapture noundef readonly %element, i32 noundef %start, i32 noundef %goal) local_unnamed_addr #18 {
entry:
%sub = sub nsw i32 %goal, %start
%sub1 = sub nsw i32 %max, %min
%cmp.not = icmp sgt i32 %sub, %sub1
br i1 %cmp.not, label %if.end24, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub3 = sub nsw i32 %max, %sub
%cmp4.not42 = icmp slt i32 %sub3, %min
br i1 %cmp4.not42, label %if.end24, label %for.cond5.preheader.lr.ph
for.cond5.preheader.lr.ph: ; preds = %for.cond.preheader
%cmp6.not39 = icmp sgt i32 %start, %goal
%add16 = add i32 %goal, 1
br i1 %cmp6.not39, label %for.cond5.preheader.lr.ph.split.us, label %for.cond5.preheader.preheader
for.cond5.preheader.preheader: ; preds = %for.cond5.preheader.lr.ph
%0 = sext i32 %start to i64
br label %for.cond5.preheader
for.cond5.preheader.lr.ph.split.us: ; preds = %for.cond5.preheader.lr.ph
%cmp17.us = icmp eq i32 %add16, %start
br label %if.end24
for.cond5.preheader: ; preds = %for.end, %for.cond5.preheader.preheader
%i.043 = phi i32 [ %min, %for.cond5.preheader.preheader ], [ %add22, %for.end ]
%add = sub i32 %i.043, %start
br label %for.body7
for.body7: ; preds = %for.cond5.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.cond5.preheader ], [ %indvars.iv.next, %for.inc ]
%1 = trunc i64 %indvars.iv to i32
%sub8 = add i32 %add, %1
%idxprom = sext i32 %sub8 to i64
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %idxprom
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%arrayidx10 = getelementptr inbounds i8, ptr %element, i64 %indvars.iv
%3 = load i8, ptr %arrayidx10, align 1, !tbaa !9
%cmp12 = icmp eq i8 %2, %3
br i1 %cmp12, label %for.inc, label %for.end
for.inc: ; preds = %for.body7
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %add16, %lftr.wideiv
br i1 %exitcond.not, label %if.end24, label %for.body7, !llvm.loop !96
for.end: ; preds = %for.body7
%cmp17 = icmp eq i32 %add16, %1
%add22 = add nsw i32 %i.043, 1
%cmp4.not.not = icmp sge i32 %i.043, %sub3
%or.cond.not = or i1 %cmp4.not.not, %cmp17
br i1 %or.cond.not, label %if.end24, label %for.cond5.preheader, !llvm.loop !97
if.end24: ; preds = %for.end, %for.inc, %for.cond5.preheader.lr.ph.split.us, %for.cond.preheader, %entry
%answer.0 = phi i1 [ false, %entry ], [ false, %for.cond.preheader ], [ %cmp17.us, %for.cond5.preheader.lr.ph.split.us ], [ true, %for.inc ], [ %cmp17, %for.end ]
ret i1 %answer.0
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @count_differentelement_int(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #16 {
entry:
%0 = zext i32 %max to i64
%vla = alloca i32, i64 %0, align 16
%cmp.not3.i = icmp slt i32 %max, 0
br i1 %cmp.not3.i, label %ini_int.exit, label %for.body.preheader.i
for.body.preheader.i: ; preds = %entry
%1 = add nuw i32 %max, 1
%2 = zext i32 %1 to i64
%3 = shl nuw nsw i64 %2, 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, i8 0, i64 %3, i1 false), !tbaa !5
br label %ini_int.exit
ini_int.exit: ; preds = %entry, %for.body.preheader.i
%cmp.not22 = icmp sgt i32 %min, %max
br i1 %cmp.not22, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %ini_int.exit
%4 = sext i32 %min to i64
%5 = add i32 %max, 1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %4, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%answer.024 = phi i32 [ 0, %for.body.preheader ], [ %answer.1, %for.inc ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.not10.i = icmp slt i32 %answer.024, 1
br i1 %cmp.not10.i, label %detect_int.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body
%zext = zext i32 %answer.024 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ 0, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
%7 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %7, %6
br i1 %cmp1.i, label %for.end.loopexit.split.loop.exit.i, label %for.inc.i
for.inc.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%8 = icmp eq i64 %indvars.iv.next.i, %zext
br i1 %8, label %if.then, label %for.body.i, !llvm.loop !95
for.end.loopexit.split.loop.exit.i: ; preds = %for.body.i
%9 = trunc i64 %indvars.iv.i to i32
br label %detect_int.exit
detect_int.exit: ; preds = %for.body, %for.end.loopexit.split.loop.exit.i
%i.0.lcssa.i = phi i32 [ 0, %for.body ], [ %9, %for.end.loopexit.split.loop.exit.i ]
%cmp3.not.i.not.not = icmp slt i32 %i.0.lcssa.i, %answer.024
br i1 %cmp3.not.i.not.not, label %for.inc, label %if.then
if.then: ; preds = %for.inc.i, %detect_int.exit
%idxprom5 = sext i32 %answer.024 to i64
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %idxprom5
store i32 %6, ptr %arrayidx6, align 4, !tbaa !5
%add = add nsw i32 %answer.024, 1
br label %for.inc
for.inc: ; preds = %detect_int.exit, %if.then
%answer.1 = phi i32 [ %add, %if.then ], [ %answer.024, %detect_int.exit ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %5, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !98
for.end: ; preds = %for.inc, %ini_int.exit
%answer.0.lcssa = phi i32 [ 0, %ini_int.exit ], [ %answer.1, %for.inc ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @count_equalelement_int(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max, i32 noundef %element) local_unnamed_addr #18 {
entry:
%cmp.not6 = icmp sgt i32 %min, %max
br i1 %cmp.not6, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
%2 = sub i32 %max, %min
%3 = zext i32 %2 to i64
%4 = add nuw nsw i64 %3, 1
%min.iters.check = icmp ult i32 %2, 7
br i1 %min.iters.check, label %for.body.preheader12, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %4, 8589934584
%ind.end = add nsw i64 %n.vec, %0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %element, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%invariant.gep = getelementptr i32, ptr %array, i64 %0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi10 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %gep, align 4, !tbaa !5
%5 = getelementptr inbounds i32, ptr %gep, i64 4
%wide.load11 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = icmp eq <4 x i32> %wide.load, %broadcast.splat
%7 = icmp eq <4 x i32> %wide.load11, %broadcast.splat
%8 = zext <4 x i1> %6 to <4 x i32>
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = add <4 x i32> %vec.phi, %8
%11 = add <4 x i32> %vec.phi10, %9
%index.next = add nuw i64 %index, 8
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !99
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %11, %10
%13 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader12
for.body.preheader12: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %0, %for.body.preheader ], [ %ind.end, %middle.block ]
%answer.08.ph = phi i32 [ 0, %for.body.preheader ], [ %13, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader12, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader12 ]
%answer.08 = phi i32 [ %spec.select, %for.body ], [ %answer.08.ph, %for.body.preheader12 ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%14 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %14, %element
%add = zext i1 %cmp1 to i32
%spec.select = add nuw nsw i32 %answer.08, %add
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !100
for.end: ; preds = %for.body, %middle.block, %entry
%answer.0.lcssa = phi i32 [ 0, %entry ], [ %13, %middle.block ], [ %spec.select, %for.body ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @count_equalelement_char(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max, i8 noundef signext %element) local_unnamed_addr #18 {
entry:
%cmp.not8 = icmp sgt i32 %min, %max
br i1 %cmp.not8, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
%2 = sub i32 %max, %min
%3 = zext i32 %2 to i64
%4 = add nuw nsw i64 %3, 1
%min.iters.check = icmp ult i32 %2, 7
br i1 %min.iters.check, label %for.body.preheader14, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %4, 8589934584
%ind.end = add nsw i64 %n.vec, %0
%broadcast.splatinsert = insertelement <4 x i8> poison, i8 %element, i64 0
%broadcast.splat = shufflevector <4 x i8> %broadcast.splatinsert, <4 x i8> poison, <4 x i32> zeroinitializer
%invariant.gep = getelementptr i8, ptr %array, i64 %0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi12 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%gep = getelementptr i8, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i8>, ptr %gep, align 1, !tbaa !9
%5 = getelementptr inbounds i8, ptr %gep, i64 4
%wide.load13 = load <4 x i8>, ptr %5, align 1, !tbaa !9
%6 = icmp eq <4 x i8> %wide.load, %broadcast.splat
%7 = icmp eq <4 x i8> %wide.load13, %broadcast.splat
%8 = zext <4 x i1> %6 to <4 x i32>
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = add <4 x i32> %vec.phi, %8
%11 = add <4 x i32> %vec.phi12, %9
%index.next = add nuw i64 %index, 8
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !101
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %11, %10
%13 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %4, %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 [ %0, %for.body.preheader ], [ %ind.end, %middle.block ]
%answer.010.ph = phi i32 [ 0, %for.body.preheader ], [ %13, %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 ]
%answer.010 = phi i32 [ %spec.select, %for.body ], [ %answer.010.ph, %for.body.preheader14 ]
%arrayidx = getelementptr inbounds i8, ptr %array, i64 %indvars.iv
%14 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %14, %element
%add = zext i1 %cmp2 to i32
%spec.select = add nuw nsw i32 %answer.010, %add
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !102
for.end: ; preds = %for.body, %middle.block, %entry
%answer.0.lcssa = phi i32 [ 0, %entry ], [ %13, %middle.block ], [ %spec.select, %for.body ]
ret i32 %answer.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @scanf_int_array(ptr noundef %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #7 {
entry:
%cmp.not3 = icmp sgt i32 %min, %max
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
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 %array, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !103
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #19
; Function Attrs: nofree nounwind uwtable
define dso_local void @scanf_int_array_2(ptr noundef %array1, ptr noundef %array2, i32 noundef %min, i32 noundef %max) local_unnamed_addr #7 {
entry:
%cmp.not6 = icmp sgt i32 %min, %max
br i1 %cmp.not6, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
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 %array1, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds i32, ptr %array2, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx, ptr noundef %arrayidx2)
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !104
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @scanf_int_array_3(ptr noundef %array1, ptr noundef %array2, ptr noundef %array3, i32 noundef %min, i32 noundef %max) local_unnamed_addr #7 {
entry:
%cmp.not9 = icmp sgt i32 %min, %max
br i1 %cmp.not9, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
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 %array1, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds i32, ptr %array2, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds i32, ptr %array3, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %arrayidx, ptr noundef %arrayidx2, ptr noundef %arrayidx4)
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !105
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @scanf_char_array(ptr noundef %array, i32 noundef %num) local_unnamed_addr #7 {
entry:
%array8 = ptrtoint ptr %array to i64
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %array)
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %array) #23
%0 = trunc i64 %call1 to i32
%conv = add i32 %0, -1
%cmp.not24.i = icmp slt i32 %conv, 0
br i1 %cmp.not24.i, label %for.cond3.preheader.i, label %iter.check
iter.check: ; preds = %entry
%1 = zext i32 %conv to i64
%2 = sext i32 %num to i64
%invariant.gep.i = getelementptr i8, ptr %array, i64 %2
%3 = add nuw nsw i64 %1, 1
%min.iters.check = icmp ult i32 %conv, 3
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %iter.check
%4 = getelementptr i8, ptr %array, i64 %2
%scevgep = getelementptr i8, ptr %4, i64 %1
%5 = icmp ugt ptr %4, %scevgep
%scevgep4 = getelementptr i8, ptr %array, i64 %1
%6 = icmp ult ptr %scevgep4, %array
%7 = or i1 %5, %6
br i1 %7, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %vector.scevcheck
%8 = add i64 %array8, %1
%9 = add i64 %array8, %2
%10 = add i64 %9, %1
%11 = sub i64 %8, %10
%diff.check = icmp ult i64 %11, 16
br i1 %diff.check, label %for.body.i.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.memcheck
%min.iters.check9 = icmp ult i32 %conv, 15
br i1 %min.iters.check9, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %3, 8589934576
%invariant.gep = getelementptr i8, ptr %array, i64 -15
%invariant.gep21 = getelementptr i8, ptr %invariant.gep.i, i64 -15
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = sub i64 %1, %index
%gep = getelementptr i8, ptr %invariant.gep, i64 %offset.idx
%wide.load = load <16 x i8>, ptr %gep, align 1, !tbaa !9
%gep22 = getelementptr i8, ptr %invariant.gep21, i64 %offset.idx
store <16 x i8> %wide.load, ptr %gep22, align 1, !tbaa !9
%index.next = add nuw i64 %index, 16
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !106
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.cond3.preheader.i, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%ind.end13 = sub nsw i64 %1, %n.vec
%n.vec.remaining = and i64 %3, 12
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body.i.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec12 = and i64 %3, 8589934588
%ind.end = sub nsw i64 %1, %n.vec12
%invariant.gep23 = getelementptr i8, ptr %array, i64 -3
%invariant.gep25 = getelementptr i8, ptr %invariant.gep.i, i64 -3
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index15 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next20, %vec.epilog.vector.body ]
%offset.idx16 = sub i64 %1, %index15
%gep24 = getelementptr i8, ptr %invariant.gep23, i64 %offset.idx16
%wide.load17 = load <4 x i8>, ptr %gep24, align 1, !tbaa !9
%gep26 = getelementptr i8, ptr %invariant.gep25, i64 %offset.idx16
store <4 x i8> %wide.load17, ptr %gep26, align 1, !tbaa !9
%index.next20 = add nuw i64 %index15, 4
%13 = icmp eq i64 %index.next20, %n.vec12
br i1 %13, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !107
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n14 = icmp eq i64 %3, %n.vec12
br i1 %cmp.n14, label %for.cond3.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.i.ph = phi i64 [ %1, %iter.check ], [ %1, %vector.memcheck ], [ %1, %vector.scevcheck ], [ %ind.end13, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
%14 = add nsw i64 %indvars.iv.i.ph, 1
%xtraiter = and i64 %14, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%arrayidx.i.prol = getelementptr inbounds i8, ptr %array, i64 %indvars.iv.i.prol
%15 = load i8, ptr %arrayidx.i.prol, align 1, !tbaa !9
%gep.i.prol = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
store i8 %15, ptr %gep.i.prol, align 1, !tbaa !9
%indvars.iv.next.i.prol = add nsw i64 %indvars.iv.i.prol, -1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !108
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%16 = icmp ult i64 %indvars.iv.i.ph, 3
br i1 %16, label %for.cond3.preheader.i, label %for.body.i
for.cond3.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %vec.epilog.middle.block, %entry
%cmp6.not.not26.i = icmp sgt i32 %num, 0
br i1 %cmp6.not.not26.i, label %for.body7.preheader.i, label %shift_char.exit
for.body7.preheader.i: ; preds = %for.cond3.preheader.i
%17 = zext i32 %num to i64
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %array, i8 0, i64 %17, i1 false), !tbaa !9
br label %shift_char.exit
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%arrayidx.i = getelementptr inbounds i8, ptr %array, i64 %indvars.iv.i
%18 = load i8, ptr %arrayidx.i, align 1, !tbaa !9
%gep.i = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.i
store i8 %18, ptr %gep.i, align 1, !tbaa !9
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %array, i64 %indvars.iv.next.i
%19 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !9
%gep.i.1 = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.next.i
store i8 %19, ptr %gep.i.1, align 1, !tbaa !9
%indvars.iv.next.i.1 = add nsw i64 %indvars.iv.i, -2
%arrayidx.i.2 = getelementptr inbounds i8, ptr %array, i64 %indvars.iv.next.i.1
%20 = load i8, ptr %arrayidx.i.2, align 1, !tbaa !9
%gep.i.2 = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
store i8 %20, ptr %gep.i.2, align 1, !tbaa !9
%indvars.iv.next.i.2 = add nsw i64 %indvars.iv.i, -3
%arrayidx.i.3 = getelementptr inbounds i8, ptr %array, i64 %indvars.iv.next.i.2
%21 = load i8, ptr %arrayidx.i.3, align 1, !tbaa !9
%gep.i.3 = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
store i8 %21, ptr %gep.i.3, align 1, !tbaa !9
%indvars.iv.next.i.3 = add nsw i64 %indvars.iv.i, -4
%cmp.not.not.i.not.3 = icmp eq i64 %indvars.iv.next.i.2, 0
br i1 %cmp.not.not.i.not.3, label %for.cond3.preheader.i, label %for.body.i, !llvm.loop !109
shift_char.exit: ; preds = %for.cond3.preheader.i, %for.body7.preheader.i
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @printf_char_array(ptr nocapture noundef readonly %array, i32 noundef %min, i32 noundef %max) local_unnamed_addr #7 {
entry:
%cmp.not3 = icmp sgt i32 %min, %max
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %min to i64
%1 = add i32 %max, 1
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 i8, ptr %array, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv = sext i8 %2 to i32
%putchar = tail call i32 @putchar(i32 %conv)
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %1, %lftr.wideiv
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !110
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #19
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%W = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #22
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #22
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #22
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %W, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %add, %2
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%sub = sub nsw i32 %2, %add
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %sub)
br label %if.end11
if.else: ; preds = %entry
%add3 = add nsw i32 %2, %1
%cmp4 = icmp slt i32 %add3, %0
br i1 %cmp4, label %if.then5, label %if.else9
if.then5: ; preds = %if.else
%sub7 = sub nsw i32 %0, %add3
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %sub7)
br label %if.end11
if.else9: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end11
if.end11: ; preds = %if.then5, %if.else9, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #22
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #22
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #22
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #20
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #20
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #21
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #21
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #21
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #21
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #21
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #21
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #21
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #21
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #21
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 nounwind willreturn memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 = { 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 #9 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { 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 #11 = { 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 #12 = { 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 #13 = { 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 #14 = { 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 #15 = { nofree 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 #16 = { 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 #17 = { 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 #18 = { 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 #19 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #20 = { nofree nounwind }
attributes #21 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #22 = { nounwind }
attributes #23 = { 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, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11, !23, !24}
!23 = !{!"llvm.loop.isvectorized", i32 1}
!24 = !{!"llvm.loop.unroll.runtime.disable"}
!25 = distinct !{!25, !11, !23}
!26 = !{!27}
!27 = distinct !{!27, !28}
!28 = distinct !{!28, !"LVerDomain"}
!29 = !{!30}
!30 = distinct !{!30, !28}
!31 = distinct !{!31, !11, !23, !24}
!32 = distinct !{!32, !11, !23}
!33 = !{!34}
!34 = distinct !{!34, !35}
!35 = distinct !{!35, !"LVerDomain"}
!36 = !{!37}
!37 = distinct !{!37, !35}
!38 = distinct !{!38, !11, !23, !24}
!39 = !{!40}
!40 = distinct !{!40, !41}
!41 = distinct !{!41, !"LVerDomain"}
!42 = !{!43}
!43 = distinct !{!43, !41}
!44 = distinct !{!44, !11, !23, !24}
!45 = distinct !{!45, !11, !23}
!46 = distinct !{!46, !11}
!47 = distinct !{!47, !11, !23, !24}
!48 = distinct !{!48, !11, !23, !24}
!49 = distinct !{!49, !11, !23}
!50 = distinct !{!50, !11, !23, !24}
!51 = distinct !{!51, !11, !23, !24}
!52 = distinct !{!52, !11, !24, !23}
!53 = distinct !{!53, !11}
!54 = distinct !{!54, !11}
!55 = distinct !{!55, !11}
!56 = distinct !{!56, !11}
!57 = distinct !{!57, !11}
!58 = !{!59}
!59 = distinct !{!59, !60}
!60 = distinct !{!60, !"LVerDomain"}
!61 = !{!62}
!62 = distinct !{!62, !60}
!63 = distinct !{!63, !11, !23, !24}
!64 = !{!65}
!65 = distinct !{!65, !66}
!66 = distinct !{!66, !"LVerDomain"}
!67 = !{!68}
!68 = distinct !{!68, !66}
!69 = distinct !{!69, !11, !23, !24}
!70 = distinct !{!70, !11, !23}
!71 = distinct !{!71, !11}
!72 = distinct !{!72, !11}
!73 = !{!74}
!74 = distinct !{!74, !75}
!75 = distinct !{!75, !"LVerDomain"}
!76 = !{!77}
!77 = distinct !{!77, !75}
!78 = distinct !{!78, !11, !23, !24}
!79 = !{!80}
!80 = distinct !{!80, !81}
!81 = distinct !{!81, !"LVerDomain"}
!82 = !{!83}
!83 = distinct !{!83, !81}
!84 = distinct !{!84, !11, !23, !24}
!85 = distinct !{!85, !11, !23}
!86 = distinct !{!86, !11}
!87 = distinct !{!87, !11, !23, !24}
!88 = distinct !{!88, !11, !24, !23}
!89 = distinct !{!89, !11, !23, !24}
!90 = distinct !{!90, !11, !24, !23}
!91 = distinct !{!91, !11}
!92 = distinct !{!92, !11}
!93 = distinct !{!93, !11, !23, !24}
!94 = distinct !{!94, !11, !24, !23}
!95 = distinct !{!95, !11}
!96 = distinct !{!96, !11}
!97 = distinct !{!97, !11}
!98 = distinct !{!98, !11}
!99 = distinct !{!99, !11, !23, !24}
!100 = distinct !{!100, !11, !24, !23}
!101 = distinct !{!101, !11, !23, !24}
!102 = distinct !{!102, !11, !24, !23}
!103 = distinct !{!103, !11}
!104 = distinct !{!104, !11}
!105 = distinct !{!105, !11}
!106 = distinct !{!106, !11, !23, !24}
!107 = distinct !{!107, !11, !23, !24}
!108 = distinct !{!108, !14}
!109 = distinct !{!109, !11, !23}
!110 = distinct !{!110, !11}
|
#include <stdio.h>
int main(){
int W, a, b;
scanf("%d %d %d", &W, &a, &b);
if(a + W < b){
printf("%d\n", b - (a + W));
}else if(a < b && b <= a + W){
printf("%d\n", 0);
}else if(a - W < b && b <= a){
printf("%d\n", 0);
}else if(b <= a - W){
printf("%d\n", a - (b + W));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283756/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283756/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%W = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %add, %2
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%sub = sub nsw i32 %2, %add
br label %if.end24
if.else: ; preds = %entry
%cmp3.not = icmp slt i32 %0, %2
%sub9 = sub nsw i32 %0, %1
%cmp10.not = icmp slt i32 %sub9, %2
%or.cond = select i1 %cmp3.not, i1 true, i1 %cmp10.not
br i1 %or.cond, label %if.end24, label %if.then18
if.then18: ; preds = %if.else
%3 = add i32 %1, %2
%sub20 = sub i32 %0, %3
br label %if.end24
if.end24: ; preds = %if.else, %if.then18, %if.then
%.sink = phi i32 [ %sub20, %if.then18 ], [ %sub, %if.then ], [ 0, %if.else ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #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) {
long long n,i,no,nc,f1,t,l;
char s[1000001];
scanf("%lld",&n);
scanf("%s",s);
no=0; nc=0;
for(i=0;i<n;i++)
{
if(s[i]=='(') no++;
else nc++;
}
if(no==nc)
{
no=0; nc=0; f1=0;
l=0; t=0;
for(i=0;i<n;i++)
{
if(s[i]=='(') no++;
else nc++;
if(nc>no)
{
f1=1;
l++;
}
if((f1==1)&&(no==nc))
{
t=t+l+1;
l=0;
f1=0;
}
}
printf("%lld\n",t);
}
else printf("-1\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2838/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2838/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%s = alloca [1000001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1000001, 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 i64, ptr %n, align 8, !tbaa !5
%cmp57 = icmp sgt i64 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end36
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %0, 4
br i1 %min.iters.check, label %for.body.preheader81, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -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> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi75 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi76 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi77 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [1000001 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <2 x i8>, ptr %1, align 4, !tbaa !9
%2 = getelementptr inbounds i8, ptr %1, i64 2
%wide.load78 = load <2 x i8>, ptr %2, align 2, !tbaa !9
%3 = icmp eq <2 x i8> %wide.load, <i8 40, i8 40>
%4 = icmp eq <2 x i8> %wide.load78, <i8 40, i8 40>
%5 = zext <2 x i1> %3 to <2 x i64>
%6 = zext <2 x i1> %4 to <2 x i64>
%7 = add <2 x i64> %vec.phi76, %5
%8 = add <2 x i64> %vec.phi77, %6
%9 = xor <2 x i1> %3, <i1 true, i1 true>
%10 = xor <2 x i1> %4, <i1 true, i1 true>
%11 = zext <2 x i1> %9 to <2 x i64>
%12 = zext <2 x i1> %10 to <2 x i64>
%13 = add <2 x i64> %vec.phi, %11
%14 = add <2 x i64> %vec.phi75, %12
%index.next = add nuw i64 %index, 4
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx79 = add <2 x i64> %8, %7
%16 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx79)
%bin.rdx = add <2 x i64> %14, %13
%17 = 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.end, label %for.body.preheader81
for.body.preheader81: ; preds = %for.body.preheader, %middle.block
%nc.060.ph = phi i64 [ 0, %for.body.preheader ], [ %17, %middle.block ]
%no.059.ph = phi i64 [ 0, %for.body.preheader ], [ %16, %middle.block ]
%i.058.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader81, %for.body
%nc.060 = phi i64 [ %nc.1, %for.body ], [ %nc.060.ph, %for.body.preheader81 ]
%no.059 = phi i64 [ %no.1, %for.body ], [ %no.059.ph, %for.body.preheader81 ]
%i.058 = phi i64 [ %inc5, %for.body ], [ %i.058.ph, %for.body.preheader81 ]
%arrayidx = getelementptr inbounds [1000001 x i8], ptr %s, i64 0, i64 %i.058
%18 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %18, 40
%inc = zext i1 %cmp2 to i64
%no.1 = add nuw nsw i64 %no.059, %inc
%not.cmp2 = xor i1 %cmp2, true
%inc4 = zext i1 %not.cmp2 to i64
%nc.1 = add nuw nsw i64 %nc.060, %inc4
%inc5 = add nuw nsw i64 %i.058, 1
%exitcond.not = icmp eq i64 %inc5, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %for.body, %middle.block
%no.1.lcssa = phi i64 [ %16, %middle.block ], [ %no.1, %for.body ]
%nc.1.lcssa = phi i64 [ %17, %middle.block ], [ %nc.1, %for.body ]
%cmp6 = icmp eq i64 %no.1.lcssa, %nc.1.lcssa
br i1 %cmp6, label %for.cond9.preheader, label %if.else38
for.cond9.preheader: ; preds = %for.end
br i1 %cmp57, label %for.body12, label %for.end36
for.body12: ; preds = %for.cond9.preheader, %for.inc34
%l.069 = phi i64 [ %l.2, %for.inc34 ], [ 0, %for.cond9.preheader ]
%t.068 = phi i64 [ %t.1, %for.inc34 ], [ 0, %for.cond9.preheader ]
%f1.067 = phi i64 [ %f1.2, %for.inc34 ], [ 0, %for.cond9.preheader ]
%nc.266 = phi i64 [ %nc.3, %for.inc34 ], [ 0, %for.cond9.preheader ]
%no.265 = phi i64 [ %no.3, %for.inc34 ], [ 0, %for.cond9.preheader ]
%i.164 = phi i64 [ %inc35, %for.inc34 ], [ 0, %for.cond9.preheader ]
%arrayidx13 = getelementptr inbounds [1000001 x i8], ptr %s, i64 0, i64 %i.164
%19 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%cmp15 = icmp eq i8 %19, 40
%inc18 = zext i1 %cmp15 to i64
%no.3 = add nuw nsw i64 %no.265, %inc18
%not.cmp15 = xor i1 %cmp15, true
%inc20 = zext i1 %not.cmp15 to i64
%nc.3 = add nuw nsw i64 %nc.266, %inc20
%cmp22 = icmp ugt i64 %nc.3, %no.3
%inc25 = zext i1 %cmp22 to i64
%l.1 = add nsw i64 %l.069, %inc25
%cmp2756 = icmp eq i64 %f1.067, 1
%cmp27 = or i1 %cmp2756, %cmp22
br i1 %cmp27, label %land.lhs.true, label %for.inc34
land.lhs.true: ; preds = %for.body12
%cmp29 = icmp eq i64 %no.3, %nc.3
br i1 %cmp29, label %if.then31, label %for.inc34
if.then31: ; preds = %land.lhs.true
%add = add i64 %t.068, 1
%add32 = add i64 %add, %l.1
br label %for.inc34
for.inc34: ; preds = %for.body12, %land.lhs.true, %if.then31
%f1.2 = phi i64 [ 0, %if.then31 ], [ 1, %land.lhs.true ], [ 0, %for.body12 ]
%t.1 = phi i64 [ %add32, %if.then31 ], [ %t.068, %land.lhs.true ], [ %t.068, %for.body12 ]
%l.2 = phi i64 [ 0, %if.then31 ], [ %l.1, %land.lhs.true ], [ %l.1, %for.body12 ]
%inc35 = add nuw nsw i64 %i.164, 1
%exitcond71.not = icmp eq i64 %inc35, %0
br i1 %exitcond71.not, label %for.end36, label %for.body12, !llvm.loop !15
for.end36: ; preds = %for.inc34, %entry, %for.cond9.preheader
%t.0.lcssa = phi i64 [ 0, %for.cond9.preheader ], [ 0, %entry ], [ %t.1, %for.inc34 ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %t.0.lcssa)
br label %if.end40
if.else38: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end40
if.end40: ; preds = %if.else38, %for.end36
call void @llvm.lifetime.end.p0(i64 1000001, ptr nonnull %s) #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 @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.vector.reduce.add.v2i64(<2 x i64>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
!15 = distinct !{!15, !11}
|
#include <stdio.h>
int main()
{
int w,a,b,c;
while(scanf("%d%d%d",&w,&a,&b)==3)
{
if(a>=b)
c=a-w-b;
else
c=b-w-a;
if(c>0)printf("%d\n",c);
else printf("0\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283842/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283842/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@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:
%w = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp20 = icmp eq i32 %call19, 3
br i1 %cmp20, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end10
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %w, align 4, !tbaa !5
%. = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%.23 = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%3 = add i32 %., %2
%sub4 = sub i32 %.23, %3
%cmp5 = icmp sgt i32 %sub4, 0
br i1 %cmp5, label %if.then6, label %if.else8
if.then6: ; preds = %while.body
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub4)
br label %if.end10
if.else8: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end10
if.end10: ; preds = %if.else8, %if.then6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp = icmp eq i32 %call, 3
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end10, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#define N 100
int main(){
int n, p[N+1], m[N+1][N+1], i, j, l, k;
scanf("%d",&n);
for( i = 1 ; i <= n ; i++ ) scanf("%d%d", &p[i-1], &p[i]);
for( i = 1 ; i <= n ; i++ ) m[i][i] = 0;
for( l = 2 ; l <= n ; l++ ){
for( i = 1 ; i <= n-l+1 ; i++ ){
j = i + l - 1;
m[i][j] = (1<<21);
for( k = i ; k <= j-1 ; k++ ){
if( m[i][j] > m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j] ) m[i][j] = m[i][k]+m[k+
1][j]+p[i-1]*p[k]*p[j];
}
}
}
printf("%d\n",m[1][n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283893/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283893/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [101 x i32], align 16
%m = alloca [101 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not127 = icmp slt i32 %0, 1
br i1 %cmp.not127, label %for.end87, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5.not129 = icmp slt i32 %6, 1
br i1 %cmp5.not129, label %for.end87, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%3 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
br i1 %4, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %2, -4
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%5 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv140.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next141.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil
for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil
%indvars.iv140.epil = phi i64 [ %indvars.iv.next141.epil, %for.body6.epil ], [ %indvars.iv140.unr, %for.cond14.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv140.epil, i64 %indvars.iv140.epil
store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5
%indvars.iv.next141.epil = add nuw nsw i64 %indvars.iv140.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11
for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa
%cmp15.not135 = icmp slt i32 %6, 2
br i1 %cmp15.not135, label %for.end87, label %for.cond17.preheader.lr.ph
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%sub18 = add nuw i32 %6, 1
%wide.trip.count166 = zext i32 %sub18 to i64
br label %for.cond17.preheader
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv140 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next141.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv140, i64 %indvars.iv140
store i32 0, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141, i64 %indvars.iv.next141
store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next141.1 = add nuw nsw i64 %indvars.iv140, 2
%arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141.1, i64 %indvars.iv.next141.1
store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5
%indvars.iv.next141.2 = add nuw nsw i64 %indvars.iv140, 3
%arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141.2, i64 %indvars.iv.next141.2
store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5
%indvars.iv.next141.3 = add nuw nsw i64 %indvars.iv140, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc85
%indvars.iv152 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next153, %for.inc85 ]
%indvars165 = trunc i64 %indvars.iv152 to i32
%add = sub i32 %sub18, %indvars165
%cmp19.not133 = icmp slt i32 %add, 1
br i1 %cmp19.not133, label %for.inc85, label %for.body30.lr.ph
for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc82
%indvars.iv154 = phi i64 [ %indvars.iv.next155, %for.inc82 ], [ %indvars.iv152, %for.cond17.preheader ]
%indvars.iv143 = phi i64 [ %indvars.iv.next144, %for.inc82 ], [ 1, %for.cond17.preheader ]
%8 = add nuw nsw i64 %indvars.iv143, %indvars.iv152
%9 = add nsw i64 %8, -1
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv143, i64 %9
store i32 2097152, ptr %arrayidx26, align 4, !tbaa !5
%10 = add nsw i64 %indvars.iv143, -1
%arrayidx47 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %10
%11 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%arrayidx51 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %9
%12 = load i32, ptr %arrayidx51, align 4, !tbaa !5
br label %for.body30
for.body30: ; preds = %for.body30.lr.ph, %for.inc79
%indvars.iv145 = phi i64 [ %indvars.iv143, %for.body30.lr.ph ], [ %indvars.iv.next146, %for.inc79 ]
%13 = phi i32 [ 2097152, %for.body30.lr.ph ], [ %17, %for.inc79 ]
%arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv143, i64 %indvars.iv145
%14 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%arrayidx43 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next146, i64 %9
%15 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%add44 = add nsw i32 %15, %14
%arrayidx49 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv145
%16 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%mul = mul nsw i32 %16, %11
%mul52 = mul nsw i32 %mul, %12
%add53 = add nsw i32 %add44, %mul52
%cmp54 = icmp sgt i32 %13, %add53
br i1 %cmp54, label %if.then, label %for.inc79
if.then: ; preds = %for.body30
store i32 %add53, ptr %arrayidx26, align 4, !tbaa !5
br label %for.inc79
for.inc79: ; preds = %for.body30, %if.then
%17 = phi i32 [ %13, %for.body30 ], [ %add53, %if.then ]
%exitcond151.not = icmp eq i64 %indvars.iv.next146, %indvars.iv154
br i1 %exitcond151.not, label %for.inc82, label %for.body30, !llvm.loop !14
for.inc82: ; preds = %for.inc79
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%exitcond164.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count166
br i1 %exitcond164.not, label %for.inc85, label %for.body30.lr.ph, !llvm.loop !15
for.inc85: ; preds = %for.inc82, %for.cond17.preheader
%indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
%exitcond167.not = icmp eq i64 %indvars.iv.next153, %wide.trip.count166
br i1 %exitcond167.not, label %for.end87, label %for.cond17.preheader, !llvm.loop !16
for.end87: ; preds = %for.inc85, %entry, %for.cond4.preheader, %for.cond14.preheader
%.lcssa170173 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc85 ]
%idxprom89 = sext i32 %.lcssa170173 to i64
%arrayidx90 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom89
%18 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%call91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
static const int N=100;
int main(){
int i,j,k,l,n,p[N+1],m[N+1][N+1];
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d%d",&p[i-1],&p[i]);
}
for(i=1;i<=n;i++)m[i][i]=0;
for(l=2;l<=n;l++){
for(i=1;i<=(n-l)+1;i++){
j=i+l-1;
m[i][j]=(1<<21);
for(k=i;k<=j-1;k++){
if(m[i][j]>m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j])
m[i][j]=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
}
}
}
printf("%d\n",m[1][n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_283936/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_283936/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%0 = tail call ptr @llvm.stacksave.p0()
%vla128 = alloca [101 x i32], align 16
%vla1129 = alloca [10201 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not130 = icmp slt i32 %1, 1
br i1 %cmp.not130, label %for.end88, label %for.body.preheader
for.body.preheader: ; preds = %entry
%invariant.gep179 = getelementptr i32, ptr %vla128, i64 -1
br label %for.body
for.cond5.preheader: ; preds = %for.body
%cmp6.not132 = icmp slt i32 %6, 1
br i1 %cmp6.not132, label %for.end88, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond5.preheader
%2 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%4 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %3, 3
%5 = icmp ult i64 %4, 3
br i1 %5, label %for.cond15.preheader.unr-lcssa, label %for.body7.preheader.new
for.body7.preheader.new: ; preds = %for.body7.preheader
%unroll_iter = and i64 %3, -4
br label %for.body7
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%gep180 = getelementptr i32, ptr %invariant.gep179, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds i32, ptr %vla128, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %gep180, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond15.preheader.unr-lcssa: ; preds = %for.body7, %for.body7.preheader
%indvars.iv145.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next146.3, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond15.preheader, label %for.body7.epil
for.body7.epil: ; preds = %for.cond15.preheader.unr-lcssa, %for.body7.epil
%indvars.iv145.epil = phi i64 [ %indvars.iv.next146.epil, %for.body7.epil ], [ %indvars.iv145.unr, %for.cond15.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body7.epil ], [ 0, %for.cond15.preheader.unr-lcssa ]
%8 = mul nuw nsw i64 %indvars.iv145.epil, 101
%arrayidx9.epil = getelementptr inbounds i32, ptr %vla1129, i64 %8
%arrayidx11.epil = getelementptr inbounds i32, ptr %arrayidx9.epil, i64 %indvars.iv145.epil
store i32 0, ptr %arrayidx11.epil, align 4, !tbaa !5
%indvars.iv.next146.epil = add nuw nsw i64 %indvars.iv145.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.cond15.preheader, label %for.body7.epil, !llvm.loop !11
for.cond15.preheader: ; preds = %for.body7.epil, %for.cond15.preheader.unr-lcssa
%cmp16.not140 = icmp slt i32 %6, 2
br i1 %cmp16.not140, label %for.end88, label %for.cond18.preheader.lr.ph
for.cond18.preheader.lr.ph: ; preds = %for.cond15.preheader
%sub19 = add nuw i32 %6, 1
%wide.trip.count171 = zext i32 %sub19 to i64
%invariant.gep181 = getelementptr i32, ptr %vla128, i64 -1
br label %for.cond18.preheader
for.body7: ; preds = %for.body7, %for.body7.preheader.new
%indvars.iv145 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next146.3, %for.body7 ]
%niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.3, %for.body7 ]
%9 = mul nuw nsw i64 %indvars.iv145, 101
%arrayidx9 = getelementptr inbounds i32, ptr %vla1129, i64 %9
%arrayidx11 = getelementptr inbounds i32, ptr %arrayidx9, i64 %indvars.iv145
store i32 0, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%10 = mul nuw nsw i64 %indvars.iv.next146, 101
%arrayidx9.1 = getelementptr inbounds i32, ptr %vla1129, i64 %10
%arrayidx11.1 = getelementptr inbounds i32, ptr %arrayidx9.1, i64 %indvars.iv.next146
store i32 0, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next146.1 = add nuw nsw i64 %indvars.iv145, 2
%11 = mul nuw nsw i64 %indvars.iv.next146.1, 101
%arrayidx9.2 = getelementptr inbounds i32, ptr %vla1129, i64 %11
%arrayidx11.2 = getelementptr inbounds i32, ptr %arrayidx9.2, i64 %indvars.iv.next146.1
store i32 0, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next146.2 = add nuw nsw i64 %indvars.iv145, 3
%12 = mul nuw nsw i64 %indvars.iv.next146.2, 101
%arrayidx9.3 = getelementptr inbounds i32, ptr %vla1129, i64 %12
%arrayidx11.3 = getelementptr inbounds i32, ptr %arrayidx9.3, i64 %indvars.iv.next146.2
store i32 0, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next146.3 = add nuw nsw i64 %indvars.iv145, 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.cond15.preheader.unr-lcssa, label %for.body7, !llvm.loop !13
for.cond18.preheader: ; preds = %for.cond18.preheader.lr.ph, %for.inc86
%indvars.iv157 = phi i64 [ 2, %for.cond18.preheader.lr.ph ], [ %indvars.iv.next158, %for.inc86 ]
%indvars170 = trunc i64 %indvars.iv157 to i32
%add = sub i32 %sub19, %indvars170
%cmp20.not138 = icmp slt i32 %add, 1
br i1 %cmp20.not138, label %for.inc86, label %for.body31.lr.ph
for.body31.lr.ph: ; preds = %for.cond18.preheader, %for.inc83
%indvars.iv159 = phi i64 [ %indvars.iv.next160, %for.inc83 ], [ %indvars.iv157, %for.cond18.preheader ]
%indvars.iv148 = phi i64 [ %indvars.iv.next149, %for.inc83 ], [ 1, %for.cond18.preheader ]
%13 = add nuw nsw i64 %indvars.iv148, %indvars.iv157
%14 = add nsw i64 %13, -1
%15 = mul nuw nsw i64 %indvars.iv148, 101
%arrayidx25 = getelementptr inbounds i32, ptr %vla1129, i64 %15
%arrayidx27 = getelementptr inbounds i32, ptr %arrayidx25, i64 %14
store i32 2097152, ptr %arrayidx27, align 4, !tbaa !5
%invariant.gep = getelementptr i32, ptr %vla1129, i64 %14
%gep182 = getelementptr i32, ptr %invariant.gep181, i64 %indvars.iv148
%16 = load i32, ptr %gep182, align 4, !tbaa !5
%arrayidx52 = getelementptr inbounds i32, ptr %vla128, i64 %14
%17 = load i32, ptr %arrayidx52, align 4, !tbaa !5
br label %for.body31
for.body31: ; preds = %for.body31.lr.ph, %for.inc80
%indvars.iv150 = phi i64 [ %indvars.iv148, %for.body31.lr.ph ], [ %indvars.iv.next151, %for.inc80 ]
%add54137 = phi i32 [ 2097152, %for.body31.lr.ph ], [ %add54136, %for.inc80 ]
%arrayidx39 = getelementptr inbounds i32, ptr %arrayidx25, i64 %indvars.iv150
%18 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1
%19 = mul nuw nsw i64 %indvars.iv.next151, 101
%gep = getelementptr i32, ptr %invariant.gep, i64 %19
%20 = load i32, ptr %gep, align 4, !tbaa !5
%add45 = add nsw i32 %20, %18
%arrayidx50 = getelementptr inbounds i32, ptr %vla128, i64 %indvars.iv150
%21 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%mul = mul nsw i32 %21, %16
%mul53 = mul nsw i32 %mul, %17
%add54 = add nsw i32 %add45, %mul53
%cmp55 = icmp sgt i32 %add54137, %add54
br i1 %cmp55, label %if.then, label %for.inc80
if.then: ; preds = %for.body31
store i32 %add54, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc80
for.inc80: ; preds = %for.body31, %if.then
%add54136 = phi i32 [ %add54137, %for.body31 ], [ %add54, %if.then ]
%exitcond156.not = icmp eq i64 %indvars.iv.next151, %indvars.iv159
br i1 %exitcond156.not, label %for.inc83, label %for.body31, !llvm.loop !14
for.inc83: ; preds = %for.inc80
%indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond169.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count171
br i1 %exitcond169.not, label %for.inc86, label %for.body31.lr.ph, !llvm.loop !15
for.inc86: ; preds = %for.inc83, %for.cond18.preheader
%indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
%exitcond172.not = icmp eq i64 %indvars.iv.next158, %wide.trip.count171
br i1 %exitcond172.not, label %for.end88, label %for.cond18.preheader, !llvm.loop !16
for.end88: ; preds = %for.inc86, %entry, %for.cond5.preheader, %for.cond15.preheader
%.lcssa175178 = phi i32 [ %6, %for.cond15.preheader ], [ %6, %for.cond5.preheader ], [ %1, %entry ], [ %6, %for.inc86 ]
%arrayidx89 = getelementptr inbounds i32, ptr %vla1129, i64 101
%idxprom90 = sext i32 %.lcssa175178 to i64
%arrayidx91 = getelementptr inbounds i32, ptr %arrayidx89, i64 %idxprom90
%22 = load i32, ptr %arrayidx91, align 4, !tbaa !5
%call92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
call void @llvm.stackrestore.p0(ptr %0)
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: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
void main(){
int ttt, nn, w, x, y, z;
scanf("%d", &ttt);
while(ttt--){
scanf("%d%d%d%d%d", &nn, &w, &x, &y, &z);
if(((((w-x)*nn)<=(y+z)) && ((w+x)*nn)>=(y-z)) ){
printf("YES\n");
}else {
printf("NO\n");
}
}
return;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28398/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28398/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"%d%d%d%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @main() local_unnamed_addr #0 {
entry:
%ttt = alloca i32, align 4
%nn = alloca i32, align 4
%w = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ttt) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nn) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #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 %z) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ttt)
%0 = load i32, ptr %ttt, align 4, !tbaa !5
%dec9 = add nsw i32 %0, -1
store i32 %dec9, ptr %ttt, align 4, !tbaa !5
%tobool.not10 = icmp eq i32 %0, 0
br i1 %tobool.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %nn, ptr noundef nonnull %w, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%1 = load i32, ptr %w, align 4, !tbaa !5
%2 = load i32, ptr %x, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
%3 = load i32, ptr %nn, align 4, !tbaa !5
%mul = mul nsw i32 %sub, %3
%4 = load i32, ptr %y, align 4, !tbaa !5
%5 = load i32, ptr %z, align 4, !tbaa !5
%add = add nsw i32 %5, %4
%cmp.not = icmp sgt i32 %mul, %add
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %while.body
%add2 = add nsw i32 %2, %1
%mul3 = mul nsw i32 %add2, %3
%sub4 = sub nsw i32 %4, %5
%cmp5.not = icmp slt i32 %mul3, %sub4
br i1 %cmp5.not, label %if.else, label %if.end
if.else: ; preds = %land.lhs.true, %while.body
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.4, %land.lhs.true ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%6 = load i32, ptr %ttt, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr %ttt, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nn) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ttt) #4
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int t,n,a,b,c,d;
scanf("%d",&t);
for(int i=0; i<t;i++)
{
scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
if((a-b)*n>=c-d&&(a-b)*n<=c+d)
{
printf("Yes\n");
}
else if((a-b)*n<(c-d)&&(a+b)*n>=(c-d))
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28408/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [15 x i8] c"%d %d %d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca 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 %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call 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 %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
for.body: ; preds = %entry, %for.inc
%i.026 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
%3 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %sub, %3
%4 = load i32, ptr %c, align 4, !tbaa !5
%5 = load i32, ptr %d, align 4, !tbaa !5
%sub2 = sub nsw i32 %4, %5
%cmp3.not = icmp slt i32 %mul, %sub2
%add = add nsw i32 %5, %4
%cmp6.not = icmp sgt i32 %mul, %add
%or.cond = select i1 %cmp3.not, i1 true, i1 %cmp6.not
br i1 %or.cond, label %if.else, label %for.inc
if.else: ; preds = %for.body
br i1 %cmp3.not, label %land.lhs.true12, label %if.else19
land.lhs.true12: ; preds = %if.else
%add13 = add nsw i32 %2, %1
%mul14 = mul nsw i32 %add13, %3
%cmp16.not = icmp slt i32 %mul14, %sub2
br i1 %cmp16.not, label %if.else19, label %for.inc
if.else19: ; preds = %land.lhs.true12, %if.else
br label %for.inc
for.inc: ; preds = %land.lhs.true12, %for.body, %if.else19
%str.5.sink = phi ptr [ @str, %if.else19 ], [ @str.5, %for.body ], [ @str.5, %land.lhs.true12 ]
%puts24 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink)
%inc = add nuw nsw i32 %i.026, 1
%6 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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>
#define INFTY 777777
int Min(int,int);
int MatrixChain(int);
int a[1000][1000],p[1000];
int main(){
int num,i;
scanf("%d",&num);
for(i = 1; i <= num; i++){
scanf("%d %d",&p[i-1],&p[i]);
}
MatrixChain(num);
printf("%d\n",a[1][num]);
return 0;
}
int Min(int x,int y){
if(x >= y)return y;
else return x;
}
int MatrixChain(int num){
int i,j,l,k;
for(i = 1; i <= num; i++){
a[i][i] = 0;
}
for(l = 2; l <= num; l++){
for(i = 1; i <=num; i++){
j = i + l - 1;
a[i][j] = INFTY;
for(k = i; k <= j; k++){
a[i][j] = Min(a[i][j], a[i][k] + a[k+1][j] + p[i-1]*p[k]*p[j]);
}
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284122/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284122/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@p = dso_local global [1000 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@a = dso_local local_unnamed_addr global [1000 x [1000 x i32]] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp.not11 = icmp slt i32 %0, 1
br i1 %cmp.not11, label %MatrixChain.exit, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%1 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [1000 x i32], ptr @p, i64 0, i64 %1
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr @p, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %num, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp.not77.i = icmp slt i32 %2, 1
br i1 %cmp.not77.i, label %MatrixChain.exit, label %for.body.preheader.i
for.body.preheader.i: ; preds = %for.end
%4 = add nuw nsw i32 %2, 1
%wide.trip.count.i = zext i32 %4 to i64
%5 = add nsw i64 %wide.trip.count.i, -1
%6 = add nsw i64 %wide.trip.count.i, -2
%xtraiter = and i64 %5, 3
%7 = icmp ult i64 %6, 3
br i1 %7, label %for.cond3.preheader.i.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = and i64 %5, -4
br label %for.body.i
for.cond3.preheader.i.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i.unr = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond3.preheader.i, label %for.body.i.epil
for.body.i.epil: ; preds = %for.cond3.preheader.i.unr-lcssa, %for.body.i.epil
%indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %for.cond3.preheader.i.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %for.cond3.preheader.i.unr-lcssa ]
%arrayidx2.i.epil = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.i.epil, i64 %indvars.iv.i.epil
store i32 0, ptr %arrayidx2.i.epil, align 4, !tbaa !5
%indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.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.cond3.preheader.i, label %for.body.i.epil, !llvm.loop !11
for.cond3.preheader.i: ; preds = %for.body.i.epil, %for.cond3.preheader.i.unr-lcssa
%cmp4.not83.i = icmp slt i32 %2, 2
br i1 %cmp4.not83.i, label %MatrixChain.exit, label %for.cond6.preheader.preheader.i
for.cond6.preheader.preheader.i: ; preds = %for.cond3.preheader.i
%8 = add nuw i32 %2, 3
br label %for.cond6.preheader.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new
%indvars.iv.i = phi i64 [ 1, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ]
%arrayidx2.i = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.i, i64 %indvars.iv.i
store i32 0, ptr %arrayidx2.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx2.i.1 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.next.i, i64 %indvars.iv.next.i
store i32 0, ptr %arrayidx2.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%arrayidx2.i.2 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.next.i.1, i64 %indvars.iv.next.i.1
store i32 0, ptr %arrayidx2.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%arrayidx2.i.3 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.next.i.2, i64 %indvars.iv.next.i.2
store i32 0, ptr %arrayidx2.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 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.cond3.preheader.i.unr-lcssa, label %for.body.i, !llvm.loop !13
for.cond6.preheader.i: ; preds = %for.cond6.for.inc49_crit_edge.i, %for.cond6.preheader.preheader.i
%indvars.iv112.i = phi i64 [ 2, %for.cond6.preheader.preheader.i ], [ %indvars.iv.next113.i, %for.cond6.for.inc49_crit_edge.i ]
%indvars.iv108.i = phi i32 [ %8, %for.cond6.preheader.preheader.i ], [ %indvars.iv.next109.i, %for.cond6.for.inc49_crit_edge.i ]
%indvars.iv98.i = phi i64 [ 3, %for.cond6.preheader.preheader.i ], [ %indvars.iv.next99.i, %for.cond6.for.inc49_crit_edge.i ]
%wide.trip.count110.i = zext i32 %indvars.iv108.i to i64
%9 = add nsw i64 %indvars.iv112.i, -1
br label %for.body8.i
for.body8.i: ; preds = %for.inc46.i, %for.cond6.preheader.i
%indvars.iv100.i = phi i64 [ %indvars.iv98.i, %for.cond6.preheader.i ], [ %indvars.iv.next101.i, %for.inc46.i ]
%indvars.iv87.i = phi i64 [ 1, %for.cond6.preheader.i ], [ %indvars.iv.next88.i, %for.inc46.i ]
%10 = add nuw i64 %9, %indvars.iv87.i
%arrayidx12.i = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv87.i, i64 %10
%11 = add nsw i64 %indvars.iv87.i, -1
%arrayidx32.i = getelementptr inbounds [1000 x i32], ptr @p, i64 0, i64 %11
%12 = load i32, ptr %arrayidx32.i, align 4, !tbaa !5
%arrayidx36.i = getelementptr inbounds [1000 x i32], ptr @p, i64 0, i64 %10
%13 = load i32, ptr %arrayidx36.i, align 4, !tbaa !5
store i32 777777, ptr %arrayidx12.i, align 4, !tbaa !5
%mul.i = mul i32 %13, %12
br label %for.body15.i
for.body15.i: ; preds = %for.body15.i, %for.body8.i
%indvars.iv89.i = phi i64 [ %indvars.iv87.i, %for.body8.i ], [ %indvars.iv.next90.i, %for.body15.i ]
%storemerge79.i = phi i32 [ 777777, %for.body8.i ], [ %x.y.i.i, %for.body15.i ]
%arrayidx23.i = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv87.i, i64 %indvars.iv89.i
%14 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%indvars.iv.next90.i = add nuw nsw i64 %indvars.iv89.i, 1
%arrayidx28.i = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.next90.i, i64 %10
%15 = load i32, ptr %arrayidx28.i, align 4, !tbaa !5
%add29.i = add nsw i32 %15, %14
%arrayidx34.i = getelementptr inbounds [1000 x i32], ptr @p, i64 0, i64 %indvars.iv89.i
%16 = load i32, ptr %arrayidx34.i, align 4, !tbaa !5
%mul37.i = mul i32 %mul.i, %16
%add38.i = add nsw i32 %add29.i, %mul37.i
%x.y.i.i = call i32 @llvm.smin.i32(i32 %storemerge79.i, i32 %add38.i)
store i32 %x.y.i.i, ptr %arrayidx12.i, align 4, !tbaa !5
%exitcond97.not.i = icmp eq i64 %indvars.iv.next90.i, %indvars.iv100.i
br i1 %exitcond97.not.i, label %for.inc46.i, label %for.body15.i, !llvm.loop !14
for.inc46.i: ; preds = %for.body15.i
%indvars.iv.next88.i = add nuw nsw i64 %indvars.iv87.i, 1
%indvars.iv.next101.i = add nuw nsw i64 %indvars.iv100.i, 1
%exitcond111.not.i = icmp eq i64 %indvars.iv.next101.i, %wide.trip.count110.i
br i1 %exitcond111.not.i, label %for.cond6.for.inc49_crit_edge.i, label %for.body8.i, !llvm.loop !15
for.cond6.for.inc49_crit_edge.i: ; preds = %for.inc46.i
%indvars.iv.next113.i = add nuw nsw i64 %indvars.iv112.i, 1
%indvars.iv.next99.i = add nuw nsw i64 %indvars.iv98.i, 1
%indvars.iv.next109.i = add i32 %indvars.iv108.i, 1
%exitcond118.not.i = icmp eq i64 %indvars.iv.next113.i, %wide.trip.count.i
br i1 %exitcond118.not.i, label %MatrixChain.exit, label %for.cond6.preheader.i, !llvm.loop !16
MatrixChain.exit: ; preds = %for.cond6.for.inc49_crit_edge.i, %entry, %for.end, %for.cond3.preheader.i
%.lcssa18 = phi i32 [ %2, %for.end ], [ %2, %for.cond3.preheader.i ], [ %0, %entry ], [ %2, %for.cond6.for.inc49_crit_edge.i ]
%idxprom5 = sext i32 %.lcssa18 to i64
%arrayidx6 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 1, i64 %idxprom5
%17 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @MatrixChain(i32 noundef %num) local_unnamed_addr #3 {
entry:
%cmp.not77 = icmp slt i32 %num, 1
br i1 %cmp.not77, label %for.end51, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = add nuw i32 %num, 1
%wide.trip.count = zext i32 %0 to i64
%1 = add nsw i64 %wide.trip.count, -1
%2 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %1, 3
%3 = icmp ult i64 %2, 3
br i1 %3, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %1, -4
br label %for.body
for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ]
%arrayidx2.epil = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil
store i32 0, ptr %arrayidx2.epil, align 4, !tbaa !5
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !17
for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa
%cmp4.not83 = icmp slt i32 %num, 2
br i1 %cmp4.not83, label %for.end51, label %for.cond6.preheader.preheader
for.cond6.preheader.preheader: ; preds = %for.cond3.preheader
%4 = add nuw i32 %num, 3
%5 = add nuw i32 %num, 1
%wide.trip.count117 = zext i32 %5 to i64
br label %for.cond6.preheader
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx2 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv, i64 %indvars.iv
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2.1 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next
store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx2.2 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1
store i32 0, ptr %arrayidx2.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx2.3 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2
store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.cond6.for.inc49_crit_edge
%indvars.iv112 = phi i64 [ 2, %for.cond6.preheader.preheader ], [ %indvars.iv.next113, %for.cond6.for.inc49_crit_edge ]
%indvars.iv108 = phi i32 [ %4, %for.cond6.preheader.preheader ], [ %indvars.iv.next109, %for.cond6.for.inc49_crit_edge ]
%indvars.iv98 = phi i64 [ 3, %for.cond6.preheader.preheader ], [ %indvars.iv.next99, %for.cond6.for.inc49_crit_edge ]
%wide.trip.count110 = zext i32 %indvars.iv108 to i64
br label %for.body8
for.body8: ; preds = %for.cond6.preheader, %for.inc46
%indvars.iv100 = phi i64 [ %indvars.iv98, %for.cond6.preheader ], [ %indvars.iv.next101, %for.inc46 ]
%indvars.iv87 = phi i64 [ 1, %for.cond6.preheader ], [ %indvars.iv.next88, %for.inc46 ]
%6 = add nuw nsw i64 %indvars.iv87, %indvars.iv112
%7 = add nsw i64 %6, -1
%arrayidx12 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv87, i64 %7
%8 = add nsw i64 %indvars.iv87, -1
%arrayidx32 = getelementptr inbounds [1000 x i32], ptr @p, i64 0, i64 %8
%9 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%arrayidx36 = getelementptr inbounds [1000 x i32], ptr @p, i64 0, i64 %7
%10 = load i32, ptr %arrayidx36, align 4, !tbaa !5
store i32 777777, ptr %arrayidx12, align 4, !tbaa !5
br label %for.body15
for.body15: ; preds = %for.body8, %for.body15
%indvars.iv89 = phi i64 [ %indvars.iv87, %for.body8 ], [ %indvars.iv.next90, %for.body15 ]
%storemerge79 = phi i32 [ 777777, %for.body8 ], [ %x.y.i, %for.body15 ]
%arrayidx23 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv87, i64 %indvars.iv89
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%arrayidx28 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv.next90, i64 %7
%12 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%add29 = add nsw i32 %12, %11
%arrayidx34 = getelementptr inbounds [1000 x i32], ptr @p, i64 0, i64 %indvars.iv89
%13 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%mul = mul nsw i32 %13, %9
%mul37 = mul nsw i32 %mul, %10
%add38 = add nsw i32 %add29, %mul37
%x.y.i = tail call i32 @llvm.smin.i32(i32 %storemerge79, i32 %add38)
store i32 %x.y.i, ptr %arrayidx12, align 4, !tbaa !5
%exitcond97.not = icmp eq i64 %indvars.iv.next90, %indvars.iv100
br i1 %exitcond97.not, label %for.inc46, label %for.body15, !llvm.loop !14
for.inc46: ; preds = %for.body15
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%exitcond111.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count110
br i1 %exitcond111.not, label %for.cond6.for.inc49_crit_edge, label %for.body8, !llvm.loop !15
for.cond6.for.inc49_crit_edge: ; preds = %for.inc46
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%indvars.iv.next109 = add i32 %indvars.iv108, 1
%exitcond118.not = icmp eq i64 %indvars.iv.next113, %wide.trip.count117
br i1 %exitcond118.not, label %for.end51, label %for.cond6.preheader, !llvm.loop !16
for.end51: ; preds = %for.cond6.for.inc49_crit_edge, %entry, %for.cond3.preheader
ret i32 undef
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @Min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #4 {
entry:
%x.y = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %x.y
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !12}
|
#include <stdio.h>
int main(){
int l,k,j,array1[101],array2[101][101];
int num,i;
scanf("%d",&num);
for(i = 1;i <= num;i++){
scanf("%d%d",&array1[i-1],&array1[i]);
}
for(i = 1; i <= num;i++){
array2[i][i] = 0;
}
for(k = 2;k <= num;k++){
for(i = 1;i <= num - k + 1;i++){
j = i + k - 1;
array2[i][j]=(1<<21);
for(l = i;l <= j - 1;l++){
if(array2[i][j] > array2[i][l] + array2[l+1][j] + array1[i-1] * array1[l] * array1[j]){
array2[i][j] = array2[i][l] + array2[l+1][j] + array1[i-1] * array1[l] * array1[j];
}
}
}
}
printf("%d\n",array2[1][num]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284173/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284173/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%array1 = alloca [101 x i32], align 16
%array2 = alloca [101 x [101 x i32]], align 16
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %array1) #3
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %array2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp.not127 = icmp slt i32 %0, 1
br i1 %cmp.not127, label %for.end87, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5.not129 = icmp slt i32 %6, 1
br i1 %cmp5.not129, label %for.end87, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%3 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
br i1 %4, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %2, -4
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%5 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %array1, i64 0, i64 %5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %array1, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %num, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv140.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next141.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil
for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil
%indvars.iv140.epil = phi i64 [ %indvars.iv.next141.epil, %for.body6.epil ], [ %indvars.iv140.unr, %for.cond14.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv140.epil, i64 %indvars.iv140.epil
store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5
%indvars.iv.next141.epil = add nuw nsw i64 %indvars.iv140.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11
for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa
%cmp15.not135 = icmp slt i32 %6, 2
br i1 %cmp15.not135, label %for.end87, label %for.cond17.preheader.lr.ph
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%sub18 = add nuw i32 %6, 1
%wide.trip.count166 = zext i32 %sub18 to i64
br label %for.cond17.preheader
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv140 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next141.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv140, i64 %indvars.iv140
store i32 0, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv.next141, i64 %indvars.iv.next141
store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next141.1 = add nuw nsw i64 %indvars.iv140, 2
%arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv.next141.1, i64 %indvars.iv.next141.1
store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5
%indvars.iv.next141.2 = add nuw nsw i64 %indvars.iv140, 3
%arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv.next141.2, i64 %indvars.iv.next141.2
store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5
%indvars.iv.next141.3 = add nuw nsw i64 %indvars.iv140, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc85
%indvars.iv152 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next153, %for.inc85 ]
%indvars165 = trunc i64 %indvars.iv152 to i32
%add = sub i32 %sub18, %indvars165
%cmp19.not133 = icmp slt i32 %add, 1
br i1 %cmp19.not133, label %for.inc85, label %for.body30.lr.ph
for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc82
%indvars.iv154 = phi i64 [ %indvars.iv.next155, %for.inc82 ], [ %indvars.iv152, %for.cond17.preheader ]
%indvars.iv143 = phi i64 [ %indvars.iv.next144, %for.inc82 ], [ 1, %for.cond17.preheader ]
%8 = add nuw nsw i64 %indvars.iv143, %indvars.iv152
%9 = add nsw i64 %8, -1
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv143, i64 %9
store i32 2097152, ptr %arrayidx26, align 4, !tbaa !5
%10 = add nsw i64 %indvars.iv143, -1
%arrayidx47 = getelementptr inbounds [101 x i32], ptr %array1, i64 0, i64 %10
%11 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%arrayidx51 = getelementptr inbounds [101 x i32], ptr %array1, i64 0, i64 %9
%12 = load i32, ptr %arrayidx51, align 4, !tbaa !5
br label %for.body30
for.body30: ; preds = %for.body30.lr.ph, %for.inc79
%indvars.iv145 = phi i64 [ %indvars.iv143, %for.body30.lr.ph ], [ %indvars.iv.next146, %for.inc79 ]
%13 = phi i32 [ 2097152, %for.body30.lr.ph ], [ %17, %for.inc79 ]
%arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv143, i64 %indvars.iv145
%14 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%arrayidx43 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 %indvars.iv.next146, i64 %9
%15 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%add44 = add nsw i32 %15, %14
%arrayidx49 = getelementptr inbounds [101 x i32], ptr %array1, i64 0, i64 %indvars.iv145
%16 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%mul = mul nsw i32 %16, %11
%mul52 = mul nsw i32 %mul, %12
%add53 = add nsw i32 %add44, %mul52
%cmp54 = icmp sgt i32 %13, %add53
br i1 %cmp54, label %if.then, label %for.inc79
if.then: ; preds = %for.body30
store i32 %add53, ptr %arrayidx26, align 4, !tbaa !5
br label %for.inc79
for.inc79: ; preds = %for.body30, %if.then
%17 = phi i32 [ %13, %for.body30 ], [ %add53, %if.then ]
%exitcond151.not = icmp eq i64 %indvars.iv.next146, %indvars.iv154
br i1 %exitcond151.not, label %for.inc82, label %for.body30, !llvm.loop !14
for.inc82: ; preds = %for.inc79
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%exitcond164.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count166
br i1 %exitcond164.not, label %for.inc85, label %for.body30.lr.ph, !llvm.loop !15
for.inc85: ; preds = %for.inc82, %for.cond17.preheader
%indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
%exitcond167.not = icmp eq i64 %indvars.iv.next153, %wide.trip.count166
br i1 %exitcond167.not, label %for.end87, label %for.cond17.preheader, !llvm.loop !16
for.end87: ; preds = %for.inc85, %entry, %for.cond4.preheader, %for.cond14.preheader
%.lcssa170173 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc85 ]
%idxprom89 = sext i32 %.lcssa170173 to i64
%arrayidx90 = getelementptr inbounds [101 x [101 x i32]], ptr %array2, i64 0, i64 1, i64 %idxprom89
%18 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%call91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %array2) #3
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %array1) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
#include<string.h>
int main()
{
int n,p[101],m[101][101],i,j,k,l;
scanf("%d",&n);
for(i = 1; i <= n; i++) {
scanf("%d %d",&p[i-1],&p[i]);
}
for (i = 0; i<= n; i++) {
m[i][i] = 0;
}
for (l = 2; l <= n; l++) {
for (i = 1; i <= n-l+1; i++) {
j = i + l - 1;
m[i][j] = 10000000;
for (k = i; k <= j-1; k++) {
if (m[i][j] > m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]) {
m[i][j] = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
}
}
}
}
printf("%d\n",m[1][n]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284216/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284216/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [101 x i32], align 16
%m = alloca [101 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not127 = icmp slt i32 %0, 1
br i1 %cmp.not127, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %4, %for.body ]
%cmp5.not129 = icmp slt i32 %.lcssa, 0
br i1 %cmp5.not129, label %for.end87, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = add nuw i32 %.lcssa, 1
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 3
%2 = icmp ult i32 %.lcssa, 3
br i1 %2, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%3 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %3
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%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.cond4.preheader, !llvm.loop !9
for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv140.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next141.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil
for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil
%indvars.iv140.epil = phi i64 [ %indvars.iv.next141.epil, %for.body6.epil ], [ %indvars.iv140.unr, %for.cond14.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv140.epil, i64 %indvars.iv140.epil
store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5
%indvars.iv.next141.epil = add nuw nsw i64 %indvars.iv140.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11
for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa
%cmp15.not135 = icmp slt i32 %.lcssa, 2
br i1 %cmp15.not135, label %for.end87, label %for.cond17.preheader.lr.ph
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%sub18 = add nuw i32 %.lcssa, 1
%wide.trip.count166 = zext i32 %sub18 to i64
br label %for.cond17.preheader
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv140 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next141.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv140, i64 %indvars.iv140
store i32 0, ptr %arrayidx10, align 16, !tbaa !5
%indvars.iv.next141 = or i64 %indvars.iv140, 1
%arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141, i64 %indvars.iv.next141
store i32 0, ptr %arrayidx10.1, align 8, !tbaa !5
%indvars.iv.next141.1 = or i64 %indvars.iv140, 2
%arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141.1, i64 %indvars.iv.next141.1
store i32 0, ptr %arrayidx10.2, align 16, !tbaa !5
%indvars.iv.next141.2 = or i64 %indvars.iv140, 3
%arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141.2, i64 %indvars.iv.next141.2
store i32 0, ptr %arrayidx10.3, align 8, !tbaa !5
%indvars.iv.next141.3 = add nuw nsw i64 %indvars.iv140, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc85
%indvars.iv152 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next153, %for.inc85 ]
%indvars165 = trunc i64 %indvars.iv152 to i32
%add = sub i32 %sub18, %indvars165
%cmp19.not133 = icmp slt i32 %add, 1
br i1 %cmp19.not133, label %for.inc85, label %for.body30.lr.ph
for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc82
%indvars.iv154 = phi i64 [ %indvars.iv.next155, %for.inc82 ], [ %indvars.iv152, %for.cond17.preheader ]
%indvars.iv143 = phi i64 [ %indvars.iv.next144, %for.inc82 ], [ 1, %for.cond17.preheader ]
%6 = add nuw nsw i64 %indvars.iv143, %indvars.iv152
%7 = add nsw i64 %6, -1
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv143, i64 %7
store i32 10000000, ptr %arrayidx26, align 4, !tbaa !5
%8 = add nsw i64 %indvars.iv143, -1
%arrayidx47 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %8
%9 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%arrayidx51 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %7
%10 = load i32, ptr %arrayidx51, align 4, !tbaa !5
br label %for.body30
for.body30: ; preds = %for.body30.lr.ph, %for.inc79
%indvars.iv145 = phi i64 [ %indvars.iv143, %for.body30.lr.ph ], [ %indvars.iv.next146, %for.inc79 ]
%11 = phi i32 [ 10000000, %for.body30.lr.ph ], [ %15, %for.inc79 ]
%arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv143, i64 %indvars.iv145
%12 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%arrayidx43 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next146, i64 %7
%13 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%add44 = add nsw i32 %13, %12
%arrayidx49 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv145
%14 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%mul = mul nsw i32 %14, %9
%mul52 = mul nsw i32 %mul, %10
%add53 = add nsw i32 %add44, %mul52
%cmp54 = icmp sgt i32 %11, %add53
br i1 %cmp54, label %if.then, label %for.inc79
if.then: ; preds = %for.body30
store i32 %add53, ptr %arrayidx26, align 4, !tbaa !5
br label %for.inc79
for.inc79: ; preds = %for.body30, %if.then
%15 = phi i32 [ %11, %for.body30 ], [ %add53, %if.then ]
%exitcond151.not = icmp eq i64 %indvars.iv.next146, %indvars.iv154
br i1 %exitcond151.not, label %for.inc82, label %for.body30, !llvm.loop !14
for.inc82: ; preds = %for.inc79
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%exitcond164.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count166
br i1 %exitcond164.not, label %for.inc85, label %for.body30.lr.ph, !llvm.loop !15
for.inc85: ; preds = %for.inc82, %for.cond17.preheader
%indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
%exitcond167.not = icmp eq i64 %indvars.iv.next153, %wide.trip.count166
br i1 %exitcond167.not, label %for.end87, label %for.cond17.preheader, !llvm.loop !16
for.end87: ; preds = %for.inc85, %for.cond4.preheader, %for.cond14.preheader
%idxprom89 = sext i32 %.lcssa to i64
%arrayidx90 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom89
%16 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%call91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int a,b,c,d;
int n;
scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
int mi1=a-b;
int mi2=a+b;
int bao1=c-d;
int bao2=c+d;
if(mi2*n<bao1||mi1*n>bao2)
printf("NO\n");
else
printf("YES\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28426/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28426/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"%d%d%d%d%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec9 = add nsw i32 %0, -1
store i32 %dec9, ptr %t, align 4, !tbaa !5
%tobool.not10 = icmp eq i32 %0, 0
br i1 %tobool.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%3 = load i32, ptr %c, align 4, !tbaa !5
%4 = load i32, ptr %d, align 4, !tbaa !5
%sub2 = sub nsw i32 %3, %4
%5 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %5, %add
%cmp = icmp slt i32 %mul, %sub2
br i1 %cmp, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %while.body
%add3 = add nsw i32 %4, %3
%sub = sub nsw i32 %1, %2
%mul4 = mul nsw i32 %5, %sub
%cmp5 = icmp sgt i32 %mul4, %add3
%spec.select = select i1 %cmp5, ptr @str.4, ptr @str
br label %if.end
if.end: ; preds = %lor.lhs.false, %while.body
%str.sink = phi ptr [ @str.4, %while.body ], [ %spec.select, %lor.lhs.false ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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
%6 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<limits.h>
#define MAX 101
void MatrixChain();
int n,p[MAX],M[MAX][MAX];
int main(){
int i;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d%d",&p[i-1],&p[i]);
}
MatrixChain();
printf("%d\n",M[1][n]);
return 0;
}
void MatrixChain(){
int i,j,k,l,q;
for(i=1;i<n;i++) M[i][i]=0;
for(l=2;l<=n;l++){
for(i=1;i<=n-l+1;i++){
j=i+l-1;
M[i][j] = INT_MAX;
for(k=i;k<j;k++){
q=M[i][k]+M[k+1][j]+p[i-1]*p[k]*p[j];
if(q<M[i][j]) M[i][j]=q;
}
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284302/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@p = dso_local global [101 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@M = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
; 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)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not10 = icmp slt i32 %0, 1
br i1 %cmp.not10, label %MatrixChain.exit, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%1 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %1
%arrayidx2 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr @n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp80.i = icmp sgt i32 %2, 1
br i1 %cmp80.i, label %for.body.preheader.i, label %MatrixChain.exit
for.body.preheader.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %2 to i64
%4 = add nsw i64 %wide.trip.count.i, -1
%5 = add nsw i64 %wide.trip.count.i, -2
%xtraiter = and i64 %4, 3
%6 = icmp ult i64 %5, 3
br i1 %6, label %for.cond6.preheader.lr.ph.i.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = and i64 %4, -4
br label %for.body.i
for.cond6.preheader.lr.ph.i.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i.unr = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond6.preheader.lr.ph.i, label %for.body.i.epil
for.body.i.epil: ; preds = %for.cond6.preheader.lr.ph.i.unr-lcssa, %for.body.i.epil
%indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %for.cond6.preheader.lr.ph.i.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %for.cond6.preheader.lr.ph.i.unr-lcssa ]
%arrayidx2.i.epil = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.i.epil, i64 %indvars.iv.i.epil
store i32 0, ptr %arrayidx2.i.epil, align 4, !tbaa !5
%indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.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.cond6.preheader.lr.ph.i, label %for.body.i.epil, !llvm.loop !11
for.cond6.preheader.lr.ph.i: ; preds = %for.body.i.epil, %for.cond6.preheader.lr.ph.i.unr-lcssa
%sub.i = add nuw i32 %2, 1
%wide.trip.count111.i = zext i32 %sub.i to i64
br label %for.cond6.preheader.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new
%indvars.iv.i = phi i64 [ 1, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ]
%arrayidx2.i = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.i, i64 %indvars.iv.i
store i32 0, ptr %arrayidx2.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx2.i.1 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.i, i64 %indvars.iv.next.i
store i32 0, ptr %arrayidx2.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%arrayidx2.i.2 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.i.1, i64 %indvars.iv.next.i.1
store i32 0, ptr %arrayidx2.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%arrayidx2.i.3 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.i.2, i64 %indvars.iv.next.i.2
store i32 0, ptr %arrayidx2.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 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.cond6.preheader.lr.ph.i.unr-lcssa, label %for.body.i, !llvm.loop !13
for.cond6.preheader.i: ; preds = %for.inc52.i, %for.cond6.preheader.lr.ph.i
%indvars.iv98.i = phi i64 [ 2, %for.cond6.preheader.lr.ph.i ], [ %indvars.iv.next99.i, %for.inc52.i ]
%indvars110.i = trunc i64 %indvars.iv98.i to i32
%add.i = sub i32 %sub.i, %indvars110.i
%cmp7.not84.i = icmp slt i32 %add.i, 1
br i1 %cmp7.not84.i, label %for.inc52.i, label %for.body8.lr.ph.i
for.body8.lr.ph.i: ; preds = %for.cond6.preheader.i
%7 = add nuw nsw i64 %indvars.iv98.i, 4294967295
br label %for.body8.i
for.body8.i: ; preds = %for.inc49.i, %for.body8.lr.ph.i
%indvars.iv100.i = phi i64 [ %indvars.iv98.i, %for.body8.lr.ph.i ], [ %indvars.iv.next101.i, %for.inc49.i ]
%indvars.iv89.i = phi i64 [ 1, %for.body8.lr.ph.i ], [ %indvars.iv.next90.i, %for.inc49.i ]
%8 = add nuw i64 %7, %indvars.iv89.i
%sext.i = shl i64 %8, 32
%idxprom13.i = ashr exact i64 %sext.i, 32
%arrayidx14.i = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv89.i, i64 %idxprom13.i
store i32 2147483647, ptr %arrayidx14.i, align 4, !tbaa !5
%cmp1682.i = icmp slt i64 %indvars.iv89.i, %idxprom13.i
br i1 %cmp1682.i, label %for.body17.lr.ph.i, label %for.inc49.i
for.body17.lr.ph.i: ; preds = %for.body8.i
%9 = add nsw i64 %indvars.iv89.i, -1
%arrayidx30.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %9
%10 = load i32, ptr %arrayidx30.i, align 4, !tbaa !5
%arrayidx34.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %idxprom13.i
%11 = load i32, ptr %arrayidx34.i, align 4, !tbaa !5
%mul.i = mul i32 %11, %10
br label %for.body17.i
for.body17.i: ; preds = %for.inc46.i, %for.body17.lr.ph.i
%indvars.iv91.i = phi i64 [ %indvars.iv89.i, %for.body17.lr.ph.i ], [ %indvars.iv.next92.i, %for.inc46.i ]
%12 = phi i32 [ 2147483647, %for.body17.lr.ph.i ], [ %16, %for.inc46.i ]
%arrayidx21.i = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv89.i, i64 %indvars.iv91.i
%13 = load i32, ptr %arrayidx21.i, align 4, !tbaa !5
%indvars.iv.next92.i = add nuw nsw i64 %indvars.iv91.i, 1
%arrayidx26.i = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.next92.i, i64 %idxprom13.i
%14 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%add27.i = add nsw i32 %14, %13
%arrayidx32.i = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv91.i
%15 = load i32, ptr %arrayidx32.i, align 4, !tbaa !5
%mul35.i = mul i32 %mul.i, %15
%add36.i = add nsw i32 %add27.i, %mul35.i
%cmp41.i = icmp slt i32 %add36.i, %12
br i1 %cmp41.i, label %if.then.i, label %for.inc46.i
if.then.i: ; preds = %for.body17.i
store i32 %add36.i, ptr %arrayidx14.i, align 4, !tbaa !5
br label %for.inc46.i
for.inc46.i: ; preds = %if.then.i, %for.body17.i
%16 = phi i32 [ %12, %for.body17.i ], [ %add36.i, %if.then.i ]
%exitcond97.not.i = icmp eq i64 %indvars.iv.next92.i, %indvars.iv100.i
br i1 %exitcond97.not.i, label %for.inc49.i, label %for.body17.i, !llvm.loop !14
for.inc49.i: ; preds = %for.inc46.i, %for.body8.i
%indvars.iv.next90.i = add nuw nsw i64 %indvars.iv89.i, 1
%indvars.iv.next101.i = add nuw nsw i64 %indvars.iv100.i, 1
%exitcond108.not.i = icmp eq i64 %indvars.iv.next101.i, %wide.trip.count111.i
br i1 %exitcond108.not.i, label %for.inc52.i, label %for.body8.i, !llvm.loop !15
for.inc52.i: ; preds = %for.inc49.i, %for.cond6.preheader.i
%indvars.iv.next99.i = add nuw nsw i64 %indvars.iv98.i, 1
%exitcond112.not.i = icmp eq i64 %indvars.iv.next99.i, %wide.trip.count111.i
br i1 %exitcond112.not.i, label %MatrixChain.exit, label %for.cond6.preheader.i, !llvm.loop !16
MatrixChain.exit: ; preds = %for.inc52.i, %entry, %for.end
%.lcssa17 = phi i32 [ %2, %for.end ], [ %0, %entry ], [ %2, %for.inc52.i ]
%idxprom4 = sext i32 %.lcssa17 to i64
%arrayidx5 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 1, i64 %idxprom4
%17 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @MatrixChain() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp80 = icmp sgt i32 %0, 1
br i1 %cmp80, label %for.body.preheader, label %for.end54
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%1 = add nsw i64 %wide.trip.count, -1
%2 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %1, 3
%3 = icmp ult i64 %2, 3
br i1 %3, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %1, -4
br label %for.body
for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ]
%arrayidx2.epil = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil
store i32 0, ptr %arrayidx2.epil, align 4, !tbaa !5
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !17
for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa
%cmp4.not86 = icmp slt i32 %0, 2
br i1 %cmp4.not86, label %for.end54, label %for.cond6.preheader.lr.ph
for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader
%sub = add nuw i32 %0, 1
%wide.trip.count111 = zext i32 %sub to i64
br label %for.cond6.preheader
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx2 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv, i64 %indvars.iv
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2.1 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next
store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx2.2 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1
store i32 0, ptr %arrayidx2.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx2.3 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2
store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond6.preheader: ; preds = %for.cond6.preheader.lr.ph, %for.inc52
%indvars.iv98 = phi i64 [ 2, %for.cond6.preheader.lr.ph ], [ %indvars.iv.next99, %for.inc52 ]
%indvars110 = trunc i64 %indvars.iv98 to i32
%add = sub i32 %sub, %indvars110
%cmp7.not84 = icmp slt i32 %add, 1
br i1 %cmp7.not84, label %for.inc52, label %for.body8.lr.ph
for.body8.lr.ph: ; preds = %for.cond6.preheader
%4 = add nuw i64 %indvars.iv98, 4294967295
br label %for.body8
for.body8: ; preds = %for.body8.lr.ph, %for.inc49
%indvars.iv100 = phi i64 [ %indvars.iv98, %for.body8.lr.ph ], [ %indvars.iv.next101, %for.inc49 ]
%indvars.iv89 = phi i64 [ 1, %for.body8.lr.ph ], [ %indvars.iv.next90, %for.inc49 ]
%5 = add i64 %4, %indvars.iv89
%sext = shl i64 %5, 32
%idxprom13 = ashr exact i64 %sext, 32
%arrayidx14 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv89, i64 %idxprom13
store i32 2147483647, ptr %arrayidx14, align 4, !tbaa !5
%cmp1682 = icmp slt i64 %indvars.iv89, %idxprom13
br i1 %cmp1682, label %for.body17.lr.ph, label %for.inc49
for.body17.lr.ph: ; preds = %for.body8
%6 = add nsw i64 %indvars.iv89, -1
%arrayidx30 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %6
%7 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%arrayidx34 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %idxprom13
%8 = load i32, ptr %arrayidx34, align 4, !tbaa !5
br label %for.body17
for.body17: ; preds = %for.body17.lr.ph, %for.inc46
%indvars.iv91 = phi i64 [ %indvars.iv89, %for.body17.lr.ph ], [ %indvars.iv.next92, %for.inc46 ]
%9 = phi i32 [ 2147483647, %for.body17.lr.ph ], [ %13, %for.inc46 ]
%arrayidx21 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv89, i64 %indvars.iv91
%10 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr @M, i64 0, i64 %indvars.iv.next92, i64 %idxprom13
%11 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%add27 = add nsw i32 %11, %10
%arrayidx32 = getelementptr inbounds [101 x i32], ptr @p, i64 0, i64 %indvars.iv91
%12 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%mul = mul nsw i32 %12, %7
%mul35 = mul nsw i32 %mul, %8
%add36 = add nsw i32 %add27, %mul35
%cmp41 = icmp slt i32 %add36, %9
br i1 %cmp41, label %if.then, label %for.inc46
if.then: ; preds = %for.body17
store i32 %add36, ptr %arrayidx14, align 4, !tbaa !5
br label %for.inc46
for.inc46: ; preds = %for.body17, %if.then
%13 = phi i32 [ %9, %for.body17 ], [ %add36, %if.then ]
%exitcond97.not = icmp eq i64 %indvars.iv.next92, %indvars.iv100
br i1 %exitcond97.not, label %for.inc49, label %for.body17, !llvm.loop !14
for.inc49: ; preds = %for.inc46, %for.body8
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%exitcond108.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count111
br i1 %exitcond108.not, label %for.inc52, label %for.body8, !llvm.loop !15
for.inc52: ; preds = %for.inc49, %for.cond6.preheader
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%exitcond112.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count111
br i1 %exitcond112.not, label %for.end54, label %for.cond6.preheader, !llvm.loop !16
for.end54: ; preds = %for.inc52, %entry, %for.cond3.preheader
ret void
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !12}
|
#include <stdio.h>
int main() {
int n, i, j, k, l, p[101], m[101][101];
scanf("%d", &n);
for ( i = 1; i <= n; i++) {
scanf("%d", &p[i - 1]);
scanf("%d", &p[i]);
}
for ( i = 1; i <= n; i++) {
m[i][i] = 0;
}
for ( l = 2; l <= n; l++) {
for ( i = 1; i <= n - l + 1; i++) {
int j = i + l - 1;
m[i][j] = ( 1 << 21);
for ( k = i; k <= j - 1; k++) {
if ( m[i][j] < m[i][k] + m[k + 1][j] + p[i - 1]*p[k]*p[j]) {
m[i][j] = m[i][j];
} else {
m[i][j] = m[i][k] + m[k + 1][j] + p[i - 1]*p[k]*p[j];
}
}
}
}
printf("%d\n", m[1][n]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284353/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284353/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [101 x i32], align 16
%m = alloca [101 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not141 = icmp slt i32 %0, 1
br i1 %cmp.not141, label %for.end97, label %for.body
for.cond5.preheader: ; preds = %for.body
%cmp6.not143 = icmp slt i32 %6, 1
br i1 %cmp6.not143, label %for.end97, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond5.preheader
%1 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%3 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
br i1 %4, label %for.cond15.preheader.unr-lcssa, label %for.body7.preheader.new
for.body7.preheader.new: ; preds = %for.body7.preheader
%unroll_iter = and i64 %2, -4
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%5 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx3 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond15.preheader.unr-lcssa: ; preds = %for.body7, %for.body7.preheader
%indvars.iv154.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next155.3, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond15.preheader, label %for.body7.epil
for.body7.epil: ; preds = %for.cond15.preheader.unr-lcssa, %for.body7.epil
%indvars.iv154.epil = phi i64 [ %indvars.iv.next155.epil, %for.body7.epil ], [ %indvars.iv154.unr, %for.cond15.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body7.epil ], [ 0, %for.cond15.preheader.unr-lcssa ]
%arrayidx11.epil = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv154.epil, i64 %indvars.iv154.epil
store i32 0, ptr %arrayidx11.epil, align 4, !tbaa !5
%indvars.iv.next155.epil = add nuw nsw i64 %indvars.iv154.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.cond15.preheader, label %for.body7.epil, !llvm.loop !11
for.cond15.preheader: ; preds = %for.body7.epil, %for.cond15.preheader.unr-lcssa
%cmp16.not149 = icmp slt i32 %6, 2
br i1 %cmp16.not149, label %for.end97, label %for.cond18.preheader.lr.ph
for.cond18.preheader.lr.ph: ; preds = %for.cond15.preheader
%sub19 = add nuw i32 %6, 1
%wide.trip.count180 = zext i32 %sub19 to i64
br label %for.cond18.preheader
for.body7: ; preds = %for.body7, %for.body7.preheader.new
%indvars.iv154 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next155.3, %for.body7 ]
%niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.3, %for.body7 ]
%arrayidx11 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv154, i64 %indvars.iv154
store i32 0, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%arrayidx11.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next155, i64 %indvars.iv.next155
store i32 0, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next155.1 = add nuw nsw i64 %indvars.iv154, 2
%arrayidx11.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next155.1, i64 %indvars.iv.next155.1
store i32 0, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next155.2 = add nuw nsw i64 %indvars.iv154, 3
%arrayidx11.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next155.2, i64 %indvars.iv.next155.2
store i32 0, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next155.3 = add nuw nsw i64 %indvars.iv154, 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.cond15.preheader.unr-lcssa, label %for.body7, !llvm.loop !13
for.cond18.preheader: ; preds = %for.cond18.preheader.lr.ph, %for.inc95
%indvars.iv166 = phi i64 [ 2, %for.cond18.preheader.lr.ph ], [ %indvars.iv.next167, %for.inc95 ]
%indvars179 = trunc i64 %indvars.iv166 to i32
%add = sub i32 %sub19, %indvars179
%cmp20.not147 = icmp slt i32 %add, 1
br i1 %cmp20.not147, label %for.inc95, label %for.body32.lr.ph
for.body32.lr.ph: ; preds = %for.cond18.preheader, %for.end91
%indvars.iv168 = phi i64 [ %indvars.iv.next169, %for.end91 ], [ %indvars.iv166, %for.cond18.preheader ]
%indvars.iv157 = phi i64 [ %indvars.iv.next158, %for.end91 ], [ 1, %for.cond18.preheader ]
%8 = add nuw nsw i64 %indvars.iv157, %indvars.iv166
%9 = add nsw i64 %8, -1
%arrayidx28 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv157, i64 %9
store i32 2097152, ptr %arrayidx28, align 4, !tbaa !5
%10 = add nsw i64 %indvars.iv157, -1
%arrayidx49 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %10
%11 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%arrayidx53 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %9
%12 = load i32, ptr %arrayidx53, align 4, !tbaa !5
br label %for.body32
for.body32: ; preds = %for.body32.lr.ph, %for.inc89
%indvars.iv159 = phi i64 [ %indvars.iv157, %for.body32.lr.ph ], [ %indvars.iv.next160, %for.inc89 ]
%13 = phi i32 [ 2097152, %for.body32.lr.ph ], [ %17, %for.inc89 ]
%arrayidx40 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv157, i64 %indvars.iv159
%14 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%arrayidx45 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next160, i64 %9
%15 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%add46 = add nsw i32 %15, %14
%arrayidx51 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv159
%16 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%mul = mul nsw i32 %16, %11
%mul54 = mul nsw i32 %mul, %12
%add55 = add nsw i32 %add46, %mul54
%cmp56 = icmp slt i32 %13, %add55
br i1 %cmp56, label %for.inc89, label %if.else
if.else: ; preds = %for.body32
store i32 %add55, ptr %arrayidx28, align 4, !tbaa !5
br label %for.inc89
for.inc89: ; preds = %for.body32, %if.else
%17 = phi i32 [ %13, %for.body32 ], [ %add55, %if.else ]
%exitcond165.not = icmp eq i64 %indvars.iv.next160, %indvars.iv168
br i1 %exitcond165.not, label %for.end91, label %for.body32, !llvm.loop !14
for.end91: ; preds = %for.inc89
%indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
%indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1
%exitcond178.not = icmp eq i64 %indvars.iv.next169, %wide.trip.count180
br i1 %exitcond178.not, label %for.inc95, label %for.body32.lr.ph, !llvm.loop !15
for.inc95: ; preds = %for.end91, %for.cond18.preheader
%indvars.iv.next167 = add nuw nsw i64 %indvars.iv166, 1
%exitcond181.not = icmp eq i64 %indvars.iv.next167, %wide.trip.count180
br i1 %exitcond181.not, label %for.end97, label %for.cond18.preheader, !llvm.loop !16
for.end97: ; preds = %for.inc95, %entry, %for.cond5.preheader, %for.cond15.preheader
%.lcssa184187 = phi i32 [ %6, %for.cond15.preheader ], [ %6, %for.cond5.preheader ], [ %0, %entry ], [ %6, %for.inc95 ]
%idxprom99 = sext i32 %.lcssa184187 to i64
%arrayidx100 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom99
%18 = load i32, ptr %arrayidx100, align 4, !tbaa !5
%call101 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#define MAX 105
#define LIMIT 1000000
int min(int x, int y)
{
return x < y ? x : y;
}
int main(void)
{
int n;
int p[MAX];
int M[MAX][MAX];
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d%d", &p[i], &p[i+1]);
for (int i = 0; i < n; i++)
M[i][i] = 0;
for (int d = 1; d < n; d++)
for (int i = 0; i < n - d; i++) {
int j = i + d;
M[i][j] = LIMIT;
for (int k = i; k <= j; k++)
M[i][j] = min(M[i][j], M[i][k] + M[k+1][j] + p[i]*p[k+1]*p[j+1]);
}
printf("%d\n", M[0][n-1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284397/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284397/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%p = alloca [105 x i32], align 16
%M = alloca [105 x [105 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %p) #5
call void @llvm.lifetime.start.p0(i64 44100, ptr nonnull %M) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp103 = icmp sgt i32 %0, 0
br i1 %cmp103, label %for.body, label %for.cond16.preheader.for.cond.cleanup18_crit_edge
for.cond5.preheader: ; preds = %for.body
%cmp6105 = icmp sgt i32 %2, 0
br i1 %cmp6105, label %for.body8.preheader, label %for.cond16.preheader.for.cond.cleanup18_crit_edge
for.body8.preheader: ; preds = %for.cond5.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.cond16.preheader.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [105 x i32], ptr %p, i64 0, i64 %indvars.iv
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds [105 x i32], ptr %p, i64 0, i64 %indvars.iv.next
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond16.preheader.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%indvars.iv115.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next116.3, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond16.preheader, label %for.body8.epil
for.body8.epil: ; preds = %for.cond16.preheader.unr-lcssa, %for.body8.epil
%indvars.iv115.epil = phi i64 [ %indvars.iv.next116.epil, %for.body8.epil ], [ %indvars.iv115.unr, %for.cond16.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.cond16.preheader.unr-lcssa ]
%arrayidx12.epil = getelementptr inbounds [105 x [105 x i32]], ptr %M, i64 0, i64 %indvars.iv115.epil, i64 %indvars.iv115.epil
store i32 0, ptr %arrayidx12.epil, align 4, !tbaa !5
%indvars.iv.next116.epil = add nuw nsw i64 %indvars.iv115.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.cond16.preheader, label %for.body8.epil, !llvm.loop !11
for.cond16.preheader: ; preds = %for.body8.epil, %for.cond16.preheader.unr-lcssa
%cmp17111 = icmp sgt i32 %2, 1
br i1 %cmp17111, label %for.cond21.preheader.preheader, label %for.cond16.preheader.for.cond.cleanup18_crit_edge
for.cond16.preheader.for.cond.cleanup18_crit_edge: ; preds = %entry, %for.cond5.preheader, %for.cond16.preheader
%.lcssa152155 = phi i32 [ %2, %for.cond16.preheader ], [ %2, %for.cond5.preheader ], [ %0, %entry ]
%.pre = add nsw i32 %.lcssa152155, -1
br label %for.cond.cleanup18
for.cond21.preheader.preheader: ; preds = %for.cond16.preheader
%4 = add nsw i32 %2, -1
%5 = zext i32 %2 to i64
%wide.trip.count148 = zext i32 %2 to i64
br label %for.cond21.preheader
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv115 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next116.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx12 = getelementptr inbounds [105 x [105 x i32]], ptr %M, i64 0, i64 %indvars.iv115, i64 %indvars.iv115
store i32 0, ptr %arrayidx12, align 16, !tbaa !5
%indvars.iv.next116 = or i64 %indvars.iv115, 1
%arrayidx12.1 = getelementptr inbounds [105 x [105 x i32]], ptr %M, i64 0, i64 %indvars.iv.next116, i64 %indvars.iv.next116
store i32 0, ptr %arrayidx12.1, align 8, !tbaa !5
%indvars.iv.next116.1 = or i64 %indvars.iv115, 2
%arrayidx12.2 = getelementptr inbounds [105 x [105 x i32]], ptr %M, i64 0, i64 %indvars.iv.next116.1, i64 %indvars.iv.next116.1
store i32 0, ptr %arrayidx12.2, align 16, !tbaa !5
%indvars.iv.next116.2 = or i64 %indvars.iv115, 3
%arrayidx12.3 = getelementptr inbounds [105 x [105 x i32]], ptr %M, i64 0, i64 %indvars.iv.next116.2, i64 %indvars.iv.next116.2
store i32 0, ptr %arrayidx12.3, align 8, !tbaa !5
%indvars.iv.next116.3 = add nuw nsw i64 %indvars.iv115, 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.cond16.preheader.unr-lcssa, label %for.body8, !llvm.loop !13
for.cond21.preheader: ; preds = %for.cond21.preheader.preheader, %for.cond.cleanup23
%indvars.iv142 = phi i64 [ 1, %for.cond21.preheader.preheader ], [ %indvars.iv.next143, %for.cond.cleanup23 ]
%indvars.iv138 = phi i32 [ %4, %for.cond21.preheader.preheader ], [ %indvars.iv.next139, %for.cond.cleanup23 ]
%indvars.iv129 = phi i64 [ 2, %for.cond21.preheader.preheader ], [ %indvars.iv.next130, %for.cond.cleanup23 ]
%cmp22109 = icmp ult i64 %indvars.iv142, %5
br i1 %cmp22109, label %for.body24.preheader, label %for.cond.cleanup23
for.body24.preheader: ; preds = %for.cond21.preheader
%wide.trip.count140 = zext i32 %indvars.iv138 to i64
br label %for.body24
for.cond.cleanup18: ; preds = %for.cond.cleanup23, %for.cond16.preheader.for.cond.cleanup18_crit_edge
%sub73.pre-phi = phi i32 [ %.pre, %for.cond16.preheader.for.cond.cleanup18_crit_edge ], [ %4, %for.cond.cleanup23 ]
%idxprom74 = sext i32 %sub73.pre-phi to i64
%arrayidx75 = getelementptr inbounds [105 x i32], ptr %M, i64 0, i64 %idxprom74
%6 = load i32, ptr %arrayidx75, align 4, !tbaa !5
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %6)
call void @llvm.lifetime.end.p0(i64 44100, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.cond.cleanup23: ; preds = %for.cond.cleanup32, %for.cond21.preheader
%indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 1
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%indvars.iv.next139 = add i32 %indvars.iv138, -1
%exitcond149.not = icmp eq i64 %indvars.iv.next143, %wide.trip.count148
br i1 %exitcond149.not, label %for.cond.cleanup18, label %for.cond21.preheader, !llvm.loop !14
for.body24: ; preds = %for.body24.preheader, %for.cond.cleanup32
%indvars.iv131 = phi i64 [ %indvars.iv129, %for.body24.preheader ], [ %indvars.iv.next132, %for.cond.cleanup32 ]
%indvars.iv118 = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next119, %for.cond.cleanup32 ]
%7 = add nuw nsw i64 %indvars.iv118, %indvars.iv142
%arrayidx29 = getelementptr inbounds [105 x [105 x i32]], ptr %M, i64 0, i64 %indvars.iv118, i64 %7
%arrayidx49 = getelementptr inbounds [105 x i32], ptr %p, i64 0, i64 %indvars.iv118
%8 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%9 = add nuw nsw i64 %7, 1
%arrayidx55 = getelementptr inbounds [105 x i32], ptr %p, i64 0, i64 %9
%10 = load i32, ptr %arrayidx55, align 4, !tbaa !5
store i32 1000000, ptr %arrayidx29, align 4, !tbaa !5
br label %for.body33
for.cond.cleanup32: ; preds = %for.body33
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
%exitcond141.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count140
br i1 %exitcond141.not, label %for.cond.cleanup23, label %for.body24, !llvm.loop !15
for.body33: ; preds = %for.body24, %for.body33
%indvars.iv120 = phi i64 [ %indvars.iv118, %for.body24 ], [ %indvars.iv.next121, %for.body33 ]
%storemerge107 = phi i32 [ 1000000, %for.body24 ], [ %cond.i, %for.body33 ]
%arrayidx41 = getelementptr inbounds [105 x [105 x i32]], ptr %M, i64 0, i64 %indvars.iv118, i64 %indvars.iv120
%11 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%arrayidx46 = getelementptr inbounds [105 x [105 x i32]], ptr %M, i64 0, i64 %indvars.iv.next121, i64 %7
%12 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%add47 = add nsw i32 %12, %11
%arrayidx52 = getelementptr inbounds [105 x i32], ptr %p, i64 0, i64 %indvars.iv.next121
%13 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%mul = mul nsw i32 %13, %8
%mul56 = mul nsw i32 %mul, %10
%add57 = add nsw i32 %add47, %mul56
%cond.i = call i32 @llvm.smin.i32(i32 %storemerge107, i32 %add57)
store i32 %cond.i, ptr %arrayidx29, align 4, !tbaa !5
%exitcond128.not = icmp eq i64 %indvars.iv.next121, %indvars.iv131
br i1 %exitcond128.not, label %for.cond.cleanup32, label %for.body33, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main()
{
int m;
scanf("%d",&m);
for(;m>0;m--)
{
int a,b,c,d,n,max,min;
scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
max=c+d;
min=c-d;
if((n*(a+b)>=min&&n*(a+b)<=max)||(n*(a-b)<=max&&n*(a-b)>=min)||(n*(a-b)<=min&&n*(a+b)>=max))
{
printf("YES\n");
}
else printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28444/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28444/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"%d%d%d%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%.pr = load i32, ptr %m, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %.pr, 0
br i1 %cmp31, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end
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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %d, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = load i32, ptr %a, align 4, !tbaa !5
%4 = load i32, ptr %b, align 4, !tbaa !5
%add2 = add nsw i32 %4, %3
%mul = mul nsw i32 %add2, %2
%cmp3.not = icmp slt i32 %mul, %sub
%cmp6.not = icmp sgt i32 %mul, %add
%or.cond = select i1 %cmp3.not, i1 true, i1 %cmp6.not
br i1 %or.cond, label %lor.lhs.false, label %if.end
lor.lhs.false: ; preds = %for.body
%sub7 = sub nsw i32 %3, %4
%mul8 = mul nsw i32 %sub7, %2
%cmp9.not = icmp sgt i32 %mul8, %add
%cmp13.not = icmp slt i32 %mul8, %sub
%or.cond29 = or i1 %cmp9.not, %cmp13.not
br i1 %or.cond29, label %lor.lhs.false14, label %if.end
lor.lhs.false14: ; preds = %lor.lhs.false
%cmp17.not = icmp sgt i32 %mul8, %sub
%cmp21.not = icmp slt i32 %mul, %add
%or.cond30 = select i1 %cmp17.not, i1 true, i1 %cmp21.not
%spec.select = select i1 %or.cond30, ptr @str, ptr @str.4
br label %if.end
if.end: ; preds = %lor.lhs.false14, %for.body, %lor.lhs.false
%str.sink = phi ptr [ @str.4, %lor.lhs.false ], [ @str.4, %for.body ], [ %spec.select, %lor.lhs.false14 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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
%5 = load i32, ptr %m, align 4, !tbaa !5
%dec = add nsw i32 %5, -1
store i32 %dec, ptr %m, align 4, !tbaa !5
%cmp = icmp sgt i32 %5, 1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(){
int m[101][101], p[101];
int n, l, i, j, k, q;
scanf("%d", &n);
for(i = 1; i <= n; i++){
scanf("%d%d", &p[i-1], &p[i]);
}
for(i = 1; i <= n; i++) m[i][i] = 0;
for(l = 2; l <= n; l++){
for(i = 1; i <= n - l + 1; i++){
j = i + l - 1;
m[i][j] = (int)INFINITY;
for(k = i; k <= j - 1; k++){
q = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j];
m[i][j] = fmin(m[i][j], q);
}
}
}
printf("%d\n", m[1][n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284490/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284490/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca [101 x [101 x i32]], align 16
%p = alloca [101 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #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.not101 = icmp slt i32 %0, 1
br i1 %cmp.not101, label %for.end68, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5.not103 = icmp slt i32 %6, 1
br i1 %cmp5.not103, label %for.end68, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%3 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
br i1 %4, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %2, -4
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%5 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv114.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next115.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil
for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil
%indvars.iv114.epil = phi i64 [ %indvars.iv.next115.epil, %for.body6.epil ], [ %indvars.iv114.unr, %for.cond14.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv114.epil, i64 %indvars.iv114.epil
store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5
%indvars.iv.next115.epil = add nuw nsw i64 %indvars.iv114.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11
for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa
%cmp15.not109 = icmp slt i32 %6, 2
br i1 %cmp15.not109, label %for.end68, label %for.cond17.preheader.lr.ph
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%sub18 = add nuw i32 %6, 1
%wide.trip.count140 = zext i32 %sub18 to i64
br label %for.cond17.preheader
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv114 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next115.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv114, i64 %indvars.iv114
store i32 0, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115, i64 %indvars.iv.next115
store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next115.1 = add nuw nsw i64 %indvars.iv114, 2
%arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115.1, i64 %indvars.iv.next115.1
store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5
%indvars.iv.next115.2 = add nuw nsw i64 %indvars.iv114, 3
%arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115.2, i64 %indvars.iv.next115.2
store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5
%indvars.iv.next115.3 = add nuw nsw i64 %indvars.iv114, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc66
%indvars.iv126 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next127, %for.inc66 ]
%indvars139 = trunc i64 %indvars.iv126 to i32
%add = sub i32 %sub18, %indvars139
%cmp19.not107 = icmp slt i32 %add, 1
br i1 %cmp19.not107, label %for.inc66, label %for.body30.lr.ph
for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc63
%indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.inc63 ], [ %indvars.iv126, %for.cond17.preheader ]
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.inc63 ], [ 1, %for.cond17.preheader ]
%8 = add nuw nsw i64 %indvars.iv117, %indvars.iv126
%9 = add nsw i64 %8, -1
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv117, i64 %9
%10 = add nsw i64 %indvars.iv117, -1
%arrayidx43 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %10
%11 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%arrayidx47 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %9
%12 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%arrayidx26.promoted = load i32, ptr %arrayidx26, align 4, !tbaa !5
br label %for.body30
for.body30: ; preds = %for.body30.lr.ph, %for.body30
%indvars.iv119 = phi i64 [ %indvars.iv117, %for.body30.lr.ph ], [ %indvars.iv.next120, %for.body30 ]
%13 = phi i32 [ %arrayidx26.promoted, %for.body30.lr.ph ], [ %conv55, %for.body30 ]
%arrayidx34 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv117, i64 %indvars.iv119
%14 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%arrayidx39 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next120, i64 %9
%15 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%add40 = add nsw i32 %15, %14
%arrayidx45 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv119
%16 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%mul = mul nsw i32 %16, %11
%mul48 = mul nsw i32 %mul, %12
%add49 = add nsw i32 %add40, %mul48
%conv = sitofp i32 %13 to double
%conv54 = sitofp i32 %add49 to double
%17 = call double @llvm.minnum.f64(double %conv, double %conv54)
%conv55 = fptosi double %17 to i32
store i32 %conv55, ptr %arrayidx26, align 4, !tbaa !5
%exitcond125.not = icmp eq i64 %indvars.iv.next120, %indvars.iv128
br i1 %exitcond125.not, label %for.inc63, label %for.body30, !llvm.loop !14
for.inc63: ; preds = %for.body30
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%exitcond138.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count140
br i1 %exitcond138.not, label %for.inc66, label %for.body30.lr.ph, !llvm.loop !15
for.inc66: ; preds = %for.inc63, %for.cond17.preheader
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%exitcond141.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count140
br i1 %exitcond141.not, label %for.end68, label %for.cond17.preheader, !llvm.loop !16
for.end68: ; preds = %for.inc66, %entry, %for.cond4.preheader, %for.cond14.preheader
%.lcssa144147 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc66 ]
%idxprom70 = sext i32 %.lcssa144147 to i64
%arrayidx71 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom70
%18 = load i32, ptr %arrayidx71, align 4, !tbaa !5
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.minnum.f64(double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#define N 101
#define R 101
int main(){
int n,i,j,k,l,p[N],m[R][R];
scanf("%d",&n);
for(i = 1;i <= n; i++){
scanf("%d %d",&p[i-1],&p[i]);
m[i][i] = 0;
}
for(l = 2;l <= n;l++){
for(i = 1;i <= n-l+1;i++){
j = i+l-1;
m[i][j] = 10000000;
for(k = i;k <= j-1;k++){
if(m[i][j] > m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]) m[i][j] = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j];
}
}
}
printf("%d\n",m[1][n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284533/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284533/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [101 x i32], align 16
%m = alloca [101 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not119 = icmp slt i32 %0, 1
br i1 %cmp.not119, label %for.end81, label %for.body
for.cond8.preheader: ; preds = %for.body
%cmp9.not125 = icmp slt i32 %2, 2
br i1 %cmp9.not125, label %for.end81, label %for.cond11.preheader.lr.ph
for.cond11.preheader.lr.ph: ; preds = %for.cond8.preheader
%sub12 = add nuw i32 %2, 1
%wide.trip.count = zext i32 %sub12 to i64
br label %for.cond11.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%1 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %1
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%arrayidx7 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv, i64 %indvars.iv
store i32 0, ptr %arrayidx7, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.cond11.preheader.lr.ph, %for.inc79
%indvars.iv137 = phi i64 [ 2, %for.cond11.preheader.lr.ph ], [ %indvars.iv.next138, %for.inc79 ]
%indvars150 = trunc i64 %indvars.iv137 to i32
%add = sub i32 %sub12, %indvars150
%cmp13.not123 = icmp slt i32 %add, 1
br i1 %cmp13.not123, label %for.inc79, label %for.body24.lr.ph
for.body24.lr.ph: ; preds = %for.cond11.preheader, %for.inc76
%indvars.iv139 = phi i64 [ %indvars.iv.next140, %for.inc76 ], [ %indvars.iv137, %for.cond11.preheader ]
%indvars.iv130 = phi i64 [ %indvars.iv.next131, %for.inc76 ], [ 1, %for.cond11.preheader ]
%4 = add nuw nsw i64 %indvars.iv130, %indvars.iv137
%5 = add nsw i64 %4, -1
%arrayidx20 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv130, i64 %5
store i32 10000000, ptr %arrayidx20, align 4, !tbaa !5
%6 = add nsw i64 %indvars.iv130, -1
%arrayidx41 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %6
%7 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%arrayidx45 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %5
%8 = load i32, ptr %arrayidx45, align 4, !tbaa !5
br label %for.body24
for.body24: ; preds = %for.body24.lr.ph, %for.inc73
%indvars.iv132 = phi i64 [ %indvars.iv130, %for.body24.lr.ph ], [ %indvars.iv.next133, %for.inc73 ]
%9 = phi i32 [ 10000000, %for.body24.lr.ph ], [ %13, %for.inc73 ]
%arrayidx32 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv130, i64 %indvars.iv132
%10 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%arrayidx37 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next133, i64 %5
%11 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%add38 = add nsw i32 %11, %10
%arrayidx43 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv132
%12 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%mul = mul nsw i32 %12, %7
%mul46 = mul nsw i32 %mul, %8
%add47 = add nsw i32 %add38, %mul46
%cmp48 = icmp sgt i32 %9, %add47
br i1 %cmp48, label %if.then, label %for.inc73
if.then: ; preds = %for.body24
store i32 %add47, ptr %arrayidx20, align 4, !tbaa !5
br label %for.inc73
for.inc73: ; preds = %for.body24, %if.then
%13 = phi i32 [ %9, %for.body24 ], [ %add47, %if.then ]
%exitcond.not = icmp eq i64 %indvars.iv.next133, %indvars.iv139
br i1 %exitcond.not, label %for.inc76, label %for.body24, !llvm.loop !11
for.inc76: ; preds = %for.inc73
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%exitcond149.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count
br i1 %exitcond149.not, label %for.inc79, label %for.body24.lr.ph, !llvm.loop !12
for.inc79: ; preds = %for.inc76, %for.cond11.preheader
%indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
%exitcond151.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count
br i1 %exitcond151.not, label %for.end81, label %for.cond11.preheader, !llvm.loop !13
for.end81: ; preds = %for.inc79, %entry, %for.cond8.preheader
%.lcssa154 = phi i32 [ %2, %for.cond8.preheader ], [ %0, %entry ], [ %2, %for.inc79 ]
%idxprom83 = sext i32 %.lcssa154 to i64
%arrayidx84 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom83
%14 = load i32, ptr %arrayidx84, align 4, !tbaa !5
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
static const int N=100;
int min(int a, int b){
//return a<b?a:b;
if(a<b) return a;
else return b;
}
int main(){
int n, p[N+1], m[N+1][N+1], i, j, k, l;
scanf("%d", &n);
for(i=1; i<=n; i++) scanf("%d%d", &p[i-1], &p[i]);
for(i=1; i<=n; i++) m[i][i]=0;
for(l=2; l<=n; l++){
for(i=1; i<=n-l+1; i++){
j = i+l-1;
m[i][j] = (1<<21);
for(k=i; k<=j-1; k++) m[i][j]=min(m[i][j], m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
}
}
printf("%d\n", m[1][n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284577/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284577/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: 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:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%0 = tail call ptr @llvm.stacksave.p0()
%vla101 = alloca [101 x i32], align 16
%vla1102 = alloca [10201 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not103 = icmp slt i32 %1, 1
br i1 %cmp.not103, label %for.end68, label %for.body.preheader
for.body.preheader: ; preds = %entry
%invariant.gep151 = getelementptr i32, ptr %vla101, i64 -1
br label %for.body
for.cond5.preheader: ; preds = %for.body
%cmp6.not105 = icmp slt i32 %6, 1
br i1 %cmp6.not105, label %for.end68, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond5.preheader
%2 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%4 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %3, 3
%5 = icmp ult i64 %4, 3
br i1 %5, label %for.cond15.preheader.unr-lcssa, label %for.body7.preheader.new
for.body7.preheader.new: ; preds = %for.body7.preheader
%unroll_iter = and i64 %3, -4
br label %for.body7
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%gep152 = getelementptr i32, ptr %invariant.gep151, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds i32, ptr %vla101, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %gep152, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond15.preheader.unr-lcssa: ; preds = %for.body7, %for.body7.preheader
%indvars.iv117.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next118.3, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond15.preheader, label %for.body7.epil
for.body7.epil: ; preds = %for.cond15.preheader.unr-lcssa, %for.body7.epil
%indvars.iv117.epil = phi i64 [ %indvars.iv.next118.epil, %for.body7.epil ], [ %indvars.iv117.unr, %for.cond15.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body7.epil ], [ 0, %for.cond15.preheader.unr-lcssa ]
%8 = mul nuw nsw i64 %indvars.iv117.epil, 101
%arrayidx9.epil = getelementptr inbounds i32, ptr %vla1102, i64 %8
%arrayidx11.epil = getelementptr inbounds i32, ptr %arrayidx9.epil, i64 %indvars.iv117.epil
store i32 0, ptr %arrayidx11.epil, align 4, !tbaa !5
%indvars.iv.next118.epil = add nuw nsw i64 %indvars.iv117.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.cond15.preheader, label %for.body7.epil, !llvm.loop !11
for.cond15.preheader: ; preds = %for.body7.epil, %for.cond15.preheader.unr-lcssa
%cmp16.not112 = icmp slt i32 %6, 2
br i1 %cmp16.not112, label %for.end68, label %for.cond18.preheader.lr.ph
for.cond18.preheader.lr.ph: ; preds = %for.cond15.preheader
%sub19 = add nuw i32 %6, 1
%wide.trip.count143 = zext i32 %sub19 to i64
%invariant.gep153 = getelementptr i32, ptr %vla101, i64 -1
br label %for.cond18.preheader
for.body7: ; preds = %for.body7, %for.body7.preheader.new
%indvars.iv117 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next118.3, %for.body7 ]
%niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.3, %for.body7 ]
%9 = mul nuw nsw i64 %indvars.iv117, 101
%arrayidx9 = getelementptr inbounds i32, ptr %vla1102, i64 %9
%arrayidx11 = getelementptr inbounds i32, ptr %arrayidx9, i64 %indvars.iv117
store i32 0, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%10 = mul nuw nsw i64 %indvars.iv.next118, 101
%arrayidx9.1 = getelementptr inbounds i32, ptr %vla1102, i64 %10
%arrayidx11.1 = getelementptr inbounds i32, ptr %arrayidx9.1, i64 %indvars.iv.next118
store i32 0, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next118.1 = add nuw nsw i64 %indvars.iv117, 2
%11 = mul nuw nsw i64 %indvars.iv.next118.1, 101
%arrayidx9.2 = getelementptr inbounds i32, ptr %vla1102, i64 %11
%arrayidx11.2 = getelementptr inbounds i32, ptr %arrayidx9.2, i64 %indvars.iv.next118.1
store i32 0, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next118.2 = add nuw nsw i64 %indvars.iv117, 3
%12 = mul nuw nsw i64 %indvars.iv.next118.2, 101
%arrayidx9.3 = getelementptr inbounds i32, ptr %vla1102, i64 %12
%arrayidx11.3 = getelementptr inbounds i32, ptr %arrayidx9.3, i64 %indvars.iv.next118.2
store i32 0, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next118.3 = add nuw nsw i64 %indvars.iv117, 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.cond15.preheader.unr-lcssa, label %for.body7, !llvm.loop !13
for.cond18.preheader: ; preds = %for.cond18.preheader.lr.ph, %for.inc66
%indvar = phi i64 [ 0, %for.cond18.preheader.lr.ph ], [ %indvar.next, %for.inc66 ]
%indvars.iv129 = phi i64 [ 2, %for.cond18.preheader.lr.ph ], [ %indvars.iv.next130, %for.inc66 ]
%13 = add i64 %indvar, 1
%indvars142 = trunc i64 %indvars.iv129 to i32
%add = sub i32 %sub19, %indvars142
%cmp20.not110 = icmp slt i32 %add, 1
br i1 %cmp20.not110, label %for.inc66, label %for.body31.lr.ph.preheader
for.body31.lr.ph.preheader: ; preds = %for.cond18.preheader
%xtraiter155 = and i64 %13, 1
%14 = icmp eq i64 %indvar, 0
%unroll_iter158 = and i64 %13, -2
%lcmp.mod157.not = icmp eq i64 %xtraiter155, 0
br label %for.body31.lr.ph
for.body31.lr.ph: ; preds = %for.body31.lr.ph.preheader, %for.inc63
%indvars.iv131 = phi i64 [ %indvars.iv.next132, %for.inc63 ], [ %indvars.iv129, %for.body31.lr.ph.preheader ]
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.inc63 ], [ 1, %for.body31.lr.ph.preheader ]
%15 = add nuw nsw i64 %indvars.iv120, %indvars.iv129
%16 = add nsw i64 %15, -1
%17 = mul nuw nsw i64 %indvars.iv120, 101
%arrayidx25 = getelementptr inbounds i32, ptr %vla1102, i64 %17
%arrayidx27 = getelementptr inbounds i32, ptr %arrayidx25, i64 %16
%invariant.gep = getelementptr i32, ptr %vla1102, i64 %16
store i32 2097152, ptr %arrayidx27, align 4, !tbaa !5
%gep154 = getelementptr i32, ptr %invariant.gep153, i64 %indvars.iv120
%18 = load i32, ptr %gep154, align 4, !tbaa !5
%arrayidx52 = getelementptr inbounds i32, ptr %vla101, i64 %16
%19 = load i32, ptr %arrayidx52, align 4, !tbaa !5
br i1 %14, label %for.inc63.unr-lcssa, label %for.body31
for.body31: ; preds = %for.body31.lr.ph, %for.body31
%indvars.iv122 = phi i64 [ %indvars.iv.next123.1, %for.body31 ], [ %indvars.iv120, %for.body31.lr.ph ]
%storemerge108 = phi i32 [ %a.b.i.1, %for.body31 ], [ 2097152, %for.body31.lr.ph ]
%niter159 = phi i64 [ %niter159.next.1, %for.body31 ], [ 0, %for.body31.lr.ph ]
%arrayidx39 = getelementptr inbounds i32, ptr %arrayidx25, i64 %indvars.iv122
%20 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%21 = mul nuw nsw i64 %indvars.iv.next123, 101
%gep = getelementptr i32, ptr %invariant.gep, i64 %21
%22 = load i32, ptr %gep, align 4, !tbaa !5
%add45 = add nsw i32 %22, %20
%arrayidx50 = getelementptr inbounds i32, ptr %vla101, i64 %indvars.iv122
%23 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%mul = mul nsw i32 %23, %18
%mul53 = mul nsw i32 %mul, %19
%add54 = add nsw i32 %add45, %mul53
%a.b.i = call i32 @llvm.smin.i32(i32 %storemerge108, i32 %add54)
store i32 %a.b.i, ptr %arrayidx27, align 4, !tbaa !5
%arrayidx39.1 = getelementptr inbounds i32, ptr %arrayidx25, i64 %indvars.iv.next123
%24 = load i32, ptr %arrayidx39.1, align 4, !tbaa !5
%indvars.iv.next123.1 = add nuw nsw i64 %indvars.iv122, 2
%25 = mul nuw nsw i64 %indvars.iv.next123.1, 101
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %25
%26 = load i32, ptr %gep.1, align 4, !tbaa !5
%add45.1 = add nsw i32 %26, %24
%arrayidx50.1 = getelementptr inbounds i32, ptr %vla101, i64 %indvars.iv.next123
%27 = load i32, ptr %arrayidx50.1, align 4, !tbaa !5
%mul.1 = mul nsw i32 %27, %18
%mul53.1 = mul nsw i32 %mul.1, %19
%add54.1 = add nsw i32 %add45.1, %mul53.1
%a.b.i.1 = call i32 @llvm.smin.i32(i32 %a.b.i, i32 %add54.1)
store i32 %a.b.i.1, ptr %arrayidx27, align 4, !tbaa !5
%niter159.next.1 = add i64 %niter159, 2
%niter159.ncmp.1 = icmp eq i64 %niter159.next.1, %unroll_iter158
br i1 %niter159.ncmp.1, label %for.inc63.unr-lcssa, label %for.body31, !llvm.loop !14
for.inc63.unr-lcssa: ; preds = %for.body31, %for.body31.lr.ph
%indvars.iv122.unr = phi i64 [ %indvars.iv120, %for.body31.lr.ph ], [ %indvars.iv.next123.1, %for.body31 ]
%storemerge108.unr = phi i32 [ 2097152, %for.body31.lr.ph ], [ %a.b.i.1, %for.body31 ]
br i1 %lcmp.mod157.not, label %for.inc63, label %for.body31.epil
for.body31.epil: ; preds = %for.inc63.unr-lcssa
%arrayidx39.epil = getelementptr inbounds i32, ptr %arrayidx25, i64 %indvars.iv122.unr
%28 = load i32, ptr %arrayidx39.epil, align 4, !tbaa !5
%29 = mul nuw i64 %indvars.iv122.unr, 101
%30 = getelementptr i32, ptr %invariant.gep, i64 %29
%gep.epil = getelementptr i32, ptr %30, i64 101
%31 = load i32, ptr %gep.epil, align 4, !tbaa !5
%add45.epil = add nsw i32 %31, %28
%arrayidx50.epil = getelementptr inbounds i32, ptr %vla101, i64 %indvars.iv122.unr
%32 = load i32, ptr %arrayidx50.epil, align 4, !tbaa !5
%mul.epil = mul nsw i32 %32, %18
%mul53.epil = mul nsw i32 %mul.epil, %19
%add54.epil = add nsw i32 %add45.epil, %mul53.epil
%a.b.i.epil = call i32 @llvm.smin.i32(i32 %storemerge108.unr, i32 %add54.epil)
store i32 %a.b.i.epil, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc63
for.inc63: ; preds = %for.inc63.unr-lcssa, %for.body31.epil
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
%exitcond141.not = icmp eq i64 %indvars.iv.next132, %wide.trip.count143
br i1 %exitcond141.not, label %for.inc66, label %for.body31.lr.ph, !llvm.loop !15
for.inc66: ; preds = %for.inc63, %for.cond18.preheader
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%exitcond144.not = icmp eq i64 %indvars.iv.next130, %wide.trip.count143
%indvar.next = add i64 %indvar, 1
br i1 %exitcond144.not, label %for.end68, label %for.cond18.preheader, !llvm.loop !16
for.end68: ; preds = %for.inc66, %entry, %for.cond5.preheader, %for.cond15.preheader
%.lcssa147150 = phi i32 [ %6, %for.cond15.preheader ], [ %6, %for.cond5.preheader ], [ %1, %entry ], [ %6, %for.inc66 ]
%arrayidx69 = getelementptr inbounds i32, ptr %vla1102, i64 101
%idxprom70 = sext i32 %.lcssa147150 to i64
%arrayidx71 = getelementptr inbounds i32, ptr %arrayidx69, i64 %idxprom70
%33 = load i32, ptr %arrayidx71, align 4, !tbaa !5
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
int n,a,b,c,d;
scanf("%d %d %d %d %d", &n, &a, &b, &c, &d);
if((n*(a-b) >= c-d && n*(a-b) <= c+d) || (n*(a+b) >= c-d && n*(a+b) <= c+d) || ((n*(a-b) < c-d) && (n*(a+b) > c+d))) printf("Yes\n");
else printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28462/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28462/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [15 x i8] c"%d %d %d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%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 %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec30 = add nsw i32 %0, -1
store i32 %dec30, ptr %t, align 4, !tbaa !5
%tobool.not31 = icmp eq i32 %0, 0
br i1 %tobool.not31, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %2, %3
%mul = mul nsw i32 %sub, %1
%4 = load i32, ptr %c, align 4, !tbaa !5
%5 = load i32, ptr %d, align 4, !tbaa !5
%sub2 = sub nsw i32 %4, %5
%cmp.not = icmp slt i32 %mul, %sub2
%add = add nsw i32 %5, %4
%cmp5.not = icmp sgt i32 %mul, %add
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp5.not
br i1 %or.cond, label %lor.lhs.false, label %if.end
lor.lhs.false: ; preds = %while.body
%add6 = add nsw i32 %3, %2
%mul7 = mul nsw i32 %add6, %1
%cmp9.not = icmp slt i32 %mul7, %sub2
%cmp14.not = icmp sgt i32 %mul7, %add
%or.cond28 = select i1 %cmp9.not, i1 true, i1 %cmp14.not
%or.cond28.not = xor i1 %or.cond28, true
%6 = select i1 %cmp.not, i1 %cmp14.not, i1 false
%or.cond29 = select i1 %or.cond28.not, i1 true, i1 %6
%spec.select = select i1 %or.cond29, ptr @str.4, ptr @str
br label %if.end
if.end: ; preds = %lor.lhs.false, %while.body
%str.sink = phi ptr [ @str.4, %while.body ], [ %spec.select, %lor.lhs.false ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
%7 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %7, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %7, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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>
#define N 100
int main(){
int n,l,i,p[N+1],m[N+1][N+1],k;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d%d",&p[i-1],&p[i]);
}
for(i=1;i<=n;i++)m[i][i]=0;
for(l=2;l<=n;l++){
for(i=1;i<=n-l+1;i++){
int j=i+l-1;
m[i][j]=(1<<21);
for(k=i;k<=j-1;k++){
if(m[i][j]>m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j])
m[i][j]=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
}
}
}
printf("%d\n",m[1][n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284663/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284663/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [101 x i32], align 16
%m = alloca [101 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not127 = icmp slt i32 %0, 1
br i1 %cmp.not127, label %for.end87, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5.not129 = icmp slt i32 %6, 1
br i1 %cmp5.not129, label %for.end87, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%3 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
br i1 %4, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %2, -4
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%5 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv140.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next141.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil
for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil
%indvars.iv140.epil = phi i64 [ %indvars.iv.next141.epil, %for.body6.epil ], [ %indvars.iv140.unr, %for.cond14.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv140.epil, i64 %indvars.iv140.epil
store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5
%indvars.iv.next141.epil = add nuw nsw i64 %indvars.iv140.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11
for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa
%cmp15.not135 = icmp slt i32 %6, 2
br i1 %cmp15.not135, label %for.end87, label %for.cond17.preheader.lr.ph
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%sub18 = add nuw i32 %6, 1
%wide.trip.count166 = zext i32 %sub18 to i64
br label %for.cond17.preheader
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv140 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next141.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv140, i64 %indvars.iv140
store i32 0, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141, i64 %indvars.iv.next141
store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next141.1 = add nuw nsw i64 %indvars.iv140, 2
%arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141.1, i64 %indvars.iv.next141.1
store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5
%indvars.iv.next141.2 = add nuw nsw i64 %indvars.iv140, 3
%arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next141.2, i64 %indvars.iv.next141.2
store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5
%indvars.iv.next141.3 = add nuw nsw i64 %indvars.iv140, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc85
%indvars.iv152 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next153, %for.inc85 ]
%indvars165 = trunc i64 %indvars.iv152 to i32
%add = sub i32 %sub18, %indvars165
%cmp19.not133 = icmp slt i32 %add, 1
br i1 %cmp19.not133, label %for.inc85, label %for.body30.lr.ph
for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.end81
%indvars.iv154 = phi i64 [ %indvars.iv.next155, %for.end81 ], [ %indvars.iv152, %for.cond17.preheader ]
%indvars.iv143 = phi i64 [ %indvars.iv.next144, %for.end81 ], [ 1, %for.cond17.preheader ]
%8 = add nuw nsw i64 %indvars.iv143, %indvars.iv152
%9 = add nsw i64 %8, -1
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv143, i64 %9
store i32 2097152, ptr %arrayidx26, align 4, !tbaa !5
%10 = add nsw i64 %indvars.iv143, -1
%arrayidx47 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %10
%11 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%arrayidx51 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %9
%12 = load i32, ptr %arrayidx51, align 4, !tbaa !5
br label %for.body30
for.body30: ; preds = %for.body30.lr.ph, %for.inc79
%indvars.iv145 = phi i64 [ %indvars.iv143, %for.body30.lr.ph ], [ %indvars.iv.next146, %for.inc79 ]
%13 = phi i32 [ 2097152, %for.body30.lr.ph ], [ %17, %for.inc79 ]
%arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv143, i64 %indvars.iv145
%14 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%arrayidx43 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next146, i64 %9
%15 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%add44 = add nsw i32 %15, %14
%arrayidx49 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv145
%16 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%mul = mul nsw i32 %16, %11
%mul52 = mul nsw i32 %mul, %12
%add53 = add nsw i32 %add44, %mul52
%cmp54 = icmp sgt i32 %13, %add53
br i1 %cmp54, label %if.then, label %for.inc79
if.then: ; preds = %for.body30
store i32 %add53, ptr %arrayidx26, align 4, !tbaa !5
br label %for.inc79
for.inc79: ; preds = %for.body30, %if.then
%17 = phi i32 [ %13, %for.body30 ], [ %add53, %if.then ]
%exitcond151.not = icmp eq i64 %indvars.iv.next146, %indvars.iv154
br i1 %exitcond151.not, label %for.end81, label %for.body30, !llvm.loop !14
for.end81: ; preds = %for.inc79
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%exitcond164.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count166
br i1 %exitcond164.not, label %for.inc85, label %for.body30.lr.ph, !llvm.loop !15
for.inc85: ; preds = %for.end81, %for.cond17.preheader
%indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
%exitcond167.not = icmp eq i64 %indvars.iv.next153, %wide.trip.count166
br i1 %exitcond167.not, label %for.end87, label %for.cond17.preheader, !llvm.loop !16
for.end87: ; preds = %for.inc85, %entry, %for.cond4.preheader, %for.cond14.preheader
%.lcssa170173 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc85 ]
%idxprom89 = sext i32 %.lcssa170173 to i64
%arrayidx90 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom89
%18 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%call91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
#include<math.h>
#define N 100
float inf = INFINITY;
int minof(int x, int y){
if(x < y)return (x);
else return (y);
}
int main(){
int n, i, k, j, l;
int p[N+1];
int m[N+1][N+1];
scanf("%d", &n);
for(i = 1; i <= n; i++){
scanf("%d%d", &p[i-1], &p[i]);
}
for(i = 0; i <= n; i ++){
m[i][i] = 0;
}
for(l = 2; l <= n; l++){
for(i = 1; i <= n - l + 1; i++){
j = i + l - 1;
m[i][j] = 1<<21; // 2^21を代入
for(k = i; k <= j - 1; k++){
m[i][j] = minof(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
}
}
}
printf("%d\n", m[1][n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284706/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284706/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@inf = dso_local local_unnamed_addr global float 0x7FF0000000000000, align 4
@.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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @minof(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%x.y = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %x.y
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%p = alloca [101 x i32], align 16
%m = alloca [101 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #5
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not100 = icmp slt i32 %0, 1
br i1 %cmp.not100, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %4, %for.body ]
%cmp5.not102 = icmp slt i32 %.lcssa, 0
br i1 %cmp5.not102, label %for.end67, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = add nuw i32 %.lcssa, 1
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 3
%2 = icmp ult i32 %.lcssa, 3
br i1 %2, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%3 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %3
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%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.cond4.preheader, !llvm.loop !9
for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv114.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next115.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil
for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil
%indvars.iv114.epil = phi i64 [ %indvars.iv.next115.epil, %for.body6.epil ], [ %indvars.iv114.unr, %for.cond14.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv114.epil, i64 %indvars.iv114.epil
store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5
%indvars.iv.next115.epil = add nuw nsw i64 %indvars.iv114.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11
for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa
%cmp15.not109 = icmp slt i32 %.lcssa, 2
br i1 %cmp15.not109, label %for.end67, label %for.cond17.preheader.lr.ph
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%sub18 = add nuw i32 %.lcssa, 1
%wide.trip.count140 = zext i32 %sub18 to i64
br label %for.cond17.preheader
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv114 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next115.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv114, i64 %indvars.iv114
store i32 0, ptr %arrayidx10, align 16, !tbaa !5
%indvars.iv.next115 = or i64 %indvars.iv114, 1
%arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115, i64 %indvars.iv.next115
store i32 0, ptr %arrayidx10.1, align 8, !tbaa !5
%indvars.iv.next115.1 = or i64 %indvars.iv114, 2
%arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115.1, i64 %indvars.iv.next115.1
store i32 0, ptr %arrayidx10.2, align 16, !tbaa !5
%indvars.iv.next115.2 = or i64 %indvars.iv114, 3
%arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115.2, i64 %indvars.iv.next115.2
store i32 0, ptr %arrayidx10.3, align 8, !tbaa !5
%indvars.iv.next115.3 = add nuw nsw i64 %indvars.iv114, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc65
%indvars.iv126 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next127, %for.inc65 ]
%indvars139 = trunc i64 %indvars.iv126 to i32
%add = sub i32 %sub18, %indvars139
%cmp19.not107 = icmp slt i32 %add, 1
br i1 %cmp19.not107, label %for.inc65, label %for.body30.lr.ph
for.body30.lr.ph: ; preds = %for.cond17.preheader, %for.inc62
%indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.inc62 ], [ %indvars.iv126, %for.cond17.preheader ]
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.inc62 ], [ 1, %for.cond17.preheader ]
%6 = add nuw nsw i64 %indvars.iv117, %indvars.iv126
%7 = add nsw i64 %6, -1
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv117, i64 %7
store i32 2097152, ptr %arrayidx26, align 4, !tbaa !5
%8 = add nsw i64 %indvars.iv117, -1
%arrayidx47 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %8
%9 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%arrayidx51 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %7
%10 = load i32, ptr %arrayidx51, align 4, !tbaa !5
br label %for.body30
for.body30: ; preds = %for.body30.lr.ph, %for.body30
%indvars.iv119 = phi i64 [ %indvars.iv117, %for.body30.lr.ph ], [ %indvars.iv.next120, %for.body30 ]
%storemerge105 = phi i32 [ 2097152, %for.body30.lr.ph ], [ %x.y.i, %for.body30 ]
%arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv117, i64 %indvars.iv119
%11 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%arrayidx43 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next120, i64 %7
%12 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%add44 = add nsw i32 %12, %11
%arrayidx49 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv119
%13 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%mul = mul nsw i32 %13, %9
%mul52 = mul nsw i32 %mul, %10
%add53 = add nsw i32 %add44, %mul52
%x.y.i = call i32 @llvm.smin.i32(i32 %storemerge105, i32 %add53)
store i32 %x.y.i, ptr %arrayidx26, align 4, !tbaa !5
%exitcond125.not = icmp eq i64 %indvars.iv.next120, %indvars.iv128
br i1 %exitcond125.not, label %for.inc62, label %for.body30, !llvm.loop !14
for.inc62: ; preds = %for.body30
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%exitcond138.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count140
br i1 %exitcond138.not, label %for.inc65, label %for.body30.lr.ph, !llvm.loop !15
for.inc65: ; preds = %for.inc62, %for.cond17.preheader
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%exitcond141.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count140
br i1 %exitcond141.not, label %for.end67, label %for.cond17.preheader, !llvm.loop !16
for.end67: ; preds = %for.inc65, %for.cond4.preheader, %for.cond14.preheader
%idxprom69 = sext i32 %.lcssa to i64
%arrayidx70 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom69
%14 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int t;
scanf("%d",&t);
while(t!=0)
{
int n,a,b,c,d;
scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
int ming = n*(abs(a-b));
int maxg = n*(a+b);
int mint = (abs(c-d));
int maxt = (c+d);
if(((ming<mint)&&(maxg<mint))||((ming>maxt)&&(maxg>maxt))) printf("No");
else printf("Yes");
// t--;
if(t!=1)printf("\n");
t--;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28475/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28475/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%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 %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not21 = icmp eq i32 %0, 0
br i1 %cmp.not21, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end15
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %2, %3
%4 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%mul = mul nsw i32 %4, %1
%add = add nsw i32 %3, %2
%mul2 = mul nsw i32 %add, %1
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = load i32, ptr %d, align 4, !tbaa !5
%sub3 = sub nsw i32 %5, %6
%7 = call i32 @llvm.abs.i32(i32 %sub3, i1 true)
%cmp5 = icmp slt i32 %mul, %7
%cmp6 = icmp slt i32 %mul2, %7
%or.cond = select i1 %cmp5, i1 %cmp6, i1 false
br i1 %or.cond, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %while.body
%add4 = add nsw i32 %6, %5
%cmp7 = icmp sgt i32 %mul, %add4
%cmp9 = icmp sgt i32 %mul2, %add4
%or.cond20 = select i1 %cmp7, i1 %cmp9, i1 false
%spec.select = select i1 %or.cond20, ptr @.str.2, ptr @.str.3
br label %if.end
if.end: ; preds = %lor.lhs.false, %while.body
%.str.3.sink = phi ptr [ @.str.2, %while.body ], [ %spec.select, %lor.lhs.false ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
%8 = load i32, ptr %t, align 4, !tbaa !5
%cmp12.not = icmp eq i32 %8, 1
br i1 %cmp12.not, label %if.end15.thread, label %if.end15
if.end15.thread: ; preds = %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
br label %while.end
if.end15: ; preds = %if.end
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %.pre, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
%cmp.not = icmp eq i32 %dec, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end15, %if.end15.thread, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int min(int ,int);
int main(){
int i,j,k,l,n,m[101][101],x[101];
scanf("%d",&n);
for(i=1;i<=n;i++) scanf("%d %d",&x[i-1],&x[i]);
for(i=1;i<=n;i++) m[i][i]=0;
for(j=2;j<=n;j++){
for(i=0;i<=n-j+1;i++){
l=i+j-1;
m[i][l]=(1<<21);
for(k=i;k<=l-1;k++){
m[i][l]=min(m[i][l],m[i][k]+m[k+1][l]+x[i-1]*x[k]*x[l]);
}
}
}
printf("%d\n",m[1][n]);
return 0;
}
int min(int x,int y){
return x<y ? x:y;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284793/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284793/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca [101 x [101 x i32]], align 16
%x = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not100 = icmp slt i32 %0, 1
br i1 %cmp.not100, label %for.end67, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5.not102 = icmp slt i32 %6, 1
br i1 %cmp5.not102, label %for.end67, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%3 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
br i1 %4, label %for.cond14.preheader.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %2, -4
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%5 = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond14.preheader.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv114.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next115.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond14.preheader, label %for.body6.epil
for.body6.epil: ; preds = %for.cond14.preheader.unr-lcssa, %for.body6.epil
%indvars.iv114.epil = phi i64 [ %indvars.iv.next115.epil, %for.body6.epil ], [ %indvars.iv114.unr, %for.cond14.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond14.preheader.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv114.epil, i64 %indvars.iv114.epil
store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5
%indvars.iv.next115.epil = add nuw nsw i64 %indvars.iv114.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.cond14.preheader, label %for.body6.epil, !llvm.loop !11
for.cond14.preheader: ; preds = %for.body6.epil, %for.cond14.preheader.unr-lcssa
%cmp15.not109 = icmp slt i32 %6, 2
br i1 %cmp15.not109, label %for.end67, label %for.cond17.preheader.lr.ph
for.cond17.preheader.lr.ph: ; preds = %for.cond14.preheader
%sub18 = add nuw i32 %6, 1
%wide.trip.count148 = zext i32 %sub18 to i64
br label %for.cond17.preheader
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv114 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next115.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv114, i64 %indvars.iv114
store i32 0, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%arrayidx10.1 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115, i64 %indvars.iv.next115
store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next115.1 = add nuw nsw i64 %indvars.iv114, 2
%arrayidx10.2 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115.1, i64 %indvars.iv.next115.1
store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5
%indvars.iv.next115.2 = add nuw nsw i64 %indvars.iv114, 3
%arrayidx10.3 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next115.2, i64 %indvars.iv.next115.2
store i32 0, ptr %arrayidx10.3, align 4, !tbaa !5
%indvars.iv.next115.3 = add nuw nsw i64 %indvars.iv114, 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.cond14.preheader.unr-lcssa, label %for.body6, !llvm.loop !13
for.cond17.preheader: ; preds = %for.cond17.preheader.lr.ph, %for.inc65
%indvars.iv143 = phi i64 [ 2, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next144, %for.inc65 ]
%indvars.iv139 = phi i32 [ %6, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next140, %for.inc65 ]
%indvars.iv128 = phi i64 [ 1, %for.cond17.preheader.lr.ph ], [ %indvars.iv.next129, %for.inc65 ]
%indvars147 = trunc i64 %indvars.iv143 to i32
%add = sub i32 %sub18, %indvars147
%cmp19.not107 = icmp slt i32 %add, 0
br i1 %cmp19.not107, label %for.inc65, label %for.body20.preheader
for.body20.preheader: ; preds = %for.cond17.preheader
%wide.trip.count141 = zext i32 %indvars.iv139 to i64
br label %for.body30.lr.ph
for.body30.lr.ph: ; preds = %for.inc62, %for.body20.preheader
%indvars.iv130 = phi i64 [ %indvars.iv128, %for.body20.preheader ], [ %indvars.iv.next131, %for.inc62 ]
%indvars.iv117 = phi i64 [ 0, %for.body20.preheader ], [ %indvars.iv.next118, %for.inc62 ]
%8 = add nuw nsw i64 %indvars.iv117, %indvars.iv143
%9 = add nsw i64 %8, -1
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv117, i64 %9
store i32 2097152, ptr %arrayidx26, align 4, !tbaa !5
%10 = add nsw i64 %indvars.iv117, -1
%arrayidx47 = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %10
%11 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%arrayidx51 = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %9
%12 = load i32, ptr %arrayidx51, align 4, !tbaa !5
br label %for.body30
for.body30: ; preds = %for.body30.lr.ph, %for.body30
%indvars.iv119 = phi i64 [ %indvars.iv117, %for.body30.lr.ph ], [ %indvars.iv.next120, %for.body30 ]
%storemerge105 = phi i32 [ 2097152, %for.body30.lr.ph ], [ %cond.i, %for.body30 ]
%arrayidx38 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv117, i64 %indvars.iv119
%13 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%arrayidx43 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 %indvars.iv.next120, i64 %9
%14 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%add44 = add nsw i32 %14, %13
%arrayidx49 = getelementptr inbounds [101 x i32], ptr %x, i64 0, i64 %indvars.iv119
%15 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%mul = mul nsw i32 %15, %11
%mul52 = mul nsw i32 %mul, %12
%add53 = add nsw i32 %add44, %mul52
%cond.i = call i32 @llvm.smin.i32(i32 %storemerge105, i32 %add53)
store i32 %cond.i, ptr %arrayidx26, align 4, !tbaa !5
%exitcond127.not = icmp eq i64 %indvars.iv.next120, %indvars.iv130
br i1 %exitcond127.not, label %for.inc62, label %for.body30, !llvm.loop !14
for.inc62: ; preds = %for.body30
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%exitcond142.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count141
br i1 %exitcond142.not, label %for.inc65, label %for.body30.lr.ph, !llvm.loop !15
for.inc65: ; preds = %for.inc62, %for.cond17.preheader
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%indvars.iv.next140 = add i32 %indvars.iv139, -1
%exitcond149.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count148
br i1 %exitcond149.not, label %for.end67, label %for.cond17.preheader, !llvm.loop !16
for.end67: ; preds = %for.inc65, %entry, %for.cond4.preheader, %for.cond14.preheader
%.lcssa152155 = phi i32 [ %6, %for.cond14.preheader ], [ %6, %for.cond4.preheader ], [ %0, %entry ], [ %6, %for.inc65 ]
%idxprom69 = sext i32 %.lcssa152155 to i64
%arrayidx70 = getelementptr inbounds [101 x [101 x i32]], ptr %m, i64 0, i64 1, i64 %idxprom69
%16 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; 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) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree 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 = { 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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
#include<math.h>
static int N=100;
int main()
{
int i,l,j,k,n,p[N+1],m[N+1][N+1];
scanf("%d",&n);
for( i=1; i<=n; i++ )
{
scanf("%d",&p[i-1]);
scanf("%d",&p[i]);
}
for( i = 1; i <= n; i++ )
m[i][i]=0;
for( l = 2; l <= n; l++ )
{
for( i = 1; i <= n-l+1; i++ )
{
j = i+l-1;
m[i][j]=1<<21;
for( k = i; k <= j-1; k++ )
{
m[i][j]=fmin(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
}
}
}
printf("%d",m[1][n]);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284836/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284836/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%0 = tail call ptr @llvm.stacksave.p0()
%vla107 = alloca [101 x i32], align 16
%vla3108 = alloca [10201 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not109 = icmp slt i32 %1, 1
br i1 %cmp.not109, label %for.end73, label %for.body.preheader
for.body.preheader: ; preds = %entry
%invariant.gep157 = getelementptr i32, ptr %vla107, i64 -1
br label %for.body
for.cond8.preheader: ; preds = %for.body
%cmp9.not111 = icmp slt i32 %6, 1
br i1 %cmp9.not111, label %for.end73, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond8.preheader
%2 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%4 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %3, 3
%5 = icmp ult i64 %4, 3
br i1 %5, label %for.cond18.preheader.unr-lcssa, label %for.body10.preheader.new
for.body10.preheader.new: ; preds = %for.body10.preheader
%unroll_iter = and i64 %3, -4
br label %for.body10
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%gep158 = getelementptr i32, ptr %invariant.gep157, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %gep158)
%arrayidx6 = getelementptr inbounds i32, ptr %vla107, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond18.preheader.unr-lcssa: ; preds = %for.body10, %for.body10.preheader
%indvars.iv123.unr = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next124.3, %for.body10 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond18.preheader, label %for.body10.epil
for.body10.epil: ; preds = %for.cond18.preheader.unr-lcssa, %for.body10.epil
%indvars.iv123.epil = phi i64 [ %indvars.iv.next124.epil, %for.body10.epil ], [ %indvars.iv123.unr, %for.cond18.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body10.epil ], [ 0, %for.cond18.preheader.unr-lcssa ]
%8 = mul nuw nsw i64 %indvars.iv123.epil, 101
%arrayidx12.epil = getelementptr inbounds i32, ptr %vla3108, i64 %8
%arrayidx14.epil = getelementptr inbounds i32, ptr %arrayidx12.epil, i64 %indvars.iv123.epil
store i32 0, ptr %arrayidx14.epil, align 4, !tbaa !5
%indvars.iv.next124.epil = add nuw nsw i64 %indvars.iv123.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.cond18.preheader, label %for.body10.epil, !llvm.loop !11
for.cond18.preheader: ; preds = %for.body10.epil, %for.cond18.preheader.unr-lcssa
%cmp19.not118 = icmp slt i32 %6, 2
br i1 %cmp19.not118, label %for.end73, label %for.cond21.preheader.lr.ph
for.cond21.preheader.lr.ph: ; preds = %for.cond18.preheader
%sub22 = add nuw i32 %6, 1
%wide.trip.count149 = zext i32 %sub22 to i64
%invariant.gep159 = getelementptr i32, ptr %vla107, i64 -1
br label %for.cond21.preheader
for.body10: ; preds = %for.body10, %for.body10.preheader.new
%indvars.iv123 = phi i64 [ 1, %for.body10.preheader.new ], [ %indvars.iv.next124.3, %for.body10 ]
%niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.3, %for.body10 ]
%9 = mul nuw nsw i64 %indvars.iv123, 101
%arrayidx12 = getelementptr inbounds i32, ptr %vla3108, i64 %9
%arrayidx14 = getelementptr inbounds i32, ptr %arrayidx12, i64 %indvars.iv123
store i32 0, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%10 = mul nuw nsw i64 %indvars.iv.next124, 101
%arrayidx12.1 = getelementptr inbounds i32, ptr %vla3108, i64 %10
%arrayidx14.1 = getelementptr inbounds i32, ptr %arrayidx12.1, i64 %indvars.iv.next124
store i32 0, ptr %arrayidx14.1, align 4, !tbaa !5
%indvars.iv.next124.1 = add nuw nsw i64 %indvars.iv123, 2
%11 = mul nuw nsw i64 %indvars.iv.next124.1, 101
%arrayidx12.2 = getelementptr inbounds i32, ptr %vla3108, i64 %11
%arrayidx14.2 = getelementptr inbounds i32, ptr %arrayidx12.2, i64 %indvars.iv.next124.1
store i32 0, ptr %arrayidx14.2, align 4, !tbaa !5
%indvars.iv.next124.2 = add nuw nsw i64 %indvars.iv123, 3
%12 = mul nuw nsw i64 %indvars.iv.next124.2, 101
%arrayidx12.3 = getelementptr inbounds i32, ptr %vla3108, i64 %12
%arrayidx14.3 = getelementptr inbounds i32, ptr %arrayidx12.3, i64 %indvars.iv.next124.2
store i32 0, ptr %arrayidx14.3, align 4, !tbaa !5
%indvars.iv.next124.3 = add nuw nsw i64 %indvars.iv123, 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.cond18.preheader.unr-lcssa, label %for.body10, !llvm.loop !13
for.cond21.preheader: ; preds = %for.cond21.preheader.lr.ph, %for.inc71
%indvars.iv135 = phi i64 [ 2, %for.cond21.preheader.lr.ph ], [ %indvars.iv.next136, %for.inc71 ]
%indvars148 = trunc i64 %indvars.iv135 to i32
%add23 = sub i32 %sub22, %indvars148
%cmp24.not116 = icmp slt i32 %add23, 1
br i1 %cmp24.not116, label %for.inc71, label %for.body35.lr.ph
for.body35.lr.ph: ; preds = %for.cond21.preheader, %for.inc68
%indvars.iv137 = phi i64 [ %indvars.iv.next138, %for.inc68 ], [ %indvars.iv135, %for.cond21.preheader ]
%indvars.iv126 = phi i64 [ %indvars.iv.next127, %for.inc68 ], [ 1, %for.cond21.preheader ]
%13 = add nuw nsw i64 %indvars.iv126, %indvars.iv135
%14 = add nsw i64 %13, -1
%15 = mul nuw nsw i64 %indvars.iv126, 101
%arrayidx29 = getelementptr inbounds i32, ptr %vla3108, i64 %15
%arrayidx31 = getelementptr inbounds i32, ptr %arrayidx29, i64 %14
%invariant.gep = getelementptr i32, ptr %vla3108, i64 %14
store i32 2097152, ptr %arrayidx31, align 4, !tbaa !5
%gep160 = getelementptr i32, ptr %invariant.gep159, i64 %indvars.iv126
%16 = load i32, ptr %gep160, align 4, !tbaa !5
%arrayidx56 = getelementptr inbounds i32, ptr %vla107, i64 %14
%17 = load i32, ptr %arrayidx56, align 4, !tbaa !5
br label %for.body35
for.body35: ; preds = %for.body35.lr.ph, %for.body35
%indvars.iv128 = phi i64 [ %indvars.iv126, %for.body35.lr.ph ], [ %indvars.iv.next129, %for.body35 ]
%storemerge114 = phi i32 [ 2097152, %for.body35.lr.ph ], [ %conv60, %for.body35 ]
%conv = sitofp i32 %storemerge114 to double
%arrayidx43 = getelementptr inbounds i32, ptr %arrayidx29, i64 %indvars.iv128
%18 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%19 = mul nuw nsw i64 %indvars.iv.next129, 101
%gep = getelementptr i32, ptr %invariant.gep, i64 %19
%20 = load i32, ptr %gep, align 4, !tbaa !5
%add49 = add nsw i32 %20, %18
%arrayidx54 = getelementptr inbounds i32, ptr %vla107, i64 %indvars.iv128
%21 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%mul = mul nsw i32 %21, %16
%mul57 = mul nsw i32 %mul, %17
%add58 = add nsw i32 %add49, %mul57
%conv59 = sitofp i32 %add58 to double
%22 = call double @llvm.minnum.f64(double %conv, double %conv59)
%conv60 = fptosi double %22 to i32
store i32 %conv60, ptr %arrayidx31, align 4, !tbaa !5
%exitcond134.not = icmp eq i64 %indvars.iv.next129, %indvars.iv137
br i1 %exitcond134.not, label %for.inc68, label %for.body35, !llvm.loop !14
for.inc68: ; preds = %for.body35
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
%exitcond147.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count149
br i1 %exitcond147.not, label %for.inc71, label %for.body35.lr.ph, !llvm.loop !15
for.inc71: ; preds = %for.inc68, %for.cond21.preheader
%indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
%exitcond150.not = icmp eq i64 %indvars.iv.next136, %wide.trip.count149
br i1 %exitcond150.not, label %for.end73, label %for.cond21.preheader, !llvm.loop !16
for.end73: ; preds = %for.inc71, %entry, %for.cond8.preheader, %for.cond18.preheader
%.lcssa153156 = phi i32 [ %6, %for.cond18.preheader ], [ %6, %for.cond8.preheader ], [ %1, %entry ], [ %6, %for.inc71 ]
%arrayidx74 = getelementptr inbounds i32, ptr %vla3108, i64 101
%idxprom75 = sext i32 %.lcssa153156 to i64
%arrayidx76 = getelementptr inbounds i32, ptr %arrayidx74, i64 %idxprom75
%23 = load i32, ptr %arrayidx76, align 4, !tbaa !5
%call77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %23)
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.minnum.f64(double, double) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main( void )
{
int a[4];
scanf( "%d%d%d", &a[0], &a[1], &a[2] );
int i,j;
for( i=0; i<3; i++ ) {
for( j=i+1; j<3; j++ ) {
if( a[j] < a[i] ) {
a[3]=a[i];
a[i]=a[j];
a[j]=a[3];
}
}
}
printf( "%d %d %d\n", a[0], a[1], a[2] );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284887/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284887/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
for.body5.lr.ph:
%a = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #3
%arrayidx1 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%arrayidx12 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 3
%0 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%1 = load i32, ptr %a, align 16, !tbaa !5
%cmp9 = icmp slt i32 %0, %1
br i1 %cmp9, label %if.then, label %for.inc
for.body5.lr.ph.1: ; preds = %if.then.149, %for.inc
%2 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%3 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp9.1 = icmp slt i32 %2, %3
br i1 %cmp9.1, label %if.then.1, label %for.cond.loopexit.2
if.then.1: ; preds = %for.body5.lr.ph.1
store i32 %3, ptr %arrayidx12, align 4, !tbaa !5
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
store i32 %3, ptr %arrayidx2, align 8, !tbaa !5
br label %for.cond.loopexit.2
for.cond.loopexit.2: ; preds = %if.then.1, %for.body5.lr.ph.1
%4 = load i32, ptr %a, align 16, !tbaa !5
%5 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%6 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4, i32 noundef %5, i32 noundef %6)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %a) #3
ret i32 0
if.then: ; preds = %for.body5.lr.ph
store i32 %1, ptr %arrayidx12, align 4, !tbaa !5
store i32 %0, ptr %a, align 16, !tbaa !5
store i32 %1, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body5.lr.ph, %if.then
%7 = phi i32 [ %1, %for.body5.lr.ph ], [ %0, %if.then ]
%8 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%cmp9.147 = icmp slt i32 %8, %7
br i1 %cmp9.147, label %if.then.149, label %for.body5.lr.ph.1
if.then.149: ; preds = %for.inc
store i32 %7, ptr %arrayidx12, align 4, !tbaa !5
store i32 %8, ptr %a, align 16, !tbaa !5
store i32 %7, ptr %arrayidx2, align 8, !tbaa !5
br label %for.body5.lr.ph.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: 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<math.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int x,y,sx,sy;
double dp[1100][1100], tmp;
double ab(double x){ if(x<0) return -x; return x; }
int main(){
int i,j,k,l,m,n,loop,loop_mx;
double per;
scanf("%d%d%d%d",&x,&y,&sx,&sy);
sx--; sy--;
if(y==1){ printf("%.10lf\n",2.0*(x-1-sx)); return 0; }
if(y==1) per = 3;
else per = (3+3+4*(y-2))/(double)y;
rep(i,x) rep(j,y) dp[i][j]=(x-1-i)*per;
loop_mx = 90000000 / x / y;
for(i=x-2;i>=0;i--){
rep(loop,loop_mx){
double err=0;
rep(j,y){
if(j==0) tmp = (dp[i+1][j] + dp[i][j] + dp[i][j+1])/3;
else if(j==y-1) tmp = (dp[i+1][j] + dp[i][j] + dp[i][j-1])/3;
else tmp = (dp[i+1][j] + dp[i][j] + dp[i][j-1] + dp[i][j+1])/4;
tmp += 1;
err += ab(dp[i][j]-tmp);
dp[i][j]=tmp;
}
}
}
printf("%.10lf\n",dp[sx][sy]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28493/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28493/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@x = dso_local global i32 0, align 4
@y = dso_local global i32 0, align 4
@sx = dso_local global i32 0, align 4
@sy = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [8 x i8] c"%.10lf\0A\00", align 1
@dp = dso_local local_unnamed_addr global [1100 x [1100 x double]] zeroinitializer, align 16
@tmp = dso_local local_unnamed_addr global double 0.000000e+00, align 8
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @ab(double noundef %x) local_unnamed_addr #0 {
entry:
%cmp = fcmp olt double %x, 0.000000e+00
%fneg = fneg double %x
%retval.0 = select i1 %cmp, double %fneg, double %x
ret double %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x, ptr noundef nonnull @y, ptr noundef nonnull @sx, ptr noundef nonnull @sy)
%0 = load i32, ptr @sx, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @sx, align 4, !tbaa !5
%1 = load i32, ptr @sy, align 4, !tbaa !5
%dec1 = add nsw i32 %1, -1
store i32 %dec1, ptr @sy, align 4, !tbaa !5
%2 = load i32, ptr @y, align 4, !tbaa !5
%cmp = icmp eq i32 %2, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%3 = load i32, ptr @x, align 4, !tbaa !5
%sub2 = sub i32 %3, %0
%conv = sitofp i32 %sub2 to double
%mul = fmul double %conv, 2.000000e+00
br label %cleanup
if.else: ; preds = %entry
%sub7 = shl i32 %2, 2
%add = add i32 %sub7, -2
%conv9 = sitofp i32 %add to double
%conv10 = sitofp i32 %2 to double
%div = fdiv double %conv9, %conv10
%4 = load i32, ptr @x, align 4, !tbaa !5
%cmp12184 = icmp sgt i32 %4, 0
br i1 %cmp12184, label %for.cond14.preheader.lr.ph, label %for.end130
for.cond14.preheader.lr.ph: ; preds = %if.else
%cmp15182 = icmp sgt i32 %2, 0
br i1 %cmp15182, label %for.cond14.preheader.us.preheader, label %for.end26
for.cond14.preheader.us.preheader: ; preds = %for.cond14.preheader.lr.ph
%wide.trip.count205 = zext i32 %4 to i64
%wide.trip.count = zext i32 %2 to i64
%min.iters.check = icmp ult i32 %2, 4
%n.vec = and i64 %wide.trip.count, 4294967292
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond14.preheader.us
for.cond14.preheader.us: ; preds = %for.cond14.preheader.us.preheader, %for.cond14.for.inc24_crit_edge.us
%indvars.iv202 = phi i64 [ 0, %for.cond14.preheader.us.preheader ], [ %indvars.iv.next203, %for.cond14.for.inc24_crit_edge.us ]
%indvars204 = trunc i64 %indvars.iv202 to i32
%5 = xor i32 %indvars204, -1
%sub19.us = add i32 %4, %5
%conv20.us = sitofp i32 %sub19.us to double
%mul21.us = fmul double %div, %conv20.us
br i1 %min.iters.check, label %for.body17.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond14.preheader.us
%broadcast.splatinsert = insertelement <2 x double> poison, double %mul21.us, i64 0
%broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> 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 ]
%6 = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv202, i64 %index
store <2 x double> %broadcast.splat, ptr %6, align 16, !tbaa !9
%7 = getelementptr inbounds double, ptr %6, i64 2
store <2 x double> %broadcast.splat, 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
br i1 %cmp.n, label %for.cond14.for.inc24_crit_edge.us, label %for.body17.us.preheader
for.body17.us.preheader: ; preds = %for.cond14.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond14.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body17.us
for.body17.us: ; preds = %for.body17.us.preheader, %for.body17.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body17.us ], [ %indvars.iv.ph, %for.body17.us.preheader ]
%arrayidx23.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv202, i64 %indvars.iv
store double %mul21.us, ptr %arrayidx23.us, 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.cond14.for.inc24_crit_edge.us, label %for.body17.us, !llvm.loop !15
for.cond14.for.inc24_crit_edge.us: ; preds = %for.body17.us, %middle.block
%indvars.iv.next203 = add nuw nsw i64 %indvars.iv202, 1
%exitcond206.not = icmp eq i64 %indvars.iv.next203, %wide.trip.count205
br i1 %exitcond206.not, label %for.end26, label %for.cond14.preheader.us, !llvm.loop !16
for.end26: ; preds = %for.cond14.for.inc24_crit_edge.us, %for.cond14.preheader.lr.ph
%div27 = sdiv i32 90000000, %4
%div28 = sdiv i32 %div27, %2
%sub29 = add i32 %4, -2
%cmp31191 = icmp sgt i32 %4, 1
br i1 %cmp31191, label %for.cond34.preheader.lr.ph, label %for.end130
for.cond34.preheader.lr.ph: ; preds = %for.end26
%cmp35189 = icmp sgt i32 %div28, 0
%cmp39187 = icmp sgt i32 %2, 0
%or.cond = and i1 %cmp35189, %cmp39187
br i1 %or.cond, label %for.cond34.preheader.us.us.preheader, label %for.end130
for.cond34.preheader.us.us.preheader: ; preds = %for.cond34.preheader.lr.ph
%sub63 = add nsw i32 %2, -1
%9 = zext i32 %sub63 to i64
%10 = zext i32 %sub29 to i64
%wide.trip.count213 = zext i32 %2 to i64
%exitcond214.peel.not = icmp eq i32 %2, 1
%11 = add nsw i64 %9, -1
br label %for.cond34.preheader.us.us
for.cond34.preheader.us.us: ; preds = %for.cond34.preheader.us.us.preheader, %for.cond34.for.inc128_crit_edge.split.us.us.us
%indvars.iv217 = phi i64 [ %10, %for.cond34.preheader.us.us.preheader ], [ %indvars.iv.next218, %for.cond34.for.inc128_crit_edge.split.us.us.us ]
%12 = add nuw nsw i64 %indvars.iv217, 1
%arrayidx47.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %12
%arrayidx51.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv217
%arrayidx59.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv217, i64 1
%arrayidx71.us.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %12, i64 %9
%arrayidx75.us.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv217, i64 %9
%arrayidx81.us.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv217, i64 %11
br label %if.end109.us.us.us.peel
if.end109.us.us.us.peel: ; preds = %for.cond38.for.end124_crit_edge.us.us.us, %for.cond34.preheader.us.us
%loop.0190.us.us.us = phi i32 [ 0, %for.cond34.preheader.us.us ], [ %inc126.us.us.us, %for.cond38.for.end124_crit_edge.us.us.us ]
%13 = load double, ptr %arrayidx47.us.us, align 16, !tbaa !9
%14 = load double, ptr %arrayidx51.us.us, align 16, !tbaa !9
%add54.us.us.us.peel = fadd double %13, %14
%15 = load double, ptr %arrayidx59.us.us, align 8, !tbaa !9
%add60.us.us.us.peel = fadd double %add54.us.us.us.peel, %15
%div61.us.us.us.peel = fdiv double %add60.us.us.us.peel, 3.000000e+00
%add110.us.us.us.peel = fadd double %div61.us.us.us.peel, 1.000000e+00
store double %add110.us.us.us.peel, ptr %arrayidx51.us.us, align 16, !tbaa !9
br i1 %exitcond214.peel.not, label %for.cond38.for.end124_crit_edge.us.us.us, label %if.else62.us.us.us
if.else62.us.us.us: ; preds = %if.end109.us.us.us.peel, %if.end109.us.us.us
%indvars.iv207 = phi i64 [ %indvars.iv.next208, %if.end109.us.us.us ], [ 1, %if.end109.us.us.us.peel ]
%cmp64.us.us.us = icmp eq i64 %indvars.iv207, %9
br i1 %cmp64.us.us.us, label %if.then66.us.us.us, label %if.else84.us.us.us
if.else84.us.us.us: ; preds = %if.else62.us.us.us
%arrayidx89.us.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %12, i64 %indvars.iv207
%16 = load double, ptr %arrayidx89.us.us.us, align 8, !tbaa !9
%arrayidx93.us.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv217, i64 %indvars.iv207
%17 = load double, ptr %arrayidx93.us.us.us, align 8, !tbaa !9
%add94.us.us.us = fadd double %16, %17
%18 = add nsw i64 %indvars.iv207, -1
%arrayidx99.us.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv217, i64 %18
%19 = load double, ptr %arrayidx99.us.us.us, align 8, !tbaa !9
%add100.us.us.us = fadd double %add94.us.us.us, %19
%20 = add nuw nsw i64 %indvars.iv207, 1
%arrayidx105.us.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv217, i64 %20
%21 = load double, ptr %arrayidx105.us.us.us, align 8, !tbaa !9
%add106.us.us.us = fadd double %add100.us.us.us, %21
%div107.us.us.us = fmul double %add106.us.us.us, 2.500000e-01
br label %if.end109.us.us.us
if.then66.us.us.us: ; preds = %if.else62.us.us.us
%22 = load double, ptr %arrayidx71.us.us.us, align 8, !tbaa !9
%23 = load double, ptr %arrayidx75.us.us.us, align 8, !tbaa !9
%add76.us.us.us = fadd double %22, %23
%24 = load double, ptr %arrayidx81.us.us.us, align 8, !tbaa !9
%add82.us.us.us = fadd double %add76.us.us.us, %24
%div83.us.us.us = fdiv double %add82.us.us.us, 3.000000e+00
br label %if.end109.us.us.us
if.end109.us.us.us: ; preds = %if.then66.us.us.us, %if.else84.us.us.us
%add110186.us.us.us = phi double [ %div83.us.us.us, %if.then66.us.us.us ], [ %div107.us.us.us, %if.else84.us.us.us ]
%add110.us.us.us = fadd double %add110186.us.us.us, 1.000000e+00
%arrayidx114.us.us.us = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %indvars.iv217, i64 %indvars.iv207
store double %add110.us.us.us, ptr %arrayidx114.us.us.us, align 8, !tbaa !9
%indvars.iv.next208 = add nuw nsw i64 %indvars.iv207, 1
%exitcond214.not = icmp eq i64 %indvars.iv.next208, %wide.trip.count213
br i1 %exitcond214.not, label %for.cond38.for.end124_crit_edge.us.us.us, label %if.else62.us.us.us, !llvm.loop !17
for.cond38.for.end124_crit_edge.us.us.us: ; preds = %if.end109.us.us.us, %if.end109.us.us.us.peel
%add110.us.us.us.lcssa = phi double [ %add110.us.us.us.peel, %if.end109.us.us.us.peel ], [ %add110.us.us.us, %if.end109.us.us.us ]
%inc126.us.us.us = add nuw nsw i32 %loop.0190.us.us.us, 1
%exitcond216.not = icmp eq i32 %inc126.us.us.us, %div28
br i1 %exitcond216.not, label %for.cond34.for.inc128_crit_edge.split.us.us.us, label %if.end109.us.us.us.peel, !llvm.loop !19
for.cond34.for.inc128_crit_edge.split.us.us.us: ; preds = %for.cond38.for.end124_crit_edge.us.us.us
%indvars.iv.next218 = add nsw i64 %indvars.iv217, -1
%cmp31.us.us = icmp sgt i64 %indvars.iv217, 0
br i1 %cmp31.us.us, label %for.cond34.preheader.us.us, label %for.cond30.for.end130_crit_edge.split.us.split.us, !llvm.loop !20
for.cond30.for.end130_crit_edge.split.us.split.us: ; preds = %for.cond34.for.inc128_crit_edge.split.us.us.us
store double %add110.us.us.us.lcssa, ptr @tmp, align 8, !tbaa !9
br label %for.end130
for.end130: ; preds = %if.else, %for.cond34.preheader.lr.ph, %for.cond30.for.end130_crit_edge.split.us.split.us, %for.end26
%idxprom131 = sext i32 %dec to i64
%idxprom133 = sext i32 %dec1 to i64
%arrayidx134 = getelementptr inbounds [1100 x [1100 x double]], ptr @dp, i64 0, i64 %idxprom131, i64 %idxprom133
%25 = load double, ptr %arrayidx134, align 8, !tbaa !9
br label %cleanup
cleanup: ; preds = %for.end130, %if.then
%.sink = phi double [ %25, %for.end130 ], [ %mul, %if.then ]
%call135 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %.sink)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !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, !14, !13}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
|
#include <stdio.h>
int main(int argc, const char * argv[]) {
// 10004
int a[3];
scanf("%d %d %d", &a[0], &a[1], &a[2]);
int i,j,temp;
for(i=0; i<3; i++){
for(j=3-1; j>i; j--){
if(a[j] < a[j-1]){
temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
}
}
}
printf("%d %d %d\n", a[0], a[1], a[2]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_284980/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_284980/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
for.body5.preheader:
%a = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %a) #3
%arrayidx1 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp9 = icmp slt i32 %0, %1
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body5.preheader
store i32 %1, ptr %arrayidx2, align 4, !tbaa !5
store i32 %0, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body5.preheader, %if.then
%2 = phi i32 [ %1, %for.body5.preheader ], [ %0, %if.then ]
%3 = load i32, ptr %a, align 4, !tbaa !5
%cmp9.145 = icmp slt i32 %2, %3
br i1 %cmp9.145, label %if.then.147, label %for.body5.preheader.1
if.then.147: ; preds = %for.inc
store i32 %3, ptr %arrayidx1, align 4, !tbaa !5
store i32 %2, ptr %a, align 4, !tbaa !5
br label %for.body5.preheader.1
for.body5.preheader.1: ; preds = %if.then.147, %for.inc
%4 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp9.1 = icmp slt i32 %4, %5
br i1 %cmp9.1, label %if.then.1, label %for.inc20.2
if.then.1: ; preds = %for.body5.preheader.1
store i32 %5, ptr %arrayidx2, align 4, !tbaa !5
store i32 %4, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc20.2
for.inc20.2: ; preds = %if.then.1, %for.body5.preheader.1
%6 = load i32, ptr %a, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%8 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6, i32 noundef %7, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if(a < b){
if(b < c){
printf("%d %d %d\n", a, b, c);
}else{
if(a < c){
printf("%d %d %d\n", a, c, b);
}else{
printf("%d %d %d\n", c, a, b);
}
}
}else{
if(c < b){
printf("%d %d %d\n", c, b, a);
}else{
if(a < c){
printf("%d %d %d\n", b, a, c);
}else{
printf("%d %d %d\n", b, c, a);
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285022/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285022/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%2 = load i32, ptr %c, align 4, !tbaa !5
br i1 %cmp, label %if.then, label %if.else10
if.then: ; preds = %entry
%cmp1 = icmp slt i32 %1, %2
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.then
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0, i32 noundef %1, i32 noundef %2)
br label %if.end22
if.else: ; preds = %if.then
%cmp4 = icmp slt i32 %0, %2
br i1 %cmp4, label %if.then5, label %if.else7
if.then5: ; preds = %if.else
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0, i32 noundef %2, i32 noundef %1)
br label %if.end22
if.else7: ; preds = %if.else
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2, i32 noundef %0, i32 noundef %1)
br label %if.end22
if.else10: ; preds = %entry
%cmp11 = icmp slt i32 %2, %1
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else10
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2, i32 noundef %1, i32 noundef %0)
br label %if.end22
if.else14: ; preds = %if.else10
%cmp15 = icmp slt i32 %0, %2
br i1 %cmp15, label %if.then16, label %if.else18
if.then16: ; preds = %if.else14
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef %0, i32 noundef %2)
br label %if.end22
if.else18: ; preds = %if.else14
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef %2, i32 noundef %0)
br label %if.end22
if.end22: ; preds = %if.then12, %if.else18, %if.then16, %if.then2, %if.else7, %if.then5
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>
void swap(int *a, int *b)
{
int swap;
swap = *a;
*a = *b;
*b = swap;
}
int main()
{
int in[3], i;
for (i = 0; i < 3; i++) {
scanf("%d", &in[i]);
}
if (in[0] > in[1]) {
swap(&in[0], &in[1]);
}
if (in[1] > in[2]) {
swap(&in[1], &in[2]);
}
if (in[0] > in[1]) {
swap(&in[0], &in[1]);
}
printf("%d %d %d\n", in[0], in[1], in[2]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285066/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285066/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%d %d %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 %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, 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 nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%in = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %in) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%arrayidx.1 = getelementptr inbounds [3 x i32], ptr %in, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [3 x i32], ptr %in, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%0 = load i32, ptr %in, align 4, !tbaa !5
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %0, %1
br i1 %cmp3, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %in, align 4, !tbaa !5
store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%4 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %3, %4
br i1 %cmp8, label %if.then9, label %if.end12
if.then9: ; preds = %if.end
store i32 %4, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %3, ptr %arrayidx.2, align 4, !tbaa !5
br label %if.end12
if.end12: ; preds = %if.then9, %if.end
%5 = phi i32 [ %3, %if.then9 ], [ %4, %if.end ]
%6 = phi i32 [ %4, %if.then9 ], [ %3, %if.end ]
%cmp15 = icmp sgt i32 %2, %6
br i1 %cmp15, label %if.then16, label %if.end19
if.then16: ; preds = %if.end12
store i32 %6, ptr %in, align 4, !tbaa !5
store i32 %2, ptr %arrayidx.1, align 4, !tbaa !5
br label %if.end19
if.end19: ; preds = %if.then16, %if.end12
%7 = phi i32 [ %2, %if.then16 ], [ %6, %if.end12 ]
%8 = phi i32 [ %6, %if.then16 ], [ %2, %if.end12 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %7, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %in) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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>
void change(int *i,int *j)
{
int t;
t = *i;
*i = *j;
*j = t;
}
int main(void)
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(b > c){
change(&b,&c);
}
if(a > b){
change(&a,&b);
}
if(b > c){
change(&b,&c);
}
printf("%d %d %d\n",a,b,c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285109/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285109/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @change(ptr nocapture noundef %i, ptr nocapture noundef %j) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %i, align 4, !tbaa !5
%1 = load i32, ptr %j, align 4, !tbaa !5
store i32 %1, ptr %i, align 4, !tbaa !5
store i32 %0, ptr %j, 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 nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %c, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%4 = load i32, ptr %a, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %4, %3
br i1 %cmp1, label %if.then2, label %if.end3
if.then2: ; preds = %if.end
store i32 %3, ptr %a, align 4, !tbaa !5
store i32 %4, ptr %b, align 4, !tbaa !5
br label %if.end3
if.end3: ; preds = %if.then2, %if.end
%5 = phi i32 [ %3, %if.then2 ], [ %4, %if.end ]
%6 = phi i32 [ %4, %if.then2 ], [ %3, %if.end ]
%cmp4 = icmp sgt i32 %6, %2
br i1 %cmp4, label %if.then5, label %if.end6
if.then5: ; preds = %if.end3
store i32 %2, ptr %b, align 4, !tbaa !5
store i32 %6, ptr %c, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then5, %if.end3
%7 = phi i32 [ %6, %if.then5 ], [ %2, %if.end3 ]
%8 = phi i32 [ %2, %if.then5 ], [ %6, %if.end3 ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %8, i32 noundef %7)
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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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,i;
scanf("%d %d %d",&a,&b,&c);
if(a>b){
i=a;
a=b;
b=i;
}
if(b>c){
i=b;
b=c;
c=i;
}
if(a>b){
i=a;
a=b;
b=i;
}
printf("%d %d %d\n",a,b,c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285152/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285152/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%4 = load i32, ptr %c, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %3, %4
br i1 %cmp1, label %if.then2, label %if.end3
if.then2: ; preds = %if.end
store i32 %4, ptr %b, align 4, !tbaa !5
store i32 %3, ptr %c, align 4, !tbaa !5
br label %if.end3
if.end3: ; preds = %if.then2, %if.end
%5 = phi i32 [ %3, %if.then2 ], [ %4, %if.end ]
%6 = phi i32 [ %4, %if.then2 ], [ %3, %if.end ]
%cmp4 = icmp sgt i32 %2, %6
br i1 %cmp4, label %if.then5, label %if.end6
if.then5: ; preds = %if.end3
store i32 %6, ptr %a, align 4, !tbaa !5
store i32 %2, ptr %b, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then5, %if.end3
%7 = phi i32 [ %2, %if.then5 ], [ %6, %if.end3 ]
%8 = phi i32 [ %6, %if.then5 ], [ %2, %if.end3 ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %7, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int n[3];
int temp;
scanf("%d %d %d", &n[0], &n[1], &n[2]);
if (n[0] > n[1]){
temp = n[1];
n[1] = n[0];
n[0] = temp;
}
if (n[1] > n[2]){
temp = n[2];
n[2] = n[1];
n[1] = temp;
}
if (n[0] > n[1]){
temp = n[1];
n[1] = n[0];
n[0] = temp;
}
if (n[0] > n[1]){
temp = n[2];
n[2] = n[1];
n[1] = n[0];
n[0] = temp;
}
printf("%d %d %d\n", n[0], n[1], n[2]);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285196/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285196/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %n) #3
%arrayidx1 = getelementptr inbounds [3 x i32], ptr %n, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [3 x i32], ptr %n, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %0, ptr %arrayidx1, align 4, !tbaa !5
store i32 %1, ptr %n, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%4 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %3, %4
br i1 %cmp11, label %if.then12, label %if.end17
if.then12: ; preds = %if.end
store i32 %3, ptr %arrayidx2, align 4, !tbaa !5
store i32 %4, ptr %arrayidx1, align 4, !tbaa !5
br label %if.end17
if.end17: ; preds = %if.then12, %if.end
%5 = phi i32 [ %3, %if.then12 ], [ %4, %if.end ]
%6 = phi i32 [ %4, %if.then12 ], [ %3, %if.end ]
%cmp20 = icmp sgt i32 %2, %6
br i1 %cmp20, label %if.then21, label %if.end26
if.then21: ; preds = %if.end17
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
store i32 %6, ptr %n, align 4, !tbaa !5
br label %if.end26
if.end26: ; preds = %if.then21, %if.end17
%7 = phi i32 [ %2, %if.then21 ], [ %6, %if.end17 ]
%8 = phi i32 [ %6, %if.then21 ], [ %2, %if.end17 ]
%cmp29 = icmp sgt i32 %8, %7
br i1 %cmp29, label %if.then30, label %if.end37
if.then30: ; preds = %if.end26
store i32 %7, ptr %arrayidx2, align 4, !tbaa !5
store i32 %8, ptr %arrayidx1, align 4, !tbaa !5
store i32 %5, ptr %n, align 4, !tbaa !5
br label %if.end37
if.end37: ; preds = %if.then30, %if.end26
%9 = phi i32 [ %7, %if.then30 ], [ %5, %if.end26 ]
%10 = phi i32 [ %8, %if.then30 ], [ %7, %if.end26 ]
%11 = phi i32 [ %5, %if.then30 ], [ %8, %if.end26 ]
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11, i32 noundef %10, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
/*--- 2つの値を交換する関数 ---*/
void swap(int *na, int *nb)
{
int temp = *na;
*na = *nb;
*nb = temp;
}
int main(void)
{
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a > b)
swap(&a, &b);
if (b > c)
swap(&b, &c);
if (a > b)
swap(&a, &b);
printf("%d %d %d\n", a, b, c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285246/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285246/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %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 %na, ptr nocapture noundef %nb) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %na, align 4, !tbaa !5
%1 = load i32, ptr %nb, align 4, !tbaa !5
store i32 %1, ptr %na, align 4, !tbaa !5
store i32 %0, ptr %nb, 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 nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%4 = load i32, ptr %c, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %3, %4
br i1 %cmp1, label %if.then2, label %if.end3
if.then2: ; preds = %if.end
store i32 %4, ptr %b, align 4, !tbaa !5
store i32 %3, ptr %c, align 4, !tbaa !5
br label %if.end3
if.end3: ; preds = %if.then2, %if.end
%5 = phi i32 [ %3, %if.then2 ], [ %4, %if.end ]
%6 = phi i32 [ %4, %if.then2 ], [ %3, %if.end ]
%cmp4 = icmp sgt i32 %2, %6
br i1 %cmp4, label %if.then5, label %if.end6
if.then5: ; preds = %if.end3
store i32 %6, ptr %a, align 4, !tbaa !5
store i32 %2, ptr %b, align 4, !tbaa !5
br label %if.end6
if.end6: ; preds = %if.then5, %if.end3
%7 = phi i32 [ %2, %if.then5 ], [ %6, %if.end3 ]
%8 = phi i32 [ %6, %if.then5 ], [ %2, %if.end3 ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %7, i32 noundef %5)
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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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;
scanf("%d %d %d", &a , &b , &c);
if(b <= a){
int tmp;
tmp = b , b = a , a = tmp;
}
if(c <= b){
int tmp;
tmp = c , c = b , b = tmp;
}
if(b <= a){
int tmp;
tmp = b , b = a , a = tmp;
}
printf("%d %d %d\n", a , b ,c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285297/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285297/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%4 = load i32, ptr %c, align 4, !tbaa !5
%cmp1.not = icmp sgt i32 %4, %3
br i1 %cmp1.not, label %if.end4, label %if.then2
if.then2: ; preds = %if.end
store i32 %3, ptr %c, align 4, !tbaa !5
store i32 %4, ptr %b, align 4, !tbaa !5
br label %if.end4
if.end4: ; preds = %if.then2, %if.end
%5 = phi i32 [ %3, %if.then2 ], [ %4, %if.end ]
%6 = phi i32 [ %4, %if.then2 ], [ %3, %if.end ]
%cmp5.not = icmp sgt i32 %6, %2
br i1 %cmp5.not, label %if.end8, label %if.then6
if.then6: ; preds = %if.end4
store i32 %2, ptr %b, align 4, !tbaa !5
store i32 %6, ptr %a, align 4, !tbaa !5
br label %if.end8
if.end8: ; preds = %if.then6, %if.end4
%7 = phi i32 [ %2, %if.then6 ], [ %6, %if.end4 ]
%8 = phi i32 [ %6, %if.then6 ], [ %2, %if.end4 ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %7, i32 noundef %5)
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(){
int n,l,i,j;
//文字列の個数と長さを決める
scanf("%d %d",&n,&l);
char str[n][l+1];
char swap[l+1];
//文字を入れて大きさを比べ並び替え
for(i=0;i<n;i++){
scanf("%s",str[i]);
}
for(i=0;i<n;i++){
for(j=0;j<i;j++){
if(strcmp(str[i],str[j])<0){
strcpy(swap,str[i]);
strcpy(str[i],str[j]);
strcpy(str[j],swap);
}
}
}
//出力
for(i=0;i<n;i++){
printf("%s",str[i]);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285361/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285361/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%l = 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 %l) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %l)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = load i32, ptr %l, align 4, !tbaa !5
%add = add nsw i32 %2, 1
%3 = zext i32 %add to i64
%4 = call ptr @llvm.stacksave.p0()
%5 = mul nuw i64 %3, %1
%vla = alloca i8, i64 %5, align 16
%6 = load i32, ptr %l, align 4, !tbaa !5
%add1 = add nsw i32 %6, 1
%7 = zext i32 %add1 to i64
%vla2 = alloca i8, i64 %7, align 16
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %8, 0
br i1 %cmp57, label %for.body, label %for.end41
for.cond4.preheader: ; preds = %for.body
%cmp561 = icmp sgt i32 %10, 0
br i1 %cmp561, label %for.cond7.preheader.preheader, label %for.end41
for.cond7.preheader.preheader: ; preds = %for.cond4.preheader
%wide.trip.count73 = zext i32 %10 to i64
br label %for.cond7.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%9 = mul nuw nsw i64 %indvars.iv, %3
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %9
%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
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.inc30
%indvars.iv70 = phi i64 [ 0, %for.cond7.preheader.preheader ], [ %indvars.iv.next71, %for.inc30 ]
%cmp859.not = icmp eq i64 %indvars.iv70, 0
br i1 %cmp859.not, label %for.inc30, label %for.body9.lr.ph
for.body9.lr.ph: ; preds = %for.cond7.preheader
%12 = mul nuw nsw i64 %indvars.iv70, %3
%arrayidx11 = getelementptr inbounds i8, ptr %vla, i64 %12
br label %for.body9
for.cond33.preheader: ; preds = %for.inc30
br i1 %cmp561, label %for.body35, label %for.end41
for.body9: ; preds = %for.body9.lr.ph, %for.inc27
%indvars.iv67 = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next68, %for.inc27 ]
%13 = mul nuw nsw i64 %indvars.iv67, %3
%arrayidx13 = getelementptr inbounds i8, ptr %vla, i64 %13
%call14 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx11, ptr noundef nonnull dereferenceable(1) %arrayidx13) #7
%cmp15 = icmp slt i32 %call14, 0
br i1 %cmp15, label %if.then, label %for.inc27
if.then: ; preds = %for.body9
%call18 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %vla2, ptr noundef nonnull dereferenceable(1) %arrayidx11) #6
%call23 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx11, ptr noundef nonnull dereferenceable(1) %arrayidx13) #6
%call26 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx13, ptr noundef nonnull dereferenceable(1) %vla2) #6
br label %for.inc27
for.inc27: ; preds = %for.body9, %if.then
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%exitcond.not = icmp eq i64 %indvars.iv.next68, %indvars.iv70
br i1 %exitcond.not, label %for.inc30, label %for.body9, !llvm.loop !11
for.inc30: ; preds = %for.inc27, %for.cond7.preheader
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%exitcond74.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count73
br i1 %exitcond74.not, label %for.cond33.preheader, label %for.cond7.preheader, !llvm.loop !12
for.body35: ; preds = %for.cond33.preheader, %for.body35
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body35 ], [ 0, %for.cond33.preheader ]
%14 = mul nuw nsw i64 %indvars.iv75, %3
%arrayidx37 = getelementptr inbounds i8, ptr %vla, i64 %14
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx37)
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp34 = icmp slt i64 %indvars.iv.next76, %16
br i1 %cmp34, label %for.body35, label %for.end41, !llvm.loop !13
for.end41: ; preds = %for.body35, %entry, %for.cond4.preheader, %for.cond33.preheader
call void @llvm.stackrestore.p0(ptr %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nounwind willreturn memory(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 nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
int n,l;
int i,j;
char **S;
char *min;
scanf("%d %d",&n,&l);
S=malloc(n*sizeof(char*));
for(i=0;i<n;i++){
S[i]=malloc(l*sizeof(char));
}
min=malloc(sizeof(char)*l);
for(i=0;i<n;i++){
scanf("%s",S[i]);
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(strcmp(S[i],S[j])>0){
strcpy(min,S[i]);
strcpy(S[i],S[j]);
strcpy(S[j],min);
}
}
}
for(i=0;i<n;i++){
printf("%s",S[i]);
}
putchar('\n');
free(S);
free(min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285411/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285411/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%l = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %l)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp91 = icmp sgt i32 %0, 0
%.pre = load i32, ptr %l, align 4, !tbaa !5
%conv3 = sext i32 %.pre to i64
br i1 %cmp91, label %for.body.lr.ph, label %for.end.thread
for.end.thread: ; preds = %entry
%call8120 = call noalias ptr @malloc(i64 noundef %conv3) #8
br label %for.end60
for.body.lr.ph: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call5 = call noalias ptr @malloc(i64 noundef %conv3) #8
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call5, 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.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body
%call8 = call noalias ptr @malloc(i64 noundef %conv3) #8
br i1 %cmp91, label %for.body12, label %for.end60
for.cond19.preheader: ; preds = %for.body12
%cmp2098 = icmp sgt i32 %2, 1
br i1 %cmp2098, label %for.body22, label %for.cond51.preheader
for.body12: ; preds = %for.end, %for.body12
%indvars.iv103 = phi i64 [ %indvars.iv.next104, %for.body12 ], [ 0, %for.end ]
%arrayidx14 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv103
%1 = load ptr, ptr %arrayidx14, align 8, !tbaa !9
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %1)
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp10 = icmp slt i64 %indvars.iv.next104, %3
br i1 %cmp10, label %for.body12, label %for.cond19.preheader, !llvm.loop !13
for.cond19.loopexit: ; preds = %for.inc45, %for.body22
%4 = phi i32 [ %7, %for.body22 ], [ %13, %for.inc45 ]
%sub = add nsw i32 %4, -1
%5 = sext i32 %sub to i64
%cmp20 = icmp slt i64 %indvars.iv.next112, %5
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
br i1 %cmp20, label %for.body22, label %for.cond51.preheader, !llvm.loop !14
for.cond51.preheader: ; preds = %for.cond19.loopexit, %for.cond19.preheader
%6 = phi i32 [ %2, %for.cond19.preheader ], [ %4, %for.cond19.loopexit ]
%cmp52100 = icmp sgt i32 %6, 0
br i1 %cmp52100, label %for.body54, label %for.end60
for.body22: ; preds = %for.cond19.preheader, %for.cond19.loopexit
%7 = phi i32 [ %4, %for.cond19.loopexit ], [ %2, %for.cond19.preheader ]
%indvars.iv111 = phi i64 [ %indvars.iv.next112, %for.cond19.loopexit ], [ 0, %for.cond19.preheader ]
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.cond19.loopexit ], [ 1, %for.cond19.preheader ]
%indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
%8 = sext i32 %7 to i64
%cmp2495 = icmp slt i64 %indvars.iv.next112, %8
br i1 %cmp2495, label %for.body26.lr.ph, label %for.cond19.loopexit
for.body26.lr.ph: ; preds = %for.body22
%arrayidx28 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv111
%9 = load ptr, ptr %arrayidx28, align 8, !tbaa !9
br label %for.body26
for.body26: ; preds = %for.body26.lr.ph, %for.inc45
%10 = phi i32 [ %7, %for.body26.lr.ph ], [ %13, %for.inc45 ]
%11 = phi i32 [ %7, %for.body26.lr.ph ], [ %14, %for.inc45 ]
%indvars.iv108 = phi i64 [ %indvars.iv106, %for.body26.lr.ph ], [ %indvars.iv.next109, %for.inc45 ]
%arrayidx30 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv108
%12 = load ptr, ptr %arrayidx30, align 8, !tbaa !9
%call31 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %9, ptr noundef nonnull dereferenceable(1) %12) #9
%cmp32 = icmp sgt i32 %call31, 0
br i1 %cmp32, label %if.then, label %for.inc45
if.then: ; preds = %for.body26
%call36 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call8, ptr noundef nonnull dereferenceable(1) %9) #7
%call41 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %9, ptr noundef nonnull dereferenceable(1) %12) #7
%call44 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %12, ptr noundef nonnull dereferenceable(1) %call8) #7
%.pre117 = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc45
for.inc45: ; preds = %for.body26, %if.then
%13 = phi i32 [ %10, %for.body26 ], [ %.pre117, %if.then ]
%14 = phi i32 [ %11, %for.body26 ], [ %.pre117, %if.then ]
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%15 = sext i32 %14 to i64
%cmp24 = icmp slt i64 %indvars.iv.next109, %15
br i1 %cmp24, label %for.body26, label %for.cond19.loopexit, !llvm.loop !15
for.body54: ; preds = %for.cond51.preheader, %for.body54
%indvars.iv114 = phi i64 [ %indvars.iv.next115, %for.body54 ], [ 0, %for.cond51.preheader ]
%arrayidx56 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv114
%16 = load ptr, ptr %arrayidx56, align 8, !tbaa !9
%call57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %16)
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp52 = icmp slt i64 %indvars.iv.next115, %18
br i1 %cmp52, label %for.body54, label %for.end60, !llvm.loop !16
for.end60: ; preds = %for.body54, %for.end, %for.end.thread, %for.cond51.preheader
%call8121124127 = phi ptr [ %call8, %for.cond51.preheader ], [ %call8120, %for.end.thread ], [ %call8, %for.end ], [ %call8, %for.body54 ]
%19 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %19)
call void @free(ptr noundef %call1) #7
call void @free(ptr noundef %call8121124127) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!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}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
int cmp(const void *a, const void *b);
//your code here!
int main(void){
ll N, L;
scanf("%lld %lld", &N, &L);
char S[110][110];
rep(i, 0, N) scanf("%s", S[i]);
qsort(S, N, sizeof(S[0]), cmp);
rep(i, 0, N) printf("%s", S[i]);
return 0;
}
int cmp(const void *a, const void *b){
char *left_char = (char *)a;
char *right_char = (char *)b;
return strcmp(left_char, right_char );//abc..zの順に並べる
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285455/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285455/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [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 i64, align 8
%L = alloca i64, align 8
%S = alloca [110 x [110 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %L) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %L)
call void @llvm.lifetime.start.p0(i64 12100, ptr nonnull %S) #6
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp18 = icmp sgt i64 %0, 0
br i1 %cmp18, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %0, %entry ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %S, i64 noundef %.lcssa, i64 noundef 110, ptr noundef nonnull @cmp) #6
%1 = load i64, ptr %N, align 8, !tbaa !5
%cmp520 = icmp sgt i64 %1, 0
br i1 %cmp520, label %for.body7, label %for.cond.cleanup6
for.body: ; preds = %entry, %for.body
%i.019 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [110 x [110 x i8]], ptr %S, i64 0, i64 %i.019
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.019, 1
%2 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup6: ; preds = %for.body7, %for.cond.cleanup
call void @llvm.lifetime.end.p0(i64 12100, ptr nonnull %S) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %L) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #6
ret i32 0
for.body7: ; preds = %for.cond.cleanup, %for.body7
%i3.021 = phi i64 [ %inc12, %for.body7 ], [ 0, %for.cond.cleanup ]
%arrayidx8 = getelementptr inbounds [110 x [110 x i8]], ptr %S, i64 0, i64 %i3.021
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx8)
%inc12 = add nuw nsw i64 %i3.021, 1
%3 = load i64, ptr %N, align 8, !tbaa !5
%cmp5 = icmp slt i64 %inc12, %3
br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #4 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #7
ret i32 %call
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(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 #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree "no-trapping-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) uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 = !{!"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>
long long max(long long a, long long b) { return a > b ? a : b; }
int main()
{
int x, y, z, i, j, k, n, m, t;
long long a, b, c, w, h;
scanf("%d",&t);
while(t--)
{
c = 0;
scanf("%lld %lld", &w, &h);
for(x = 0; x < 4; x++)
{
scanf("%d", &k);
for(y = 0; y < k; y++)
{
scanf("%lld", &a);
if(!y) b = a;
else if(y == k - 1) b = a - b;
}
if(x < 2) c = max(c, b * h);
else c = max(c, b * w);
}
printf("%lld\n", c);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28552/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28552/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%k = alloca i32, align 4
%t = alloca i32, align 4
%a = alloca i64, align 8
%w = alloca i64, align 8
%h = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec39 = add nsw i32 %0, -1
store i32 %dec39, ptr %t, align 4, !tbaa !5
%tobool.not40 = icmp eq i32 %0, 0
br i1 %tobool.not40, label %while.end, label %while.body
while.body: ; preds = %entry, %for.inc19.3
%b.041 = phi i64 [ %b.2.lcssa.3, %for.inc19.3 ], [ undef, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %w, ptr noundef nonnull %h)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %1, 0
br i1 %cmp433, label %for.inc.peel, label %for.inc19
for.inc.peel: ; preds = %while.body
%call6.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%2 = load i64, ptr %a, align 8, !tbaa !9
%.pre = load i32, ptr %k, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.peel, label %if.else, label %for.inc19
if.else: ; preds = %for.inc.peel, %if.else
%b.235 = phi i64 [ %b.3, %if.else ], [ %2, %for.inc.peel ]
%y.034 = phi i32 [ %inc, %if.else ], [ 1, %for.inc.peel ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%3 = load i32, ptr %k, align 4, !tbaa !5
%sub = add nsw i32 %3, -1
%cmp8 = icmp eq i32 %y.034, %sub
%4 = load i64, ptr %a, align 8
%sub10 = sub nsw i64 %4, %b.235
%b.3 = select i1 %cmp8, i64 %sub10, i64 %b.235
%inc = add nuw nsw i32 %y.034, 1
%cmp4 = icmp slt i32 %inc, %3
br i1 %cmp4, label %if.else, label %for.inc19, !llvm.loop !11
for.inc19: ; preds = %if.else, %for.inc.peel, %while.body
%b.2.lcssa = phi i64 [ %b.041, %while.body ], [ %2, %for.inc.peel ], [ %b.3, %if.else ]
%5 = load i64, ptr %h, align 8, !tbaa !9
%mul = mul nsw i64 %5, %b.2.lcssa
%call2.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%6 = load i32, ptr %k, align 4, !tbaa !5
%cmp433.1 = icmp sgt i32 %6, 0
br i1 %cmp433.1, label %for.inc.peel.1, label %for.inc19.1
for.inc.peel.1: ; preds = %for.inc19
%call6.peel.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%7 = load i64, ptr %a, align 8, !tbaa !9
%.pre44 = load i32, ptr %k, align 4, !tbaa !5
%cmp4.peel.1 = icmp sgt i32 %.pre44, 1
br i1 %cmp4.peel.1, label %if.else.1, label %for.inc19.1
if.else.1: ; preds = %for.inc.peel.1, %if.else.1
%b.235.1 = phi i64 [ %b.3.1, %if.else.1 ], [ %7, %for.inc.peel.1 ]
%y.034.1 = phi i32 [ %inc.1, %if.else.1 ], [ 1, %for.inc.peel.1 ]
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%8 = load i32, ptr %k, align 4, !tbaa !5
%sub.1 = add nsw i32 %8, -1
%cmp8.1 = icmp eq i32 %y.034.1, %sub.1
%9 = load i64, ptr %a, align 8
%sub10.1 = sub nsw i64 %9, %b.235.1
%b.3.1 = select i1 %cmp8.1, i64 %sub10.1, i64 %b.235.1
%inc.1 = add nuw nsw i32 %y.034.1, 1
%cmp4.1 = icmp slt i32 %inc.1, %8
br i1 %cmp4.1, label %if.else.1, label %for.inc19.1, !llvm.loop !11
for.inc19.1: ; preds = %if.else.1, %for.inc.peel.1, %for.inc19
%b.2.lcssa.1 = phi i64 [ %b.2.lcssa, %for.inc19 ], [ %7, %for.inc.peel.1 ], [ %b.3.1, %if.else.1 ]
%10 = load i64, ptr %h, align 8, !tbaa !9
%mul.1 = mul nsw i64 %10, %b.2.lcssa.1
%cond.i = call i64 @llvm.smax.i64(i64 %mul, i64 %mul.1)
%call2.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%11 = load i32, ptr %k, align 4, !tbaa !5
%cmp433.2 = icmp sgt i32 %11, 0
br i1 %cmp433.2, label %for.inc.peel.2, label %for.inc19.2
for.inc.peel.2: ; preds = %for.inc19.1
%call6.peel.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%12 = load i64, ptr %a, align 8, !tbaa !9
%.pre46 = load i32, ptr %k, align 4, !tbaa !5
%cmp4.peel.2 = icmp sgt i32 %.pre46, 1
br i1 %cmp4.peel.2, label %if.else.2, label %for.inc19.2
if.else.2: ; preds = %for.inc.peel.2, %if.else.2
%b.235.2 = phi i64 [ %b.3.2, %if.else.2 ], [ %12, %for.inc.peel.2 ]
%y.034.2 = phi i32 [ %inc.2, %if.else.2 ], [ 1, %for.inc.peel.2 ]
%call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%13 = load i32, ptr %k, align 4, !tbaa !5
%sub.2 = add nsw i32 %13, -1
%cmp8.2 = icmp eq i32 %y.034.2, %sub.2
%14 = load i64, ptr %a, align 8
%sub10.2 = sub nsw i64 %14, %b.235.2
%b.3.2 = select i1 %cmp8.2, i64 %sub10.2, i64 %b.235.2
%inc.2 = add nuw nsw i32 %y.034.2, 1
%cmp4.2 = icmp slt i32 %inc.2, %13
br i1 %cmp4.2, label %if.else.2, label %for.inc19.2, !llvm.loop !11
for.inc19.2: ; preds = %if.else.2, %for.inc.peel.2, %for.inc19.1
%b.2.lcssa.2 = phi i64 [ %b.2.lcssa.1, %for.inc19.1 ], [ %12, %for.inc.peel.2 ], [ %b.3.2, %if.else.2 ]
%15 = load i64, ptr %w, align 8, !tbaa !9
%mul16.2 = mul nsw i64 %15, %b.2.lcssa.2
%cond.i.1 = call i64 @llvm.smax.i64(i64 %cond.i, i64 %mul16.2)
%call2.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%16 = load i32, ptr %k, align 4, !tbaa !5
%cmp433.3 = icmp sgt i32 %16, 0
br i1 %cmp433.3, label %for.inc.peel.3, label %for.inc19.3
for.inc.peel.3: ; preds = %for.inc19.2
%call6.peel.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%17 = load i64, ptr %a, align 8, !tbaa !9
%.pre48 = load i32, ptr %k, align 4, !tbaa !5
%cmp4.peel.3 = icmp sgt i32 %.pre48, 1
br i1 %cmp4.peel.3, label %if.else.3, label %for.inc19.3
if.else.3: ; preds = %for.inc.peel.3, %if.else.3
%b.235.3 = phi i64 [ %b.3.3, %if.else.3 ], [ %17, %for.inc.peel.3 ]
%y.034.3 = phi i32 [ %inc.3, %if.else.3 ], [ 1, %for.inc.peel.3 ]
%call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%18 = load i32, ptr %k, align 4, !tbaa !5
%sub.3 = add nsw i32 %18, -1
%cmp8.3 = icmp eq i32 %y.034.3, %sub.3
%19 = load i64, ptr %a, align 8
%sub10.3 = sub nsw i64 %19, %b.235.3
%b.3.3 = select i1 %cmp8.3, i64 %sub10.3, i64 %b.235.3
%inc.3 = add nuw nsw i32 %y.034.3, 1
%cmp4.3 = icmp slt i32 %inc.3, %18
br i1 %cmp4.3, label %if.else.3, label %for.inc19.3, !llvm.loop !11
for.inc19.3: ; preds = %if.else.3, %for.inc.peel.3, %for.inc19.2
%b.2.lcssa.3 = phi i64 [ %b.2.lcssa.2, %for.inc19.2 ], [ %17, %for.inc.peel.3 ], [ %b.3.3, %if.else.3 ]
%20 = load i64, ptr %w, align 8, !tbaa !9
%mul16.3 = mul nsw i64 %20, %b.2.lcssa.3
%cond.i32.2 = call i64 @llvm.smax.i64(i64 %cond.i.1, i64 %mul16.3)
%cond.i32.3 = call i64 @llvm.smax.i64(i64 %cond.i32.2, i64 0)
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %cond.i32.3)
%21 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %21, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %21, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %for.inc19.3, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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) #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 i64 @llvm.smax.i64(i64, i64) #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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int N,L;
int cmp(const void *a, const void *b) {
return strncmp((const char*)a,(const char*)b,L);
}
int main() {
char **S;
char *SS;
scanf("%d %d",&N,&L);
S = (char**)malloc(sizeof(char*)*N);
SS = (char*)malloc(sizeof(char)*(L+1)*N);
int i;
for (i=0; i<N; i++) {
S[i] = &(SS[(L+1)*i]);
scanf("%s",S[i]);
}
qsort(SS, N, L+1, cmp);
for (i=0; i<N; i++) printf("%s",S[i]);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285563/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285563/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@L = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@N = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr @L, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%call = tail call i32 @strncmp(ptr noundef %a, ptr noundef %b, i64 noundef %conv) #7
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #1
; 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, ptr noundef nonnull @L)
%0 = load i32, ptr @N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = tail call noalias ptr @malloc(i64 noundef %mul) #8
%1 = load i32, ptr @L, align 4, !tbaa !5
%add = add nsw i32 %1, 1
%conv2 = sext i32 %add to i64
%mul5 = mul nsw i64 %conv2, %conv
%call6 = tail call noalias ptr @malloc(i64 noundef %mul5) #8
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%2 = load i32, ptr @L, align 4, !tbaa !5
%add8 = add nsw i32 %2, 1
%3 = trunc i64 %indvars.iv to i32
%mul9 = mul nsw i32 %add8, %3
%idxprom = sext i32 %mul9 to i64
%arrayidx = getelementptr inbounds i8, ptr %call6, i64 %idxprom
%arrayidx11 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %arrayidx, ptr %arrayidx11, align 8, !tbaa !9
%call14 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr @N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !11
for.end.loopexit: ; preds = %for.body
%.pre = load i32, ptr @L, align 4, !tbaa !5
%.pre48 = add nsw i32 %.pre, 1
%.pre49 = sext i32 %.pre48 to i64
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%conv17.pre-phi = phi i64 [ %.pre49, %for.end.loopexit ], [ %conv2, %entry ]
%conv15.pre-phi = phi i64 [ %5, %for.end.loopexit ], [ %conv, %entry ]
tail call void @qsort(ptr noundef %call6, i64 noundef %conv15.pre-phi, i64 noundef %conv17.pre-phi, ptr noundef nonnull @cmp) #9
%6 = load i32, ptr @N, align 4, !tbaa !5
%cmp1941 = icmp sgt i32 %6, 0
br i1 %cmp1941, label %for.body21, label %for.end27
for.body21: ; preds = %for.end, %for.body21
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body21 ], [ 0, %for.end ]
%arrayidx23 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv45
%7 = load ptr, ptr %arrayidx23, align 8, !tbaa !9
%call24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %7)
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%8 = load i32, ptr @N, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp19 = icmp slt i64 %indvars.iv.next46, %9
br i1 %cmp19, label %for.body21, label %for.end27, !llvm.loop !13
for.end27: ; preds = %for.body21, %for.end
%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 #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
attributes #0 = { 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 #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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top,A[200];
void push(int x)
{
A[++top]=x;
}
int pop()
{
top--;
return A[top+1];
}
int main()
{ int a,b;
top=0;
char s[100];
while(scanf("%s",s)!=EOF)
{if(s[0]=='+')
{ a=pop();
b=pop();
push(a+b);
}
else if(s[0]=='-')
{ a=pop();
b=pop();
push(b-a);
}
else if(s[0]=='*')
{ a=pop();
b=pop();
push(a*b);
}
else {push(atoi(s));}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285620/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285620/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@A = dso_local local_unnamed_addr global [200 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [200 x i32], ptr @A, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
char s[16];
int S[100],p=0;
while (scanf("%s ",s)!=EOF){
int a,b;
if(*s>'/')
S[p++]=atoi(s);
else{
a=S[--p];b=S[--p];
if(*s=='*')S[p++]=b*a;
else if(*s=='+')S[p++]=b+a;
else if(*s=='-')S[p++]=b-a;
}
}
printf("%d\n", S[--p]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285671/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285671/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [16 x i8], align 16
%S = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %S) #4
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not55 = icmp eq i32 %call54, -1
br i1 %cmp.not55, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end39
%p.056 = phi i32 [ %p.1, %if.end39 ], [ 0, %entry ]
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp2 = icmp sgt i8 %0, 47
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #4
%conv.i = trunc i64 %call.i to i32
%inc = add nsw i32 %p.056, 1
%idxprom = sext i32 %p.056 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom
store i32 %conv.i, ptr %arrayidx, align 4, !tbaa !8
br label %if.end39
if.else: ; preds = %while.body
%dec = add nsw i32 %p.056, -1
%idxprom6 = sext i32 %dec to i64
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom6
%1 = load i32, ptr %arrayidx7, align 4, !tbaa !8
%dec8 = add nsw i32 %p.056, -2
%idxprom9 = sext i32 %dec8 to i64
%arrayidx10 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !8
switch i8 %0, label %if.end39 [
i8 42, label %if.then15
i8 43, label %if.then24
i8 45, label %if.then33
]
if.then15: ; preds = %if.else
%mul = mul nsw i32 %2, %1
store i32 %mul, ptr %arrayidx10, align 4, !tbaa !8
br label %if.end39
if.then24: ; preds = %if.else
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx10, align 4, !tbaa !8
br label %if.end39
if.then33: ; preds = %if.else
%sub = sub nsw i32 %2, %1
store i32 %sub, ptr %arrayidx10, align 4, !tbaa !8
br label %if.end39
if.end39: ; preds = %if.else, %if.then15, %if.then33, %if.then24, %if.then
%p.1 = phi i32 [ %inc, %if.then ], [ %dec, %if.then15 ], [ %dec, %if.then24 ], [ %dec, %if.then33 ], [ %dec8, %if.else ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end39
%3 = add nsw i32 %p.1, -1
%4 = sext i32 %3 to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%p.0.lcssa = phi i64 [ -1, %entry ], [ %4, %while.end.loopexit ]
%arrayidx42 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %p.0.lcssa
%5 = load i32, ptr %arrayidx42, align 4, !tbaa !8
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 16, 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { 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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int i = 0; // スタックの一番上の位置を表す整数。一番下は0
int S[100]; // スタック
char str[10]; // 入力用文字列配列
// EOFまで読み込む
while(scanf("%s", str) != EOF){
// 加算
if (str[0] == '+'){
// スタックの上から二番目と一番上の値の和を出し、上から二番目の値があった位置に値を入れる
S[i-2] = S[i-2] + S[i-1];
i--;
}
// 減算
else if(str[0] == '-'){
S[i-2] = S[i-2] - S[i-1];
i--;
}
// 乗算
else if(str[0] == '*'){
S[i-2] = S[i-2] * S[i-1];
i--;
}
// オペランドをスタックに値を積む
else{
S[i] = atoi(str);
i++;
}
}
// スタックの一番下(計算結果)を出力する
printf("%d\n", S[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285750/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285750/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [100 x i32], align 16
%str = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %S) #5
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %str) #5
%call64 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%cmp.not65 = icmp ne i32 %call64, -1
call void @llvm.assume(i1 %cmp.not65)
br label %while.body
while.body: ; preds = %entry, %if.end48
%i.066 = phi i32 [ %i.1, %if.end48 ], [ 0, %entry ]
%0 = load i8, ptr %str, align 1, !tbaa !5
switch i8 %0, label %if.else42 [
i8 43, label %if.then
i8 45, label %if.then14
i8 42, label %if.then31
]
if.then: ; preds = %while.body
%sub = add nsw i32 %i.066, -2
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%sub4 = add nsw i32 %i.066, -1
%idxprom5 = sext i32 %sub4 to i64
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx3, align 4, !tbaa !8
br label %if.end48
if.then14: ; preds = %while.body
%sub15 = add nsw i32 %i.066, -2
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom16
%3 = load i32, ptr %arrayidx17, align 4, !tbaa !8
%sub18 = add nsw i32 %i.066, -1
%idxprom19 = sext i32 %sub18 to i64
%arrayidx20 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom19
%4 = load i32, ptr %arrayidx20, align 4, !tbaa !8
%sub21 = sub nsw i32 %3, %4
store i32 %sub21, ptr %arrayidx17, align 4, !tbaa !8
br label %if.end48
if.then31: ; preds = %while.body
%sub32 = add nsw i32 %i.066, -2
%idxprom33 = sext i32 %sub32 to i64
%arrayidx34 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom33
%5 = load i32, ptr %arrayidx34, align 4, !tbaa !8
%sub35 = add nsw i32 %i.066, -1
%idxprom36 = sext i32 %sub35 to i64
%arrayidx37 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom36
%6 = load i32, ptr %arrayidx37, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx34, align 4, !tbaa !8
br label %if.end48
if.else42: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %str, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%idxprom45 = sext i32 %i.066 to i64
%arrayidx46 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom45
store i32 %conv.i, ptr %arrayidx46, align 4, !tbaa !8
%inc = add nsw i32 %i.066, 1
br label %if.end48
if.end48: ; preds = %if.then14, %if.else42, %if.then31, %if.then
%i.1 = phi i32 [ %sub4, %if.then ], [ %sub18, %if.then14 ], [ %sub35, %if.then31 ], [ %inc, %if.else42 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end48
%.pre = load i32, ptr %S, align 16, !tbaa !8
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %str) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %S) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void push(int);
int pop();
int S_num[1000],top;
int main(){
int num_a,num_b;
char str_num[100];
top=0;
while(scanf("%s",str_num)!=EOF){
if(str_num[0]=='+'){
num_a=pop();
num_b=pop();
push(num_a+num_b);
}else if(str_num[0]=='-'){
num_b=pop();
num_a=pop();
push(num_a-num_b);
}else if(str_num[0]=='*'){
num_a=pop();
num_b=pop();
push(num_a*num_b);
}else{
push(atoi(str_num));
}
}
printf("%d\n",pop());
return 0;
}
void push(int x){
top++;
S_num[top]=x;
}
int pop(){
top--;
return S_num[top+1];
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285794/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285794/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@S_num = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str_num = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %str_num) #5
store i32 0, ptr @top, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str_num)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %str_num, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %str_num, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str_num)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %str_num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S_num, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int initialize(int);
void push(int);
int pop(void);
int top=0;
int num[1000];
int main(){
int x,a,b;
char s[1000];
while( scanf("%s", s) != EOF ){
if ( s[0] == '+' ){
a=pop();
b=pop();
push(a+b);
} else if ( s[0] == '-' ){
a=pop();
b=pop();
push(b-a);
} else if ( s[0] == '*' ){
a=pop();
b=pop();
push(a*b);
} else {
x = atoi(s);
push(x);
}
}
printf("%d\n",pop());
return 0;
}
void push(int x)
{
top++;
num[top]=x;
}
int pop(void)
{
top--;
return num[top+1];
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285844/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285844/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@num = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !8
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !8
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !8
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !8
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !8
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !8
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !8
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !8
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !8
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !8
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !8
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !8
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !8
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !8
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !8
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !8
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !8
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !8
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !8
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !8
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !8
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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int a[500],head=0;
int main(){
int b,num=0;
char c,d;
while( (scanf("%c",&c))!=EOF){
if(num==0&&c=='0'){ a[head]=num;
head++;}
if(c<='9'&&c>='0'){num=c-'0'+num*10;}
else if(num!=0){
a[head]=num;
head++;
num=0;
}
else {num=0;
if(c=='+'){
a[head-2]+=a[head-1];
head--;
}
else if(c=='*'){
a[head-2]*=a[head-1];
head--;
}
else if(c=='-'){
a[head-2]-=a[head-1];
head--;
}
}
}
printf("%d\n",a[head-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285888/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285888/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@a = dso_local local_unnamed_addr global [500 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
%call72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not73 = icmp eq i32 %call72, -1
br i1 %cmp.not73, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end61
%num.074 = phi i32 [ %num.1, %if.end61 ], [ 0, %entry ]
%cmp1 = icmp eq i32 %num.074, 0
%0 = load i8, ptr %c, align 1
%cmp2 = icmp eq i8 %0, 48
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %if.end.thread, label %if.end
if.end.thread: ; preds = %while.body
%1 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom
store i32 0, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @head, align 4, !tbaa !5
br label %if.then11
if.end: ; preds = %while.body
%2 = add i8 %0, -48
%or.cond66 = icmp ult i8 %2, 10
br i1 %or.cond66, label %if.then11, label %if.else
if.then11: ; preds = %if.end.thread, %if.end
%conv4 = zext i8 %0 to i32
%mul = mul nsw i32 %num.074, 10
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv4
br label %if.end61
if.else: ; preds = %if.end
br i1 %cmp1, label %if.else19, label %if.then15
if.then15: ; preds = %if.else
%3 = load i32, ptr @head, align 4, !tbaa !5
%idxprom16 = sext i32 %3 to i64
%arrayidx17 = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom16
store i32 %num.074, ptr %arrayidx17, align 4, !tbaa !5
%inc18 = add nsw i32 %3, 1
store i32 %inc18, ptr @head, align 4, !tbaa !5
br label %if.end61
if.else19: ; preds = %if.else
switch i8 %0, label %if.end61 [
i8 43, label %if.then23
i8 42, label %if.then35
i8 45, label %if.then48
]
if.then23: ; preds = %if.else19
%4 = load i32, ptr @head, align 4, !tbaa !5
%sub24 = add nsw i32 %4, -1
%idxprom25 = sext i32 %sub24 to i64
%arrayidx26 = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom25
%5 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%sub27 = add nsw i32 %4, -2
%idxprom28 = sext i32 %sub27 to i64
%arrayidx29 = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom28
%6 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%add30 = add nsw i32 %6, %5
store i32 %add30, ptr %arrayidx29, align 4, !tbaa !5
store i32 %sub24, ptr @head, align 4, !tbaa !5
br label %if.end61
if.then35: ; preds = %if.else19
%7 = load i32, ptr @head, align 4, !tbaa !5
%sub36 = add nsw i32 %7, -1
%idxprom37 = sext i32 %sub36 to i64
%arrayidx38 = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom37
%8 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%sub39 = add nsw i32 %7, -2
%idxprom40 = sext i32 %sub39 to i64
%arrayidx41 = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom40
%9 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%mul42 = mul nsw i32 %9, %8
store i32 %mul42, ptr %arrayidx41, align 4, !tbaa !5
store i32 %sub36, ptr @head, align 4, !tbaa !5
br label %if.end61
if.then48: ; preds = %if.else19
%10 = load i32, ptr @head, align 4, !tbaa !5
%sub49 = add nsw i32 %10, -1
%idxprom50 = sext i32 %sub49 to i64
%arrayidx51 = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom50
%11 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%sub52 = add nsw i32 %10, -2
%idxprom53 = sext i32 %sub52 to i64
%arrayidx54 = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom53
%12 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%sub55 = sub nsw i32 %12, %11
store i32 %sub55, ptr %arrayidx54, align 4, !tbaa !5
store i32 %sub49, ptr @head, align 4, !tbaa !5
br label %if.end61
if.end61: ; preds = %if.else19, %if.then15, %if.then35, %if.then48, %if.then23, %if.then11
%num.1 = phi i32 [ %add, %if.then11 ], [ 0, %if.then15 ], [ 0, %if.then23 ], [ 0, %if.then35 ], [ 0, %if.then48 ], [ 0, %if.else19 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end61, %entry
%13 = load i32, ptr @head, align 4, !tbaa !5
%sub62 = add nsw i32 %13, -1
%idxprom63 = sext i32 %sub62 to i64
%arrayidx64 = getelementptr inbounds [500 x i32], ptr @a, i64 0, i64 %idxprom63
%14 = load i32, ptr %arrayidx64, align 4, !tbaa !5
%call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 100
int main(void){
int i=0, ans=0, y;
int num[N];
char s[N];
while(scanf("%s",s) != EOF){
if(s[0] == '+'){
ans = num[i-2] + num[i-1];
num[i-2] = ans;
i--;
}
else if(s[0] == '-'){
ans = num[i-2] - num[i-1];
num[i-2] = ans;
i--;
}
else if(s[0] == '*'){
ans = num[i-2] * num[i-1];
num[i-2] = ans;
i--;
}
else{
y = atoi(s);
num[i] = y;
i++;
}
}
printf("%d\n", num[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285952/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285952/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca [100 x i32], align 16
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %num) #5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call66 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not67 = icmp ne i32 %call66, -1
call void @llvm.assume(i1 %cmp.not67)
br label %while.body
while.body: ; preds = %entry, %if.end48
%i.068 = phi i32 [ %i.1, %if.end48 ], [ 0, %entry ]
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else42 [
i8 43, label %if.then
i8 45, label %if.then14
i8 42, label %if.then31
]
if.then: ; preds = %while.body
%sub = add nsw i32 %i.068, -2
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%sub4 = add nsw i32 %i.068, -1
%idxprom5 = sext i32 %sub4 to i64
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx3, align 4, !tbaa !8
br label %if.end48
if.then14: ; preds = %while.body
%sub15 = add nsw i32 %i.068, -2
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom16
%3 = load i32, ptr %arrayidx17, align 4, !tbaa !8
%sub18 = add nsw i32 %i.068, -1
%idxprom19 = sext i32 %sub18 to i64
%arrayidx20 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom19
%4 = load i32, ptr %arrayidx20, align 4, !tbaa !8
%sub21 = sub nsw i32 %3, %4
store i32 %sub21, ptr %arrayidx17, align 4, !tbaa !8
br label %if.end48
if.then31: ; preds = %while.body
%sub32 = add nsw i32 %i.068, -2
%idxprom33 = sext i32 %sub32 to i64
%arrayidx34 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom33
%5 = load i32, ptr %arrayidx34, align 4, !tbaa !8
%sub35 = add nsw i32 %i.068, -1
%idxprom36 = sext i32 %sub35 to i64
%arrayidx37 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom36
%6 = load i32, ptr %arrayidx37, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx34, align 4, !tbaa !8
br label %if.end48
if.else42: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%idxprom45 = sext i32 %i.068 to i64
%arrayidx46 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom45
store i32 %conv.i, ptr %arrayidx46, align 4, !tbaa !8
%inc = add nsw i32 %i.068, 1
br label %if.end48
if.end48: ; preds = %if.then14, %if.else42, %if.then31, %if.then
%i.1 = phi i32 [ %sub4, %if.then ], [ %sub18, %if.then14 ], [ %sub35, %if.then31 ], [ %inc, %if.else42 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end48
%.pre = load i32, ptr %num, align 16, !tbaa !8
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 400, 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top,S[1000];
void push(int x){
S[++top] = x;
}
int pop(){
top--;
return S[top+1];
}
int main(){
int a,b;
top = 0;
char s[100];
while(scanf("%s",s) != EOF){
if(s[0] == '+'){
a = pop();
b = pop();
push(a+b);
}
else if(s[0] == '-'){
b = pop();
a = pop();
push(a-b);
}
else if(s[0] == '*'){
a = pop();
b = pop();
push(a*b);
}
else{
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_285996/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_285996/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <stdlib.h>
void push(int);
int pop();
int num[1000];
int n=0;
int main(){
int i,x,y,ans;
char c[100];
for(i=0 ; i<100 ; i++){
num[i]=0;
}
while(scanf("%s",c)!=EOF){
//if(c=='\n') break;
//if(c==' ') continue;
if(c[0]=='+'){
x=pop();
y=pop();
push(x+y);
}
else if(c[0]=='-'){
x=pop();
y=pop();
push(y-x);
}
else if(c[0]=='*'){
x=pop();
y=pop();
push(x*y);
}
else push(atoi(c));
}
ans=pop();
printf("%d\n",ans);
return 0;
}
void push(int x){
n++;
num[n]=x;
}
int pop(){
n--;
return num[n+1];
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286038/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286038/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local local_unnamed_addr global i32 0, align 4
@num = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %c) #6
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) @num, i8 0, i64 400, i1 false), !tbaa !5
%call65 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp1.not66 = icmp eq i32 %call65, -1
br i1 %cmp1.not66, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end26
%0 = load i8, ptr %c, align 16, !tbaa !9
switch i8 %0, label %if.else22 [
i8 43, label %if.then
i8 45, label %if.then11
i8 42, label %if.then19
]
if.then: ; preds = %while.body
%1 = load i32, ptr @n, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i36 = sext i32 %dec.i to i64
%arrayidx.i37 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i36
%3 = load i32, ptr %arrayidx.i37, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @n, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i37, align 4, !tbaa !5
br label %if.end26
if.then11: ; preds = %while.body
%4 = load i32, ptr @n, align 4, !tbaa !5
%dec.i40 = add nsw i32 %4, -1
%idxprom.i41 = sext i32 %4 to i64
%arrayidx.i42 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i41
%5 = load i32, ptr %arrayidx.i42, align 4, !tbaa !5
%idxprom.i44 = sext i32 %dec.i40 to i64
%arrayidx.i45 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i44
%6 = load i32, ptr %arrayidx.i45, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i40, ptr @n, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i45, align 4, !tbaa !5
br label %if.end26
if.then19: ; preds = %while.body
%7 = load i32, ptr @n, align 4, !tbaa !5
%dec.i49 = add nsw i32 %7, -1
%idxprom.i50 = sext i32 %7 to i64
%arrayidx.i51 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i50
%8 = load i32, ptr %arrayidx.i51, align 4, !tbaa !5
%idxprom.i53 = sext i32 %dec.i49 to i64
%arrayidx.i54 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i53
%9 = load i32, ptr %arrayidx.i54, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i49, ptr @n, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i54, align 4, !tbaa !5
br label %if.end26
if.else22: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %c, ptr noundef null, i32 noundef 10) #6
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @n, align 4, !tbaa !5
%inc.i58 = add nsw i32 %10, 1
store i32 %inc.i58, ptr @n, align 4, !tbaa !5
%idxprom.i59 = sext i32 %inc.i58 to i64
%arrayidx.i60 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i59
store i32 %conv.i, ptr %arrayidx.i60, align 4, !tbaa !5
br label %if.end26
if.end26: ; preds = %if.then11, %if.else22, %if.then19, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp1.not = icmp eq i32 %call, -1
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end26, %entry
%11 = load i32, ptr @n, align 4, !tbaa !5
%dec.i61 = add nsw i32 %11, -1
store i32 %dec.i61, ptr @n, align 4, !tbaa !5
%idxprom.i62 = sext i32 %11 to i64
%arrayidx.i63 = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom.i62
%12 = load i32, ptr %arrayidx.i63, align 4, !tbaa !5
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %c) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @n, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @n, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @num, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
int x,S[100],i=0;
char s[100];
for(i=0;scanf("%s", s) != EOF; ){
if ( s[0] == '+' ){
S[i-2]=S[i-2]+S[i-1];
i--;
} else if ( s[0] == '-' ){
S[i-2]=S[i-2]-S[i-1];
i--;
} else if ( s[0] == '*' ){
S[i-2]=S[i-2]*S[i-1];
i--;
} else {
x = atoi(s);
S[i]=x;
i++;
}
}
printf("%d\n",S[i-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286089/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286089/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [100 x i32], align 16
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #4
%call67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not68 = icmp eq i32 %call67, -1
br i1 %cmp.not68, label %for.end, label %for.body
for.body: ; preds = %entry, %if.end48
%i.069 = phi i32 [ %i.1, %if.end48 ], [ 0, %entry ]
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else42 [
i8 43, label %if.then
i8 45, label %if.then14
i8 42, label %if.then31
]
if.then: ; preds = %for.body
%sub = add nsw i32 %i.069, -2
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%sub4 = add nsw i32 %i.069, -1
%idxprom5 = sext i32 %sub4 to i64
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx3, align 4, !tbaa !8
br label %if.end48
if.then14: ; preds = %for.body
%sub15 = add nsw i32 %i.069, -2
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom16
%3 = load i32, ptr %arrayidx17, align 4, !tbaa !8
%sub18 = add nsw i32 %i.069, -1
%idxprom19 = sext i32 %sub18 to i64
%arrayidx20 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom19
%4 = load i32, ptr %arrayidx20, align 4, !tbaa !8
%sub21 = sub nsw i32 %3, %4
store i32 %sub21, ptr %arrayidx17, align 4, !tbaa !8
br label %if.end48
if.then31: ; preds = %for.body
%sub32 = add nsw i32 %i.069, -2
%idxprom33 = sext i32 %sub32 to i64
%arrayidx34 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom33
%5 = load i32, ptr %arrayidx34, align 4, !tbaa !8
%sub35 = add nsw i32 %i.069, -1
%idxprom36 = sext i32 %sub35 to i64
%arrayidx37 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom36
%6 = load i32, ptr %arrayidx37, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx34, align 4, !tbaa !8
br label %if.end48
if.else42: ; preds = %for.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #4
%conv.i = trunc i64 %call.i to i32
%idxprom45 = sext i32 %i.069 to i64
%arrayidx46 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %idxprom45
store i32 %conv.i, ptr %arrayidx46, align 4, !tbaa !8
%inc = add nsw i32 %i.069, 1
br label %if.end48
if.end48: ; preds = %if.then14, %if.else42, %if.then31, %if.then
%i.1 = phi i32 [ %sub4, %if.then ], [ %sub18, %if.then14 ], [ %sub35, %if.then31 ], [ %inc, %if.else42 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %for.end.loopexit, label %for.body, !llvm.loop !10
for.end.loopexit: ; preds = %if.end48
%7 = add nsw i32 %i.1, -1
%8 = sext i32 %7 to i64
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i64 [ -1, %entry ], [ %8, %for.end.loopexit ]
%arrayidx51 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %i.0.lcssa
%9 = load i32, ptr %arrayidx51, align 4, !tbaa !8
%call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 400, 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { 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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void push(int);
int pop();
int top;
int s[1000];
int main(){
int i,j,a,b;
char S[100];
top = 0;
while( scanf("%s",S) != EOF){
if(S[0] == '+'){
a=pop();
b=pop();
push(a+b);
}
else if(S[0] == '-'){
b=pop();
a=pop();
push(a-b);
}
else if(S[0] == '*'){
a=pop();
b=pop();
push(a*b);
}
else push(atoi(S));
}
printf("%d\n",pop());
return 0;
}
void push(int x){
top++;
s[top] = x;
}
int pop(){
top--;
return s[top+1];
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286131/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286131/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@s = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S) #5
store i32 0, ptr @top, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %S, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %S, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %S) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int x[100], top = -1;
char s[100];
while (scanf("%s", s) != EOF) {
if (s[0]=='+') {
x[top - 1] = x[top - 1] + x[top];
top--;
}
else if (s[0]=='-') {
x[top - 1] = x[top - 1] - x[top];
top--;
}
else if (s[0]=='*') {
x[top - 1] = x[top - 1] * x[top];
top--;
}
else {
x[top + 1] = atoi(s);
top++;
}
}
printf("%d\n", x[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286175/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286175/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [100 x i32], align 16
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not63 = icmp ne i32 %call62, -1
call void @llvm.assume(i1 %cmp.not63)
br label %while.body
while.body: ; preds = %entry, %if.end46
%top.064 = phi i32 [ %top.1, %if.end46 ], [ -1, %entry ]
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else39 [
i8 43, label %if.then
i8 45, label %if.then13
i8 42, label %if.then29
]
if.then: ; preds = %while.body
%sub = add nsw i32 %top.064, -1
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%idxprom4 = sext i32 %top.064 to i64
%arrayidx5 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom4
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx3, align 4, !tbaa !8
br label %if.end46
if.then13: ; preds = %while.body
%sub14 = add nsw i32 %top.064, -1
%idxprom15 = sext i32 %sub14 to i64
%arrayidx16 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom15
%3 = load i32, ptr %arrayidx16, align 4, !tbaa !8
%idxprom17 = sext i32 %top.064 to i64
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom17
%4 = load i32, ptr %arrayidx18, align 4, !tbaa !8
%sub19 = sub nsw i32 %3, %4
store i32 %sub19, ptr %arrayidx16, align 4, !tbaa !8
br label %if.end46
if.then29: ; preds = %while.body
%sub30 = add nsw i32 %top.064, -1
%idxprom31 = sext i32 %sub30 to i64
%arrayidx32 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom31
%5 = load i32, ptr %arrayidx32, align 4, !tbaa !8
%idxprom33 = sext i32 %top.064 to i64
%arrayidx34 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom33
%6 = load i32, ptr %arrayidx34, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx32, align 4, !tbaa !8
br label %if.end46
if.else39: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%add42 = add nsw i32 %top.064, 1
%idxprom43 = sext i32 %add42 to i64
%arrayidx44 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom43
store i32 %conv.i, ptr %arrayidx44, align 4, !tbaa !8
br label %if.end46
if.end46: ; preds = %if.then13, %if.else39, %if.then29, %if.then
%top.1 = phi i32 [ %sub, %if.then ], [ %sub14, %if.then13 ], [ %sub30, %if.then29 ], [ %add42, %if.else39 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end46
%.pre = load i32, ptr %x, align 16, !tbaa !8
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int top = 0, S[1000];
void push(int x) {
S[++top] = x;
}
/* S[top++] = x ??£??\????????????top????¢???????
S[++top] = x top????¢??????????????????£??\ */
int pop() {
top--;
/* printf("top: %d\n",top); ?£??¶? */
return S[top+1];
}
int main(void) {
int a,b;
char s[100];
while(scanf("%s",s) != EOF) {
if(s[0] == '+') {
a = pop();
b = pop();
push(a + b);
} else if(s[0] == '-') {
b = pop();
a = pop();
push(a - b);
} else if(s[0] == '*') {
b = pop();
a = pop();
push(a * b);
} else {
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286218/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286218/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int STACK[1000];
int POINT = 0;
void push(int i){
STACK[POINT] = i;
POINT++;
}
int pop(void){
POINT--;
return STACK[POINT];
}
int main(void){
char read[10];
int l=0;
int r=0;
while(scanf("%s ", read)== 1){
if(read[0] == '+') push(pop()+pop());
else if(read[0] == '-'){
r = pop();
l = pop();
push(l-r);
}
else if(read[0] == '*') push(pop()*pop());
else if(read[0] == '/'){
r = pop();
l = pop();
push(l/r);
}
else{
push(atoi(read));
}
}
printf("%d\n", pop());
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286269/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286269/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@POINT = dso_local local_unnamed_addr global i32 0, align 4
@STACK = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%s \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(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %i) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @POINT, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom
store i32 %i, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @POINT, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @POINT, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @POINT, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%read = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %read) #5
%call76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %read)
%cmp77 = icmp eq i32 %call76, 1
br i1 %cmp77, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end33
%0 = load i8, ptr %read, align 1, !tbaa !9
switch i8 %0, label %if.else28 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
i8 47, label %if.then25
]
if.then: ; preds = %while.body
%1 = load i32, ptr @POINT, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %dec.i to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%dec.i38 = add nsw i32 %1, -2
%idxprom.i39 = sext i32 %dec.i38 to i64
%arrayidx.i40 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i39
%3 = load i32, ptr %arrayidx.i40, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %add, ptr %arrayidx.i40, align 4, !tbaa !5
br label %if.end33
if.then9: ; preds = %while.body
%4 = load i32, ptr @POINT, align 4, !tbaa !5
%dec.i43 = add nsw i32 %4, -1
%idxprom.i44 = sext i32 %dec.i43 to i64
%arrayidx.i45 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i44
%5 = load i32, ptr %arrayidx.i45, align 4, !tbaa !5
%dec.i46 = add nsw i32 %4, -2
%idxprom.i47 = sext i32 %dec.i46 to i64
%arrayidx.i48 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i47
%6 = load i32, ptr %arrayidx.i48, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %sub, ptr %arrayidx.i48, align 4, !tbaa !5
br label %if.end33
if.then17: ; preds = %while.body
%7 = load i32, ptr @POINT, align 4, !tbaa !5
%dec.i52 = add nsw i32 %7, -1
%idxprom.i53 = sext i32 %dec.i52 to i64
%arrayidx.i54 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i53
%8 = load i32, ptr %arrayidx.i54, align 4, !tbaa !5
%dec.i55 = add nsw i32 %7, -2
%idxprom.i56 = sext i32 %dec.i55 to i64
%arrayidx.i57 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i56
%9 = load i32, ptr %arrayidx.i57, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %mul, ptr %arrayidx.i57, align 4, !tbaa !5
br label %if.end33
if.then25: ; preds = %while.body
%10 = load i32, ptr @POINT, align 4, !tbaa !5
%dec.i61 = add nsw i32 %10, -1
%idxprom.i62 = sext i32 %dec.i61 to i64
%arrayidx.i63 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i62
%11 = load i32, ptr %arrayidx.i63, align 4, !tbaa !5
%dec.i64 = add nsw i32 %10, -2
%idxprom.i65 = sext i32 %dec.i64 to i64
%arrayidx.i66 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i65
%12 = load i32, ptr %arrayidx.i66, align 4, !tbaa !5
%div = sdiv i32 %12, %11
store i32 %div, ptr %arrayidx.i66, align 4, !tbaa !5
br label %if.end33
if.else28: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %read, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%13 = load i32, ptr @POINT, align 4, !tbaa !5
%idxprom.i70 = sext i32 %13 to i64
%arrayidx.i71 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i70
store i32 %conv.i, ptr %arrayidx.i71, align 4, !tbaa !5
%inc.i72 = add nsw i32 %13, 1
br label %if.end33
if.end33: ; preds = %if.then9, %if.then25, %if.else28, %if.then17, %if.then
%dec.i43.sink = phi i32 [ %dec.i43, %if.then9 ], [ %dec.i61, %if.then25 ], [ %inc.i72, %if.else28 ], [ %dec.i52, %if.then17 ], [ %dec.i, %if.then ]
store i32 %dec.i43.sink, ptr @POINT, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %read)
%cmp = icmp eq i32 %call, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !10
while.end: ; preds = %if.end33, %entry
%14 = load i32, ptr @POINT, align 4, !tbaa !5
%dec.i73 = add nsw i32 %14, -1
store i32 %dec.i73, ptr @POINT, align 4, !tbaa !5
%idxprom.i74 = sext i32 %dec.i73 to i64
%arrayidx.i75 = getelementptr inbounds [1000 x i32], ptr @STACK, i64 0, i64 %idxprom.i74
%15 = load i32, ptr %arrayidx.i75, align 4, !tbaa !5
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %read) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct node *link;
struct node {
int item;
link next;
};
static link head;
void Stackinit (int maxN) { head = NULL; }
int Stackenpty (void) { return head == NULL; }
int Stackpop (void) {
int item = head->item;
link t = head->next;
free(head);
head = t;
return item;
}
link NEW(int item, link next) {
link x = malloc(sizeof *x);
x->item = item;
x->next = next;
return x;
}
void Stackpush (int item) {
head = NEW(item, head);
}
int main(void) {
int result = 0, x1, x2;
char s[11];
Stackinit(1000);
while (scanf(" %10s", s) != EOF) {
if (s[0] == '+') {
x1 = Stackpop();
x2 = Stackpop();
Stackpush(x2 + x1);
} else if (s[0] == '-') {
x1 = Stackpop();
x2 = Stackpop();
Stackpush(x2 - x1);
} else if (s[0] == '*') {
x1 = Stackpop();
x2 = Stackpop();
Stackpush(x2 * x1);
} else if (isdigit(s[0])){
x1 = (int) strtol(s, NULL, 10);
Stackpush(x1);
} else break;
}
result = Stackpop();
printf("%d\n", result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286319/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286319/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.node = type { i32, ptr }
@head = internal unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [6 x i8] c" %10s\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(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Stackinit(i32 noundef %maxN) local_unnamed_addr #0 {
entry:
store ptr null, ptr @head, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Stackenpty() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @head, align 8, !tbaa !5
%cmp = icmp eq ptr %0, null
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: mustprogress nounwind willreturn uwtable
define dso_local i32 @Stackpop() local_unnamed_addr #2 {
entry:
%0 = load ptr, ptr @head, align 8, !tbaa !5
%1 = load i32, ptr %0, align 8, !tbaa !9
%next = getelementptr inbounds %struct.node, ptr %0, i64 0, i32 1
%2 = load ptr, ptr %next, align 8, !tbaa !12
tail call void @free(ptr noundef %0) #12
store ptr %2, ptr @head, align 8, !tbaa !5
ret i32 %1
}
; 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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @NEW(i32 noundef %item, ptr noundef %next) local_unnamed_addr #5 {
entry:
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #13
store i32 %item, ptr %call, align 8, !tbaa !9
%next2 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
store ptr %next, ptr %next2, align 8, !tbaa !12
ret ptr %call
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable
define dso_local void @Stackpush(i32 noundef %item) local_unnamed_addr #7 {
entry:
%0 = load ptr, ptr @head, align 8, !tbaa !5
%call.i = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #13
store i32 %item, ptr %call.i, align 8, !tbaa !9
%next2.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
store ptr %0, ptr %next2.i, align 8, !tbaa !12
store ptr %call.i, ptr @head, align 8, !tbaa !5
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
%s = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #12
store ptr null, ptr @head, align 8, !tbaa !5
%call53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not54 = icmp eq i32 %call53, -1
br i1 %cmp.not54, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end33
%0 = load i8, ptr %s, align 1, !tbaa !13
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load ptr, ptr @head, align 8, !tbaa !5
%2 = load i32, ptr %1, align 8, !tbaa !9
%next.i = getelementptr inbounds %struct.node, ptr %1, i64 0, i32 1
%3 = load ptr, ptr %next.i, align 8, !tbaa !12
call void @free(ptr noundef %1) #12
%4 = load i32, ptr %3, align 8, !tbaa !9
%next.i41 = getelementptr inbounds %struct.node, ptr %3, i64 0, i32 1
%5 = load ptr, ptr %next.i41, align 8, !tbaa !12
call void @free(ptr noundef %3) #12
%add = add nsw i32 %4, %2
%call.i.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #13
store i32 %add, ptr %call.i.i, align 8, !tbaa !9
br label %if.end33
if.then9: ; preds = %while.body
%6 = load ptr, ptr @head, align 8, !tbaa !5
%7 = load i32, ptr %6, align 8, !tbaa !9
%next.i42 = getelementptr inbounds %struct.node, ptr %6, i64 0, i32 1
%8 = load ptr, ptr %next.i42, align 8, !tbaa !12
call void @free(ptr noundef %6) #12
%9 = load i32, ptr %8, align 8, !tbaa !9
%next.i43 = getelementptr inbounds %struct.node, ptr %8, i64 0, i32 1
%10 = load ptr, ptr %next.i43, align 8, !tbaa !12
call void @free(ptr noundef %8) #12
%sub = sub nsw i32 %9, %7
%call.i.i44 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #13
store i32 %sub, ptr %call.i.i44, align 8, !tbaa !9
br label %if.end33
if.then17: ; preds = %while.body
%11 = load ptr, ptr @head, align 8, !tbaa !5
%12 = load i32, ptr %11, align 8, !tbaa !9
%next.i46 = getelementptr inbounds %struct.node, ptr %11, i64 0, i32 1
%13 = load ptr, ptr %next.i46, align 8, !tbaa !12
call void @free(ptr noundef %11) #12
%14 = load i32, ptr %13, align 8, !tbaa !9
%next.i47 = getelementptr inbounds %struct.node, ptr %13, i64 0, i32 1
%15 = load ptr, ptr %next.i47, align 8, !tbaa !12
call void @free(ptr noundef %13) #12
%mul = mul nsw i32 %14, %12
%call.i.i48 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #13
store i32 %mul, ptr %call.i.i48, align 8, !tbaa !9
br label %if.end33
if.else20: ; preds = %while.body
%call21 = tail call ptr @__ctype_b_loc() #14
%16 = load ptr, ptr %call21, align 8, !tbaa !5
%idxprom = sext i8 %0 to i64
%arrayidx24 = getelementptr inbounds i16, ptr %16, i64 %idxprom
%17 = load i16, ptr %arrayidx24, align 2, !tbaa !14
%18 = and i16 %17, 2048
%tobool.not = icmp eq i16 %18, 0
br i1 %tobool.not, label %while.end, label %if.then26
if.then26: ; preds = %if.else20
%call28 = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #12
%conv29 = trunc i64 %call28 to i32
%19 = load ptr, ptr @head, align 8, !tbaa !5
%call.i.i50 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #13
store i32 %conv29, ptr %call.i.i50, align 8, !tbaa !9
br label %if.end33
if.end33: ; preds = %if.then9, %if.then26, %if.then17, %if.then
%call.i.i44.sink55 = phi ptr [ %call.i.i44, %if.then9 ], [ %call.i.i50, %if.then26 ], [ %call.i.i48, %if.then17 ], [ %call.i.i, %if.then ]
%.sink = phi ptr [ %10, %if.then9 ], [ %19, %if.then26 ], [ %15, %if.then17 ], [ %5, %if.then ]
%next2.i.i45 = getelementptr inbounds %struct.node, ptr %call.i.i44.sink55, i64 0, i32 1
store ptr %.sink, ptr %next2.i.i45, align 8, !tbaa !12
store ptr %call.i.i44.sink55, ptr @head, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.end33, %if.else20, %entry
%20 = load ptr, ptr @head, align 8, !tbaa !5
%21 = load i32, ptr %20, align 8, !tbaa !9
%next.i52 = getelementptr inbounds %struct.node, ptr %20, i64 0, i32 1
%22 = load ptr, ptr %next.i52, align 8, !tbaa !12
call void @free(ptr noundef %20) #12
store ptr %22, ptr @head, align 8, !tbaa !5
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #12
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #10
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #11
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
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 nofree norecurse nosync nounwind willreturn 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 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 #3 = { mustprogress nocallback nofree nosync 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 = { 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 #6 = { 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 #7 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-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 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 #12 = { nounwind }
attributes #13 = { nounwind allocsize(0) }
attributes #14 = { nounwind 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 = !{!10, !11, i64 0}
!10 = !{!"node", !11, i64 0, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int myTop = 0;
int myData[110] = { 0 };
void push(int x)
{
myData[++myTop] = x;
}
void pop()
{
--myTop;
}
int top()
{
return myData[myTop];
}
int main()
{
char chIn[1000] = { '\0' };
int nTemp = 0;
int na = 0, nb = 0;
while (scanf("%s", chIn) != EOF)
{
if (chIn[0] - '0' <= 9 && chIn[0] - '0' >= 0)
{
nTemp = atoi(chIn);
push(nTemp);
}
else
{
nb = top();
pop();
na = top();
pop();
switch (chIn[0])
{
case '-':
push(na - nb);
break;
case '+':
push(na + nb);
break;
case '*':
push(na * nb);
break;
}
}
}
printf("%d\n", top());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286362/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286362/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@myTop = dso_local local_unnamed_addr global i32 0, align 4
@myData = dso_local local_unnamed_addr global [110 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @myTop, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @myTop, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [110 x i32], ptr @myData, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @myTop, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @myTop, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @top() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @myTop, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [110 x i32], ptr @myData, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%chIn = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %chIn) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) %chIn, i8 0, i64 1000, i1 false)
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %chIn)
%cmp.not40 = icmp eq i32 %call39, -1
br i1 %cmp.not40, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i8, ptr %chIn, align 16, !tbaa !9
%1 = add i8 %0, -48
%or.cond = icmp ult i8 %1, 10
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %chIn, ptr noundef null, i32 noundef 10) #7
%conv.i = trunc i64 %call.i to i32
%2 = load i32, ptr @myTop, align 4, !tbaa !5
%inc.i = add nsw i32 %2, 1
store i32 %inc.i, ptr @myTop, align 4, !tbaa !5
%idxprom.i = sext i32 %inc.i to i64
%arrayidx.i = getelementptr inbounds [110 x i32], ptr @myData, i64 0, i64 %idxprom.i
store i32 %conv.i, ptr %arrayidx.i, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%3 = load i32, ptr @myTop, align 4, !tbaa !5
%idxprom.i23 = sext i32 %3 to i64
%arrayidx.i24 = getelementptr inbounds [110 x i32], ptr @myData, i64 0, i64 %idxprom.i23
%4 = load i32, ptr %arrayidx.i24, align 4, !tbaa !5
%dec.i = add nsw i32 %3, -1
%idxprom.i25 = sext i32 %dec.i to i64
%arrayidx.i26 = getelementptr inbounds [110 x i32], ptr @myData, i64 0, i64 %idxprom.i25
%5 = load i32, ptr %arrayidx.i26, align 4, !tbaa !5
%dec.i27 = add nsw i32 %3, -2
store i32 %dec.i27, ptr @myTop, align 4, !tbaa !5
%conv13 = sext i8 %0 to i32
switch i32 %conv13, label %if.end [
i32 45, label %sw.bb
i32 43, label %sw.bb15
i32 42, label %sw.bb16
]
sw.bb: ; preds = %if.else
%sub14 = sub nsw i32 %5, %4
store i32 %dec.i, ptr @myTop, align 4, !tbaa !5
store i32 %sub14, ptr %arrayidx.i26, align 4, !tbaa !5
br label %if.end
sw.bb15: ; preds = %if.else
%add = add nsw i32 %5, %4
store i32 %dec.i, ptr @myTop, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i26, align 4, !tbaa !5
br label %if.end
sw.bb16: ; preds = %if.else
%mul = mul nsw i32 %5, %4
store i32 %dec.i, ptr @myTop, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i26, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %sw.bb, %sw.bb15, %sw.bb16, %if.else, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %chIn)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end, %entry
%6 = load i32, ptr @myTop, align 4, !tbaa !5
%idxprom.i37 = sext i32 %6 to i64
%arrayidx.i38 = getelementptr inbounds [110 x i32], ptr @myData, i64 0, i64 %idxprom.i37
%7 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %chIn) #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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 = { 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 #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
void yes() {
printf("YES");
exit(0);
}
void no() {
printf("NO");
exit(0);
}
int main(int argc, char *argv[]) {
int n, a[1005], tmp;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (a[i] > a[j]) {
tmp = a[j];
a[j] = a[i];
a[i] = tmp;
}
}
}
if (n % 2 == 1) printf("%d", a[n / 2]);
else printf("%d", a[n / 2 - 1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28642/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28642/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"YES\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: noreturn nounwind uwtable
define dso_local void @yes() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
tail call void @exit(i32 noundef 0) #5
unreachable
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2
; Function Attrs: noreturn nounwind uwtable
define dso_local void @no() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
tail call void @exit(i32 noundef 0) #5
unreachable
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%a = alloca [1005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4020, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp55 = icmp sgt i32 %0, 0
br i1 %cmp55, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp459 = icmp sgt i32 %2, 1
br i1 %cmp459, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%sub = add nsw i32 %2, -1
%1 = zext i32 %2 to i64
%wide.trip.count71 = zext i32 %sub to i64
%wide.trip.count = zext i32 %2 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond3.loopexit: ; preds = %for.inc24, %for.body6
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond72.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count71
br i1 %exitcond72.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader
%.lcssa75 = phi i32 [ %2, %for.cond3.preheader ], [ %0, %entry ], [ %2, %for.cond3.loopexit ]
%4 = and i32 %.lcssa75, -2147483647
%cmp30 = icmp eq i32 %4, 1
br i1 %cmp30, label %if.then31, label %if.else
for.body6: ; preds = %for.body6.preheader, %for.cond3.loopexit
%indvars.iv68 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next69, %for.cond3.loopexit ]
%indvars.iv63 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next64, %for.cond3.loopexit ]
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%cmp857 = icmp ult i64 %indvars.iv.next69, %1
br i1 %cmp857, label %for.body10.lr.ph, label %for.cond3.loopexit
for.body10.lr.ph: ; preds = %for.body6
%arrayidx12 = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv68
%.pre = load i32, ptr %arrayidx12, align 4, !tbaa !5
br label %for.body10
for.body10: ; preds = %for.body10.lr.ph, %for.inc24
%5 = phi i32 [ %.pre, %for.body10.lr.ph ], [ %7, %for.inc24 ]
%indvars.iv65 = phi i64 [ %indvars.iv63, %for.body10.lr.ph ], [ %indvars.iv.next66, %for.inc24 ]
%arrayidx14 = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv65
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %5, %6
br i1 %cmp15, label %if.then, label %for.inc24
if.then: ; preds = %for.body10
store i32 %5, ptr %arrayidx14, align 4, !tbaa !5
store i32 %6, ptr %arrayidx12, align 4, !tbaa !5
br label %for.inc24
for.inc24: ; preds = %for.body10, %if.then
%7 = phi i32 [ %5, %for.body10 ], [ %6, %if.then ]
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%exitcond.not = icmp eq i64 %indvars.iv.next66, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body10, !llvm.loop !12
if.then31: ; preds = %for.cond.cleanup5
%div5354 = lshr i32 %.lcssa75, 1
%idxprom32 = zext i32 %div5354 to i64
br label %if.end40
if.else: ; preds = %for.cond.cleanup5
%div35 = sdiv i32 %.lcssa75, 2
%sub36 = add nsw i32 %div35, -1
%idxprom37 = sext i32 %sub36 to i64
br label %if.end40
if.end40: ; preds = %if.else, %if.then31
%idxprom37.sink = phi i64 [ %idxprom37, %if.else ], [ %idxprom32, %if.then31 ]
%arrayidx38 = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %idxprom37.sink
%8 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4020, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; 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) #4
attributes #0 = { noreturn nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { noreturn nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 100
int pr,stack[1000];
void push(int a){
stack[++pr]=a;
}
int pop(){
pr--;
return stack[pr+1];
}
int main(){
int x,y;
char ary[N];
pr=0;
while(scanf("%s",ary)!=EOF){
if(ary[0]=='+'){
x=pop();
y=pop();
push(x+y);
}
else if(ary[0]=='-'){
y=pop();
x=pop();
push(x-y);
}
else if(ary[0]=='*'){
x=pop();
y=pop();
push(x*y);
}
else{
push(atoi(ary));
}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286463/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286463/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stack = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@pr = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %a) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @pr, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @pr, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom
store i32 %a, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @pr, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @pr, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%ary = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %ary) #5
store i32 0, ptr @pr, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ary)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %ary, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @pr, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @pr, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @pr, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @pr, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @pr, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @pr, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %ary, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @pr, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @pr, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ary)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @pr, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @pr, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %ary) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include<stdio.h>
#include<stdlib.h>
#define N 100
int main(){
char stack[N];
int STACK[N];
int cal1=0,cal2=0,top=0;
while(1){
if((scanf("%s",stack)) ==EOF) break;
if(stack[0]==' ') continue;
else{
if('0'<=stack[0] && stack[0]<='9'){
STACK[top++]=atoi(stack);
}
else if(stack[0]=='+'){
cal1=STACK[top-2];
cal2=STACK[top-1];
top-=2;
STACK[top++]=cal1+cal2;
}
else if(stack[0]=='-'){
cal1=STACK[top-2];
cal2=STACK[top-1];
top-=2;
STACK[top++]=cal1-cal2;
}
else if(stack[0]=='*'){
cal1=STACK[top-2];
cal2=STACK[top-1];
top-=2;
STACK[top++]=cal1*cal2;
}
}
}
printf("%d\n",STACK[top-1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286528/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286528/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%stack = alloca [100 x i8], align 16
%STACK = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %stack) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %STACK) #4
br label %while.cond.outer.outer
while.cond.outer.outer: ; preds = %while.cond.outer.outer.backedge, %entry
%top.0.ph.ph = phi i32 [ 0, %entry ], [ %top.0.ph.ph.be, %while.cond.outer.outer.backedge ]
br label %while.cond.outer
while.cond.outer: ; preds = %while.cond.outer.outer, %if.else16
br label %while.cond
while.cond: ; preds = %while.cond.outer, %if.end
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %stack)
%cmp = icmp eq i32 %call, -1
br i1 %cmp, label %while.end, label %if.end
if.end: ; preds = %while.cond
%0 = load i8, ptr %stack, align 16
%cmp1 = icmp eq i8 %0, 32
br i1 %cmp1, label %while.cond, label %if.else
if.else: ; preds = %if.end
%1 = add i8 %0, -48
%or.cond = icmp ult i8 %1, 10
br i1 %or.cond, label %if.then12, label %if.else16
if.then12: ; preds = %if.else
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %stack, ptr noundef null, i32 noundef 10) #4
%conv.i = trunc i64 %call.i to i32
%inc = add nsw i32 %top.0.ph.ph, 1
%idxprom = sext i32 %top.0.ph.ph to i64
%arrayidx15 = getelementptr inbounds [100 x i32], ptr %STACK, i64 0, i64 %idxprom
store i32 %conv.i, ptr %arrayidx15, align 4, !tbaa !5
br label %while.cond.outer.outer.backedge
while.cond.outer.outer.backedge: ; preds = %if.then12, %if.then21, %if.then36, %if.then53
%top.0.ph.ph.be = phi i32 [ %sub57, %if.then53 ], [ %sub40, %if.then36 ], [ %sub24, %if.then21 ], [ %inc, %if.then12 ]
br label %while.cond.outer.outer
if.else16: ; preds = %if.else
switch i8 %0, label %while.cond.outer [
i8 43, label %if.then21
i8 45, label %if.then36
i8 42, label %if.then53
]
if.then21: ; preds = %if.else16
%sub = add nsw i32 %top.0.ph.ph, -2
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds [100 x i32], ptr %STACK, i64 0, i64 %idxprom22
%2 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%sub24 = add nsw i32 %top.0.ph.ph, -1
%idxprom25 = sext i32 %sub24 to i64
%arrayidx26 = getelementptr inbounds [100 x i32], ptr %STACK, i64 0, i64 %idxprom25
%3 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %add, ptr %arrayidx23, align 4, !tbaa !5
br label %while.cond.outer.outer.backedge
if.then36: ; preds = %if.else16
%sub37 = add nsw i32 %top.0.ph.ph, -2
%idxprom38 = sext i32 %sub37 to i64
%arrayidx39 = getelementptr inbounds [100 x i32], ptr %STACK, i64 0, i64 %idxprom38
%4 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%sub40 = add nsw i32 %top.0.ph.ph, -1
%idxprom41 = sext i32 %sub40 to i64
%arrayidx42 = getelementptr inbounds [100 x i32], ptr %STACK, i64 0, i64 %idxprom41
%5 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%sub44 = sub nsw i32 %4, %5
store i32 %sub44, ptr %arrayidx39, align 4, !tbaa !5
br label %while.cond.outer.outer.backedge
if.then53: ; preds = %if.else16
%sub54 = add nsw i32 %top.0.ph.ph, -2
%idxprom55 = sext i32 %sub54 to i64
%arrayidx56 = getelementptr inbounds [100 x i32], ptr %STACK, i64 0, i64 %idxprom55
%6 = load i32, ptr %arrayidx56, align 4, !tbaa !5
%sub57 = add nsw i32 %top.0.ph.ph, -1
%idxprom58 = sext i32 %sub57 to i64
%arrayidx59 = getelementptr inbounds [100 x i32], ptr %STACK, i64 0, i64 %idxprom58
%7 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%mul = mul nsw i32 %7, %6
store i32 %mul, ptr %arrayidx56, align 4, !tbaa !5
br label %while.cond.outer.outer.backedge
while.end: ; preds = %while.cond
%sub69 = add nsw i32 %top.0.ph.ph, -1
%idxprom70 = sext i32 %sub69 to i64
%arrayidx71 = getelementptr inbounds [100 x i32], ptr %STACK, i64 0, i64 %idxprom70
%8 = load i32, ptr %arrayidx71, align 4, !tbaa !5
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %STACK) #4
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %stack) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { 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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top,S[1000];
void push(int);
int pop();
int main(){
int a,b;
top = 0;
char s[100];
while(scanf("%s",s)!=EOF){
if(s[0]=='+'){
a=pop();
b=pop();
push(a+b);
}
else if(s[0]=='-'){
b=pop();
a=pop();
push(a-b);
}
else if(s[0]=='*'){
a=pop();
b=pop();
push(a*b);
}
else {
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
void push(int x){
S[++top] = x;
}
int pop(){
top--;
return S[top+1];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286571/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286571/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define MAX 200
void initialize();
bool isEnpty();
bool isFull();
void push(int);
int pop();
int S[MAX];
int top;
int main(){
int x, num1, num2;
char s[100];
initialize();
while( scanf("%s", s) != EOF ){
if ( s[0] == '+' ){
num1=pop();
num2=pop();
push(num2+num1);
}
else if ( s[0] == '-' ){
num1=pop();
num2=pop();
push(num2-num1);
}
else if ( s[0] == '*' ){
num1=pop();
num2=pop();
push(num2*num1);
}
else {
x = atoi(s);
push(x);
}
}
printf("%d\n",pop());
return 0;
}
void initialize(){
top=0;
}
bool isEnpty(){
return top == 0;
}
bool isFull(){
return top >= MAX;
}
void push(int x){
if(isFull()){
fprintf(stderr, "オーバーフロー\n");
exit(0);
}
top++;
S[top]=x;
}
int pop(){
if(isFull()){
fprintf(stderr, "アンダーフロー\n");
exit(1);
}
top--;
return S[top+1];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286614/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286614/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@top = dso_local local_unnamed_addr global i32 0, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [23 x i8] c"\E3\82\AA\E3\83\BC\E3\83\90\E3\83\BC\E3\83\95\E3\83\AD\E3\83\BC\0A\00", align 1
@S = dso_local local_unnamed_addr global [200 x i32] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [23 x i8] c"\E3\82\A2\E3\83\B3\E3\83\80\E3\83\BC\E3\83\95\E3\83\AD\E3\83\BC\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #8
store i32 0, ptr @top, align 4, !tbaa !5
%call89 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not90 = icmp eq i32 %call89, -1
br i1 %cmp.not90, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.i = icmp sgt i32 %1, 199
br i1 %cmp.i.i, label %if.then.i, label %pop.exit
if.then.i: ; preds = %if.then
%2 = load ptr, ptr @stderr, align 8, !tbaa !10
%3 = call i64 @fwrite(ptr nonnull @.str.3, i64 22, i64 1, ptr %2) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit: ; preds = %if.then
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i33 = sext i32 %dec.i to i64
%arrayidx.i34 = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom.i33
%5 = load i32, ptr %arrayidx.i34, align 4, !tbaa !5
%add = add nsw i32 %5, %4
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i34, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%6 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.i41 = icmp sgt i32 %6, 199
br i1 %cmp.i.i41, label %if.then.i45, label %pop.exit46
if.then.i45: ; preds = %if.then9
%7 = load ptr, ptr @stderr, align 8, !tbaa !10
%8 = call i64 @fwrite(ptr nonnull @.str.3, i64 22, i64 1, ptr %7) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit46: ; preds = %if.then9
%dec.i42 = add nsw i32 %6, -1
%idxprom.i43 = sext i32 %6 to i64
%arrayidx.i44 = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom.i43
%9 = load i32, ptr %arrayidx.i44, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i42 to i64
%arrayidx.i50 = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom.i49
%10 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%sub = sub nsw i32 %10, %9
store i32 %dec.i42, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%11 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.i59 = icmp sgt i32 %11, 199
br i1 %cmp.i.i59, label %if.then.i63, label %pop.exit64
if.then.i63: ; preds = %if.then17
%12 = load ptr, ptr @stderr, align 8, !tbaa !10
%13 = call i64 @fwrite(ptr nonnull @.str.3, i64 22, i64 1, ptr %12) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit64: ; preds = %if.then17
%dec.i60 = add nsw i32 %11, -1
%idxprom.i61 = sext i32 %11 to i64
%arrayidx.i62 = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom.i61
%14 = load i32, ptr %arrayidx.i62, align 4, !tbaa !5
%idxprom.i67 = sext i32 %dec.i60 to i64
%arrayidx.i68 = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom.i67
%15 = load i32, ptr %arrayidx.i68, align 4, !tbaa !5
%mul = mul nsw i32 %15, %14
store i32 %dec.i60, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i68, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #8
%16 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.i77 = icmp sgt i32 %16, 199
br i1 %cmp.i.i77, label %if.then.i81, label %push.exit82
if.then.i81: ; preds = %if.else20
%17 = load ptr, ptr @stderr, align 8, !tbaa !10
%18 = call i64 @fwrite(ptr nonnull @.str.2, i64 22, i64 1, ptr %17) #9
call void @exit(i32 noundef 0) #10
unreachable
push.exit82: ; preds = %if.else20
%conv.i = trunc i64 %call.i to i32
%inc.i78 = add nsw i32 %16, 1
store i32 %inc.i78, ptr @top, align 4, !tbaa !5
%idxprom.i79 = sext i32 %inc.i78 to i64
%arrayidx.i80 = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom.i79
store i32 %conv.i, ptr %arrayidx.i80, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %pop.exit46, %push.exit82, %pop.exit64, %pop.exit
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end24, %entry
%19 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.i83 = icmp sgt i32 %19, 199
br i1 %cmp.i.i83, label %if.then.i87, label %pop.exit88
if.then.i87: ; preds = %while.end
%20 = load ptr, ptr @stderr, align 8, !tbaa !10
%21 = call i64 @fwrite(ptr nonnull @.str.3, i64 22, i64 1, ptr %20) #9
call void @exit(i32 noundef 1) #10
unreachable
pop.exit88: ; preds = %while.end
%dec.i84 = add nsw i32 %19, -1
store i32 %dec.i84, ptr @top, align 4, !tbaa !5
%idxprom.i85 = sext i32 %19 to i64
%arrayidx.i86 = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom.i85
%22 = load i32, ptr %arrayidx.i86, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %22)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i = icmp sgt i32 %0, 199
br i1 %cmp.i, label %if.then, label %if.end
if.then: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !10
%2 = tail call i64 @fwrite(ptr nonnull @.str.2, i64 22, i64 1, ptr %1) #9
tail call void @exit(i32 noundef 0) #10
unreachable
if.end: ; preds = %entry
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #3 {
entry:
store i32 0, ptr @top, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local zeroext i1 @isEnpty() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
ret i1 %cmp
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local zeroext i1 @isFull() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 199
ret i1 %cmp
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: nounwind uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i = icmp sgt i32 %0, 199
br i1 %cmp.i, label %if.then, label %if.end
if.then: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !10
%2 = tail call i64 @fwrite(ptr nonnull @.str.3, i64 22, i64 1, ptr %1) #9
tail call void @exit(i32 noundef 1) #10
unreachable
if.end: ; preds = %entry
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [200 x i32], ptr @S, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %3
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree 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 #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { cold }
attributes #10 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int x = 0, top = 0, stack[100];
char s[100];
while( scanf("%s", s) != EOF ){
if ( s[0] == '+' ){
stack[top-2] = stack[top-2] + stack[top-1];
top -= 1;
} else if ( s[0] == '-' ){
stack[top-2] = stack[top-2] - stack[top-1];
top -= 1;
} else if ( s[0] == '*' ){
stack[top-2] = stack[top-2] * stack[top-1];
top -= 1;
} else {
stack[top] = atoi(s);
top += 1;
}
}
printf("%d\n",stack[top-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286658/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286658/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%stack = alloca [100 x i32], align 16
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %stack) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #4
%call69 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not70 = icmp eq i32 %call69, -1
br i1 %cmp.not70, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end50
%top.071 = phi i32 [ %top.1, %if.end50 ], [ 0, %entry ]
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else43 [
i8 43, label %if.then
i8 45, label %if.then15
i8 42, label %if.then32
]
if.then: ; preds = %while.body
%sub = add nsw i32 %top.071, -2
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%sub4 = add nsw i32 %top.071, -1
%idxprom5 = sext i32 %sub4 to i64
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx3, align 4, !tbaa !8
br label %if.end50
if.then15: ; preds = %while.body
%sub16 = add nsw i32 %top.071, -2
%idxprom17 = sext i32 %sub16 to i64
%arrayidx18 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom17
%3 = load i32, ptr %arrayidx18, align 4, !tbaa !8
%sub19 = add nsw i32 %top.071, -1
%idxprom20 = sext i32 %sub19 to i64
%arrayidx21 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom20
%4 = load i32, ptr %arrayidx21, align 4, !tbaa !8
%sub22 = sub nsw i32 %3, %4
store i32 %sub22, ptr %arrayidx18, align 4, !tbaa !8
br label %if.end50
if.then32: ; preds = %while.body
%sub33 = add nsw i32 %top.071, -2
%idxprom34 = sext i32 %sub33 to i64
%arrayidx35 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom34
%5 = load i32, ptr %arrayidx35, align 4, !tbaa !8
%sub36 = add nsw i32 %top.071, -1
%idxprom37 = sext i32 %sub36 to i64
%arrayidx38 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom37
%6 = load i32, ptr %arrayidx38, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx35, align 4, !tbaa !8
br label %if.end50
if.else43: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #4
%conv.i = trunc i64 %call.i to i32
%idxprom46 = sext i32 %top.071 to i64
%arrayidx47 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %idxprom46
store i32 %conv.i, ptr %arrayidx47, align 4, !tbaa !8
%add48 = add nsw i32 %top.071, 1
br label %if.end50
if.end50: ; preds = %if.then15, %if.else43, %if.then32, %if.then
%top.1 = phi i32 [ %sub4, %if.then ], [ %sub19, %if.then15 ], [ %sub36, %if.then32 ], [ %add48, %if.else43 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end50
%7 = add nsw i32 %top.1, -1
%8 = sext i32 %7 to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%top.0.lcssa = phi i64 [ -1, %entry ], [ %8, %while.end.loopexit ]
%arrayidx53 = getelementptr inbounds [100 x i32], ptr %stack, i64 0, i64 %top.0.lcssa
%9 = load i32, ptr %arrayidx53, align 4, !tbaa !8
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %stack) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { 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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
int x[100],i=0;
char s[100];
while( scanf("%s", s) != EOF ){
if ( s[0] == '+' ){
i--;
x[i-1]=x[i-1]+x[i];
} else if ( s[0] == '-' ){
i--;
x[i-1]=x[i-1]-x[i];
} else if ( s[0] == '*' ){
i--;
x[i-1]=x[i-1]*x[i];
} else {
x[i] = atoi(s);
i++;
}
}
printf("%d\n",x[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286700/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286700/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [100 x i32], align 16
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not62 = icmp ne i32 %call61, -1
call void @llvm.assume(i1 %cmp.not62)
br label %while.body
while.body: ; preds = %entry, %if.end45
%i.063 = phi i32 [ %i.1, %if.end45 ], [ 0, %entry ]
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else39 [
i8 43, label %if.then
i8 45, label %if.then13
i8 42, label %if.then29
]
if.then: ; preds = %while.body
%dec = add nsw i32 %i.063, -1
%sub = add nsw i32 %i.063, -2
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%idxprom4 = sext i32 %dec to i64
%arrayidx5 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom4
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx3, align 4, !tbaa !8
br label %if.end45
if.then13: ; preds = %while.body
%dec14 = add nsw i32 %i.063, -1
%sub15 = add nsw i32 %i.063, -2
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom16
%3 = load i32, ptr %arrayidx17, align 4, !tbaa !8
%idxprom18 = sext i32 %dec14 to i64
%arrayidx19 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom18
%4 = load i32, ptr %arrayidx19, align 4, !tbaa !8
%sub20 = sub nsw i32 %3, %4
store i32 %sub20, ptr %arrayidx17, align 4, !tbaa !8
br label %if.end45
if.then29: ; preds = %while.body
%dec30 = add nsw i32 %i.063, -1
%sub31 = add nsw i32 %i.063, -2
%idxprom32 = sext i32 %sub31 to i64
%arrayidx33 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom32
%5 = load i32, ptr %arrayidx33, align 4, !tbaa !8
%idxprom34 = sext i32 %dec30 to i64
%arrayidx35 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom34
%6 = load i32, ptr %arrayidx35, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx33, align 4, !tbaa !8
br label %if.end45
if.else39: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%idxprom42 = sext i32 %i.063 to i64
%arrayidx43 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom42
store i32 %conv.i, ptr %arrayidx43, align 4, !tbaa !8
%inc = add nsw i32 %i.063, 1
br label %if.end45
if.end45: ; preds = %if.then13, %if.else39, %if.then29, %if.then
%i.1 = phi i32 [ %dec, %if.then ], [ %dec14, %if.then13 ], [ %dec30, %if.then29 ], [ %inc, %if.else39 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end45
%.pre = load i32, ptr %x, align 16, !tbaa !8
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
char s[10];//入力用変数
int A[102];//数値入力用配列
int point=0;
while(scanf("%s",s)!=EOF){
if(s[0]=='+'){
A[point-1]+=A[point];
point--;
}else if(s[0]=='-'){
A[point-1]-=A[point];
point--;
}else if(s[0]=='*'){
A[point-1]*=A[point];
point--;
}else{
point++;
A[point]=atoi(s);
}
}
printf("%d\n",A[1]);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286751/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286751/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [10 x i8], align 1
%A = alloca [102 x i32], align 16
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %A) #5
%call49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not50 = icmp ne i32 %call49, -1
call void @llvm.assume(i1 %cmp.not50)
br label %while.body
while.body: ; preds = %entry, %if.end36
%point.051 = phi i32 [ %point.1, %if.end36 ], [ 0, %entry ]
%0 = load i8, ptr %s, align 1, !tbaa !5
switch i8 %0, label %if.else30 [
i8 43, label %if.then
i8 45, label %if.then10
i8 42, label %if.then23
]
if.then: ; preds = %while.body
%idxprom = sext i32 %point.051 to i64
%arrayidx3 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !8
%sub = add nsw i32 %point.051, -1
%idxprom4 = sext i32 %sub to i64
%arrayidx5 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %idxprom4
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !8
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx5, align 4, !tbaa !8
br label %if.end36
if.then10: ; preds = %while.body
%idxprom11 = sext i32 %point.051 to i64
%arrayidx12 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %idxprom11
%3 = load i32, ptr %arrayidx12, align 4, !tbaa !8
%sub13 = add nsw i32 %point.051, -1
%idxprom14 = sext i32 %sub13 to i64
%arrayidx15 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %idxprom14
%4 = load i32, ptr %arrayidx15, align 4, !tbaa !8
%sub16 = sub nsw i32 %4, %3
store i32 %sub16, ptr %arrayidx15, align 4, !tbaa !8
br label %if.end36
if.then23: ; preds = %while.body
%idxprom24 = sext i32 %point.051 to i64
%arrayidx25 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %idxprom24
%5 = load i32, ptr %arrayidx25, align 4, !tbaa !8
%sub26 = add nsw i32 %point.051, -1
%idxprom27 = sext i32 %sub26 to i64
%arrayidx28 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %idxprom27
%6 = load i32, ptr %arrayidx28, align 4, !tbaa !8
%mul = mul nsw i32 %6, %5
store i32 %mul, ptr %arrayidx28, align 4, !tbaa !8
br label %if.end36
if.else30: ; preds = %while.body
%inc = add nsw i32 %point.051, 1
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%idxprom33 = sext i32 %inc to i64
%arrayidx34 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %idxprom33
store i32 %conv.i, ptr %arrayidx34, align 4, !tbaa !8
br label %if.end36
if.end36: ; preds = %if.then10, %if.else30, %if.then23, %if.then
%point.1 = phi i32 [ %sub, %if.then ], [ %sub13, %if.then10 ], [ %sub26, %if.then23 ], [ %inc, %if.else30 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end36
%arrayidx37.phi.trans.insert = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 1
%.pre = load i32, ptr %arrayidx37.phi.trans.insert, align 4, !tbaa !8
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
call void @llvm.lifetime.end.p0(i64 408, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int top = 0,S[1000];
void push(int x){
S[++top] = x;
}
int pop(void){
top--;
return S[top+1];
}
int main(void){
int a,b;
top = 0;
char s[100];
while(scanf("%s",s)!= EOF){
if(s[0] == '+'){
a = pop();
b = pop();
push(a+b);
} else if(s[0] == '-'){
b = pop();
a = pop();
push(a-b);
} else if(s[0] == '*'){
a = pop();
b = pop();
push(a*b);
} else {
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286795/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286795/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <stdlib.h>
int top, st[1000];
void push(int x)
{
top++;//加算して
st[top] = x;//その位置に積める
}
int pop(void)
{
top--;
return st[top+1];//さっきまでtopが指していたもの
}
int main(void)
{
int a,b;
top = 0;
char s[100];
while(scanf("%s", s) != EOF)
{
if(s[0] == '+'){
a = pop();
b = pop();
push(a + b);
}else if(s[0] == '-'){
a = pop();
b = pop();
push(b - a);
}else if(s[0] == '*'){
a = pop();
b = pop();
push(a * b);
}else{
push(atoi(s));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286838/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286838/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@st = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @st, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int s[1000],top;
int pop();
void push(int);
int main(){
int l,m;
char h[100];
top=0;
while(scanf("%s", h) !=EOF){
if(h[0] == '-')
{
m=pop();
l=pop();
push(l-m);
}
else if(h[0] == '+')
{
m=pop();
l=pop();
push(l+m);
}
else if(h[0] == '*')
{
l=pop();
m=pop();
push(l*m);
}
else push(atoi(h));
}
printf("%d\n",pop());
return 0;
}
int pop(){
top--;
return s[top+1];
}
void push(int d){
s[++top]=d;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286889/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286889/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@s = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %h) #5
store i32 0, ptr @top, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %h, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 45, label %if.then
i8 43, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%sub = sub nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%add = add nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %h, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %h) #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 norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %d) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom
store i32 %d, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <string.h>
int c2i(char);
int main(){
int i=0,top=0,x;
int stack[1000];
char s[1000];
scanf("%[^\n]",s);
while(s[i]!='\0'){
if(48<= (int)s[i] && (int)s[i] <=57){
if(48<= (int)s[i-1] && (int)s[i-1] <=57){
x=c2i(s[i]);
stack[top-1]=(stack[top-1]*10)+x;
}
else {
stack[top]=c2i(s[i]);
top++;
}
}
else if(s[i]=='+'){
stack[top-2]=stack[top-2]+stack[top-1];
top--;
}
else if(s[i]=='-'){
stack[top-2]=stack[top-2]-stack[top-1];
top--;
}
else if(s[i]=='*'){
stack[top-2]=stack[top-2]*stack[top-1];
top--;
}
i++;
}
printf("%d\n",stack[top-1]);
return 0;
}
int c2i(char c){
return c-'0';
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286931/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286931/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%[^\0A]\00", align 1
@.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:
%stack = alloca [1000 x i32], align 16
%s = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %stack) #4
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp.not130 = icmp eq i8 %0, 0
br i1 %cmp.not130, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end95
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end95 ], [ 0, %entry ]
%1 = phi i8 [ %13, %if.end95 ], [ %0, %entry ]
%top.0131 = phi i32 [ %top.1, %if.end95 ], [ 0, %entry ]
%2 = add i8 %1, -48
%or.cond = icmp ult i8 %2, 10
br i1 %or.cond, label %if.then, label %if.else39
if.then: ; preds = %while.body
%3 = add nsw i64 %indvars.iv, -1
%arrayidx13 = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %3
%4 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%5 = add i8 %4, -48
%or.cond127 = icmp ult i8 %5, 10
%conv.i = zext i8 %1 to i32
%sub.i = add nsw i32 %conv.i, -48
br i1 %or.cond127, label %if.then24, label %if.else
if.then24: ; preds = %if.then
%sub28 = add nsw i32 %top.0131, -1
%idxprom29 = sext i32 %sub28 to i64
%arrayidx30 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %idxprom29
%6 = load i32, ptr %arrayidx30, align 4, !tbaa !8
%mul = mul nsw i32 %6, 10
%add = add nsw i32 %sub.i, %mul
store i32 %add, ptr %arrayidx30, align 4, !tbaa !8
br label %if.end95
if.else: ; preds = %if.then
%idxprom37 = sext i32 %top.0131 to i64
%arrayidx38 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %idxprom37
store i32 %sub.i, ptr %arrayidx38, align 4, !tbaa !8
%inc = add nsw i32 %top.0131, 1
br label %if.end95
if.else39: ; preds = %while.body
switch i8 %1, label %if.end95 [
i8 43, label %if.then45
i8 45, label %if.then62
i8 42, label %if.then80
]
if.then45: ; preds = %if.else39
%sub46 = add nsw i32 %top.0131, -2
%idxprom47 = sext i32 %sub46 to i64
%arrayidx48 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %idxprom47
%7 = load i32, ptr %arrayidx48, align 4, !tbaa !8
%sub49 = add nsw i32 %top.0131, -1
%idxprom50 = sext i32 %sub49 to i64
%arrayidx51 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %idxprom50
%8 = load i32, ptr %arrayidx51, align 4, !tbaa !8
%add52 = add nsw i32 %8, %7
store i32 %add52, ptr %arrayidx48, align 4, !tbaa !8
br label %if.end95
if.then62: ; preds = %if.else39
%sub63 = add nsw i32 %top.0131, -2
%idxprom64 = sext i32 %sub63 to i64
%arrayidx65 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %idxprom64
%9 = load i32, ptr %arrayidx65, align 4, !tbaa !8
%sub66 = add nsw i32 %top.0131, -1
%idxprom67 = sext i32 %sub66 to i64
%arrayidx68 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %idxprom67
%10 = load i32, ptr %arrayidx68, align 4, !tbaa !8
%sub69 = sub nsw i32 %9, %10
store i32 %sub69, ptr %arrayidx65, align 4, !tbaa !8
br label %if.end95
if.then80: ; preds = %if.else39
%sub81 = add nsw i32 %top.0131, -2
%idxprom82 = sext i32 %sub81 to i64
%arrayidx83 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %idxprom82
%11 = load i32, ptr %arrayidx83, align 4, !tbaa !8
%sub84 = add nsw i32 %top.0131, -1
%idxprom85 = sext i32 %sub84 to i64
%arrayidx86 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %idxprom85
%12 = load i32, ptr %arrayidx86, align 4, !tbaa !8
%mul87 = mul nsw i32 %12, %11
store i32 %mul87, ptr %arrayidx83, align 4, !tbaa !8
br label %if.end95
if.end95: ; preds = %if.else39, %if.then45, %if.then80, %if.then62, %if.then24, %if.else
%top.1 = phi i32 [ %top.0131, %if.then24 ], [ %inc, %if.else ], [ %sub49, %if.then45 ], [ %sub66, %if.then62 ], [ %sub84, %if.then80 ], [ %top.0131, %if.else39 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%13 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %13, 0
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10
while.end.loopexit: ; preds = %if.end95
%14 = add nsw i32 %top.1, -1
%15 = sext i32 %14 to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%top.0.lcssa = phi i64 [ -1, %entry ], [ %15, %while.end.loopexit ]
%arrayidx99 = getelementptr inbounds [1000 x i32], ptr %stack, i64 0, i64 %top.0.lcssa
%16 = load i32, ptr %arrayidx99, align 4, !tbaa !8
%call100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %stack) #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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @c2i(i8 noundef signext %c) local_unnamed_addr #3 {
entry:
%conv = sext i8 %c to i32
%sub = add nsw i32 %conv, -48
ret i32 %sub
}
; 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 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#define N 10
#define MAX 101
int top;
int S[MAX];
void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);
int main(void){
char A[N];
int x=0,a,b;
int i;
while(scanf(" %s",A) != EOF){
if(A[0] == '+'){
b = pop();
a = pop();
x = a + b;
push(x);
}
else if(A[0] == '-'){
b = pop();
a = pop();
x = a - b;
push(x);
}
else if(A[0] == '*'){
b = pop();
a = pop();
x = a * b;
push(x);
}
else{
x = atoi(A);
push(x);
}
}
printf("%d\n",pop());
return 0;
}
void initialize(void){
top = 0;
}
int isEmpty(void){
return top == 0;
}
int isFull(void){
return top >= MAX - 1;
}
void push(int x){
if(isFull()){
fprintf(stderr,"stuck is full\n");
}
else{
top++;
S[top] = x;
}
}
int pop(void){
if(isEmpty()){
fprintf(stderr,"stuck is empty\n");
return 0;
}
else{
top--;
return S[top+1];
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_286975/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_286975/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\0A\00", align 1
@top = dso_local local_unnamed_addr global i32 0, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [15 x i8] c"stuck is full\0A\00", align 1
@S = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [16 x i8] c"stuck is empty\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %A) #7
%call112 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%cmp.not113 = icmp eq i32 %call112, -1
br i1 %cmp.not113, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %A, align 1, !tbaa !5
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i = icmp eq i32 %1, 0
br i1 %cmp.i.not.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %if.then
%2 = load ptr, ptr @stderr, align 8, !tbaa !10
%3 = call i64 @fwrite(ptr nonnull @.str.3, i64 15, i64 1, ptr %2) #8
%.pr = load i32, ptr @top, align 4, !tbaa !8
br label %pop.exit
if.else.i: ; preds = %if.then
%dec.i = add nsw i32 %1, -1
store i32 %dec.i, ptr @top, align 4, !tbaa !8
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
br label %pop.exit
pop.exit: ; preds = %if.then.i, %if.else.i
%5 = phi i32 [ %.pr, %if.then.i ], [ %dec.i, %if.else.i ]
%retval.0.i = phi i32 [ 0, %if.then.i ], [ %4, %if.else.i ]
%cmp.i.not.i34 = icmp eq i32 %5, 0
br i1 %cmp.i.not.i34, label %if.then.i40, label %if.else.i35
if.then.i40: ; preds = %pop.exit
%6 = load ptr, ptr @stderr, align 8, !tbaa !10
%7 = call i64 @fwrite(ptr nonnull @.str.3, i64 15, i64 1, ptr %6) #8
%.pr107 = load i32, ptr @top, align 4, !tbaa !8
br label %pop.exit41
if.else.i35: ; preds = %pop.exit
%dec.i36 = add nsw i32 %5, -1
store i32 %dec.i36, ptr @top, align 4, !tbaa !8
%idxprom.i37 = sext i32 %5 to i64
%arrayidx.i38 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i37
%8 = load i32, ptr %arrayidx.i38, align 4, !tbaa !8
br label %pop.exit41
pop.exit41: ; preds = %if.then.i40, %if.else.i35
%9 = phi i32 [ %.pr107, %if.then.i40 ], [ %dec.i36, %if.else.i35 ]
%retval.0.i39 = phi i32 [ 0, %if.then.i40 ], [ %8, %if.else.i35 ]
%cmp.i.i = icmp slt i32 %9, 100
br i1 %cmp.i.i, label %if.else.i43, label %if.then.i42
if.then.i42: ; preds = %pop.exit41
%10 = load ptr, ptr @stderr, align 8, !tbaa !10
%11 = call i64 @fwrite(ptr nonnull @.str.2, i64 14, i64 1, ptr %10) #8
br label %if.end24
if.else.i43: ; preds = %pop.exit41
%add = add nsw i32 %retval.0.i39, %retval.0.i
%inc.i = add nsw i32 %9, 1
store i32 %inc.i, ptr @top, align 4, !tbaa !8
%idxprom.i44 = sext i32 %inc.i to i64
%arrayidx.i45 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i44
store i32 %add, ptr %arrayidx.i45, align 4, !tbaa !8
br label %if.end24
if.then9: ; preds = %while.body
%12 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i46 = icmp eq i32 %12, 0
br i1 %cmp.i.not.i46, label %if.then.i52, label %if.else.i47
if.then.i52: ; preds = %if.then9
%13 = load ptr, ptr @stderr, align 8, !tbaa !10
%14 = call i64 @fwrite(ptr nonnull @.str.3, i64 15, i64 1, ptr %13) #8
%.pr108 = load i32, ptr @top, align 4, !tbaa !8
br label %pop.exit53
if.else.i47: ; preds = %if.then9
%dec.i48 = add nsw i32 %12, -1
store i32 %dec.i48, ptr @top, align 4, !tbaa !8
%idxprom.i49 = sext i32 %12 to i64
%arrayidx.i50 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i49
%15 = load i32, ptr %arrayidx.i50, align 4, !tbaa !8
br label %pop.exit53
pop.exit53: ; preds = %if.then.i52, %if.else.i47
%16 = phi i32 [ %.pr108, %if.then.i52 ], [ %dec.i48, %if.else.i47 ]
%retval.0.i51 = phi i32 [ 0, %if.then.i52 ], [ %15, %if.else.i47 ]
%cmp.i.not.i54 = icmp eq i32 %16, 0
br i1 %cmp.i.not.i54, label %if.then.i60, label %if.else.i55
if.then.i60: ; preds = %pop.exit53
%17 = load ptr, ptr @stderr, align 8, !tbaa !10
%18 = call i64 @fwrite(ptr nonnull @.str.3, i64 15, i64 1, ptr %17) #8
%.pr109 = load i32, ptr @top, align 4, !tbaa !8
br label %pop.exit61
if.else.i55: ; preds = %pop.exit53
%dec.i56 = add nsw i32 %16, -1
store i32 %dec.i56, ptr @top, align 4, !tbaa !8
%idxprom.i57 = sext i32 %16 to i64
%arrayidx.i58 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i57
%19 = load i32, ptr %arrayidx.i58, align 4, !tbaa !8
br label %pop.exit61
pop.exit61: ; preds = %if.then.i60, %if.else.i55
%20 = phi i32 [ %.pr109, %if.then.i60 ], [ %dec.i56, %if.else.i55 ]
%retval.0.i59 = phi i32 [ 0, %if.then.i60 ], [ %19, %if.else.i55 ]
%cmp.i.i62 = icmp slt i32 %20, 100
br i1 %cmp.i.i62, label %if.else.i64, label %if.then.i63
if.then.i63: ; preds = %pop.exit61
%21 = load ptr, ptr @stderr, align 8, !tbaa !10
%22 = call i64 @fwrite(ptr nonnull @.str.2, i64 14, i64 1, ptr %21) #8
br label %if.end24
if.else.i64: ; preds = %pop.exit61
%sub = sub nsw i32 %retval.0.i59, %retval.0.i51
%inc.i65 = add nsw i32 %20, 1
store i32 %inc.i65, ptr @top, align 4, !tbaa !8
%idxprom.i66 = sext i32 %inc.i65 to i64
%arrayidx.i67 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i66
store i32 %sub, ptr %arrayidx.i67, align 4, !tbaa !8
br label %if.end24
if.then17: ; preds = %while.body
%23 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i69 = icmp eq i32 %23, 0
br i1 %cmp.i.not.i69, label %if.then.i75, label %if.else.i70
if.then.i75: ; preds = %if.then17
%24 = load ptr, ptr @stderr, align 8, !tbaa !10
%25 = call i64 @fwrite(ptr nonnull @.str.3, i64 15, i64 1, ptr %24) #8
%.pr110 = load i32, ptr @top, align 4, !tbaa !8
br label %pop.exit76
if.else.i70: ; preds = %if.then17
%dec.i71 = add nsw i32 %23, -1
store i32 %dec.i71, ptr @top, align 4, !tbaa !8
%idxprom.i72 = sext i32 %23 to i64
%arrayidx.i73 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i72
%26 = load i32, ptr %arrayidx.i73, align 4, !tbaa !8
br label %pop.exit76
pop.exit76: ; preds = %if.then.i75, %if.else.i70
%27 = phi i32 [ %.pr110, %if.then.i75 ], [ %dec.i71, %if.else.i70 ]
%retval.0.i74 = phi i32 [ 0, %if.then.i75 ], [ %26, %if.else.i70 ]
%cmp.i.not.i77 = icmp eq i32 %27, 0
br i1 %cmp.i.not.i77, label %if.then.i83, label %if.else.i78
if.then.i83: ; preds = %pop.exit76
%28 = load ptr, ptr @stderr, align 8, !tbaa !10
%29 = call i64 @fwrite(ptr nonnull @.str.3, i64 15, i64 1, ptr %28) #8
%.pr111 = load i32, ptr @top, align 4, !tbaa !8
br label %pop.exit84
if.else.i78: ; preds = %pop.exit76
%dec.i79 = add nsw i32 %27, -1
store i32 %dec.i79, ptr @top, align 4, !tbaa !8
%idxprom.i80 = sext i32 %27 to i64
%arrayidx.i81 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i80
%30 = load i32, ptr %arrayidx.i81, align 4, !tbaa !8
br label %pop.exit84
pop.exit84: ; preds = %if.then.i83, %if.else.i78
%31 = phi i32 [ %.pr111, %if.then.i83 ], [ %dec.i79, %if.else.i78 ]
%retval.0.i82 = phi i32 [ 0, %if.then.i83 ], [ %30, %if.else.i78 ]
%cmp.i.i85 = icmp slt i32 %31, 100
br i1 %cmp.i.i85, label %if.else.i87, label %if.then.i86
if.then.i86: ; preds = %pop.exit84
%32 = load ptr, ptr @stderr, align 8, !tbaa !10
%33 = call i64 @fwrite(ptr nonnull @.str.2, i64 14, i64 1, ptr %32) #8
br label %if.end24
if.else.i87: ; preds = %pop.exit84
%mul = mul nsw i32 %retval.0.i82, %retval.0.i74
%inc.i88 = add nsw i32 %31, 1
store i32 %inc.i88, ptr @top, align 4, !tbaa !8
%idxprom.i89 = sext i32 %inc.i88 to i64
%arrayidx.i90 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i89
store i32 %mul, ptr %arrayidx.i90, align 4, !tbaa !8
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %A, ptr noundef null, i32 noundef 10) #7
%34 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.i92 = icmp slt i32 %34, 100
br i1 %cmp.i.i92, label %if.else.i94, label %if.then.i93
if.then.i93: ; preds = %if.else20
%35 = load ptr, ptr @stderr, align 8, !tbaa !10
%36 = call i64 @fwrite(ptr nonnull @.str.2, i64 14, i64 1, ptr %35) #8
br label %if.end24
if.else.i94: ; preds = %if.else20
%conv.i = trunc i64 %call.i to i32
%inc.i95 = add nsw i32 %34, 1
store i32 %inc.i95, ptr @top, align 4, !tbaa !8
%idxprom.i96 = sext i32 %inc.i95 to i64
%arrayidx.i97 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i96
store i32 %conv.i, ptr %arrayidx.i97, align 4, !tbaa !8
br label %if.end24
if.end24: ; preds = %if.else.i94, %if.then.i93, %if.else.i87, %if.then.i86, %if.else.i64, %if.then.i63, %if.else.i43, %if.then.i42
%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 %while.body, !llvm.loop !12
while.end: ; preds = %if.end24, %entry
%37 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not.i99 = icmp eq i32 %37, 0
br i1 %cmp.i.not.i99, label %if.then.i105, label %if.else.i100
if.then.i105: ; preds = %while.end
%38 = load ptr, ptr @stderr, align 8, !tbaa !10
%39 = call i64 @fwrite(ptr nonnull @.str.3, i64 15, i64 1, ptr %38) #8
br label %pop.exit106
if.else.i100: ; preds = %while.end
%dec.i101 = add nsw i32 %37, -1
store i32 %dec.i101, ptr @top, align 4, !tbaa !8
%idxprom.i102 = sext i32 %37 to i64
%arrayidx.i103 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i102
%40 = load i32, ptr %arrayidx.i103, align 4, !tbaa !8
br label %pop.exit106
pop.exit106: ; preds = %if.then.i105, %if.else.i100
%retval.0.i104 = phi i32 [ 0, %if.then.i105 ], [ %40, %if.else.i100 ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %retval.0.i104)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %A) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i.not = icmp eq i32 %0, 0
br i1 %cmp.i.not, label %if.then, label %if.else
if.then: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !10
%2 = tail call i64 @fwrite(ptr nonnull @.str.3, i64 15, i64 1, ptr %1) #8
br label %return
if.else: ; preds = %entry
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !8
br label %return
return: ; preds = %if.else, %if.then
%retval.0 = phi i32 [ 0, %if.then ], [ %3, %if.else ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp.i = icmp slt i32 %0, 100
br i1 %cmp.i, label %if.else, label %if.then
if.then: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !10
%2 = tail call i64 @fwrite(ptr nonnull @.str.2, i64 14, i64 1, ptr %1) #8
br label %if.end
if.else: ; preds = %entry
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !8
br label %if.end
if.end: ; preds = %if.else, %if.then
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: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #3 {
entry:
store i32 0, ptr @top, align 4, !tbaa !8
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isEmpty() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp = icmp eq i32 %0, 0
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isFull() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%cmp = icmp sgt i32 %0, 99
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { cold }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#define N 1000
#define True 1
#define False 0
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);
int top = 0;
int A[1000];
int main(){
int a = 0, b = 0, x = 0;
char s[100];
while((scanf("%s",s)) != EOF){
if(s[0] == '+'){
a = pop();
b = pop();
push(a + b);
}
else if(s[0] == '-'){
a = pop();
b = pop();
push(b - a);
}
else if(s[0] == '*'){
a = pop();
b = pop();
push(a * b);
}
else {
x = atoi(s);
push(x);
}
}
printf("%d\n",pop());
return 0;
}
/*
int isEmpty(void){
if(top == 0)return True;
else return False;
}
int isFull(void){
if(top >= N-1)return True;
else return False;
}
*/
void push(int x){
/*
if((isFull()) == True){
printf("Overflow!");
}
else {*/
top++;
A[top] = x;
// }
}
int pop(void){
/*
if((isEmpty()) == True){
printf("Underflow!");
}
else {*/
top--;
return A[top + 1];
//}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287017/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287017/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@A = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !5
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !8
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !8
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !8
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !8
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !8
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !8
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !8
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !8
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !8
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !8
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !8
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !8
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !8
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !8
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !8
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !8
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !8
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !8
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !8
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !8
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !8
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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 1000
#define n 100
int top, A[N];
void push(int x);
int pop();
int main(){
int a, b, x;
top = 0;
char A2[n];
while( scanf("%s", A2) != EOF ){
if ( A2[0] == '+' ){
a = pop();
b = pop();
push(a + b);
} else if ( A2[0] == '-' ){
b = pop();
a = pop();
push(a - b);
} else if ( A2[0] == '*' ){
a = pop();
b = pop();
push(a * b);
} else {
x = atoi(A2);
push(x);
}
}
printf("%d\n", pop());
return 0;
}
void push(int x){
A[++top] = x;
}
int pop(){
top--;
return A[top+1];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287060/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287060/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@A = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A2 = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %A2) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A2)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %A2, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %A2, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A2)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %A2) #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 norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#define N 10000
int s[N];
int p;
void rr(int x) {
s[p]=x;
p++;
}
int pp() {
p--;
return s[p];
}
int main() {
p=0;
char c[10];
while(scanf("%s",c)==1)
{
if(c[0]=='*'||c[0]=='-'||c[0]=='+')
{
int x=pp();
int y=pp();
if(c[0]=='*') rr(x*y);
else if(c[0]=='-') rr(y-x);
else if(c[0]=='+')rr(x+y);
}
else {
int x=0,k=0;
while(c[k]>='0' && c[k]<='9')
{
x*=10;
x+=c[k]-'0';
k++;
}
rr(x);
}
}
printf("%d\n",pp());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287103/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287103/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@s = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@p = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @rr(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @p, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @s, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @p, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pp() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @p, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @p, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%c = alloca [10 x i8], align 1
store i32 0, ptr @p, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %c) #4
%call85 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp86 = icmp eq i32 %call85, 1
br i1 %cmp86, label %while.body, label %while.end52
while.body: ; preds = %entry, %if.end51
%0 = load i8, ptr %c, align 1
switch i8 %0, label %while.cond34.preheader [
i8 45, label %if.then
i8 43, label %if.then
i8 42, label %if.then
]
while.cond34.preheader: ; preds = %while.body
%1 = add i8 %0, -48
%or.cond82 = icmp ult i8 %1, 10
br i1 %or.cond82, label %while.body44, label %while.end
if.then: ; preds = %while.body, %while.body, %while.body
%2 = load i32, ptr @p, align 4, !tbaa !5
%dec.i = add nsw i32 %2, -1
%idxprom.i = sext i32 %dec.i to i64
%arrayidx.i = getelementptr inbounds [10000 x i32], ptr @s, i64 0, i64 %idxprom.i
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%dec.i65 = add nsw i32 %2, -2
store i32 %dec.i65, ptr @p, align 4, !tbaa !5
%idxprom.i66 = sext i32 %dec.i65 to i64
%arrayidx.i67 = getelementptr inbounds [10000 x i32], ptr @s, i64 0, i64 %idxprom.i66
%4 = load i32, ptr %arrayidx.i67, align 4, !tbaa !5
switch i8 %0, label %if.end51 [
i8 42, label %if.then18
i8 45, label %if.then23
i8 43, label %if.then29
]
if.then18: ; preds = %if.then
%mul = mul nsw i32 %4, %3
store i32 %mul, ptr %arrayidx.i67, align 4, !tbaa !5
br label %if.end51.sink.split
if.then23: ; preds = %if.then
%sub = sub nsw i32 %4, %3
store i32 %sub, ptr %arrayidx.i67, align 4, !tbaa !5
br label %if.end51.sink.split
if.then29: ; preds = %if.then
%add = add nsw i32 %4, %3
store i32 %add, ptr %arrayidx.i67, align 4, !tbaa !5
br label %if.end51.sink.split
while.body44: ; preds = %while.cond34.preheader, %while.body44
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body44 ], [ 0, %while.cond34.preheader ]
%5 = phi i8 [ %6, %while.body44 ], [ %0, %while.cond34.preheader ]
%x33.083 = phi i32 [ %add50, %while.body44 ], [ 0, %while.cond34.preheader ]
%conv36 = zext i8 %5 to i32
%mul45 = mul nsw i32 %x33.083, 10
%sub49 = add i32 %mul45, -48
%add50 = add i32 %sub49, %conv36
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx35 = getelementptr inbounds [10 x i8], ptr %c, i64 0, i64 %indvars.iv.next
%6 = load i8, ptr %arrayidx35, align 1, !tbaa !9
%7 = add i8 %6, -48
%or.cond = icmp ult i8 %7, 10
br i1 %or.cond, label %while.body44, label %while.end, !llvm.loop !10
while.end: ; preds = %while.body44, %while.cond34.preheader
%x33.0.lcssa = phi i32 [ 0, %while.cond34.preheader ], [ %add50, %while.body44 ]
%8 = load i32, ptr @p, align 4, !tbaa !5
%idxprom.i76 = sext i32 %8 to i64
%arrayidx.i77 = getelementptr inbounds [10000 x i32], ptr @s, i64 0, i64 %idxprom.i76
store i32 %x33.0.lcssa, ptr %arrayidx.i77, align 4, !tbaa !5
%inc.i78 = add nsw i32 %8, 1
br label %if.end51.sink.split
if.end51.sink.split: ; preds = %while.end, %if.then23, %if.then29, %if.then18
%dec.i.sink = phi i32 [ %dec.i, %if.then18 ], [ %dec.i, %if.then29 ], [ %dec.i, %if.then23 ], [ %inc.i78, %while.end ]
store i32 %dec.i.sink, ptr @p, align 4, !tbaa !5
br label %if.end51
if.end51: ; preds = %if.end51.sink.split, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp = icmp eq i32 %call, 1
br i1 %cmp, label %while.body, label %while.end52, !llvm.loop !12
while.end52: ; preds = %if.end51, %entry
%9 = load i32, ptr @p, align 4, !tbaa !5
%dec.i79 = add nsw i32 %9, -1
store i32 %dec.i79, ptr @p, align 4, !tbaa !5
%idxprom.i80 = sext i32 %dec.i79 to i64
%arrayidx.i81 = getelementptr inbounds [10000 x i32], ptr @s, i64 0, i64 %idxprom.i80
%10 = load i32, ptr %arrayidx.i81, align 4, !tbaa !5
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %c) #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
#include <string.h>
int s2i(char a[7]){
int i,k=0;
for(i=0;a[i]!='\0';i++){
k = k*10+(a[i]-'0');
}
return k;
}
int main(void){
int a[128],b,c;
int top=2,n;
char str[7];
scanf("%d",&a[0]);
scanf("%d",&a[1]);
while(scanf("%s",str)!=EOF){
if(strcmp(str,"+")==0){
b = a[top-1];
c = a[top-2];
a[top-2] = b+c;
top--;
}else if(strcmp(str,"-")==0){
b = a[top-2];
c = a[top-1];
a[top-2] = b-c;
top--;
}else if(strcmp(str,"*")==0){
b = a[top-1];
c = a[top-2];
a[top-2] = b*c;
top--;
}else{
a[top] = s2i(str);
top++;
}
}
printf("%d\n",a[0]);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287147/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287147/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [2 x i8] c"+\00", align 1
@.str.3 = private unnamed_addr constant [2 x i8] c"-\00", align 1
@.str.4 = private unnamed_addr constant [2 x i8] c"*\00", align 1
@.str.5 = 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 @s2i(ptr nocapture noundef readonly %a) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !5
%cmp.not9 = icmp eq i8 %0, 0
br i1 %cmp.not9, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = phi i8 [ %2, %for.body ], [ %0, %entry ]
%k.011 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%conv = sext i8 %1 to i32
%mul = mul nsw i32 %k.011, 10
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %2, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %entry
%k.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
ret i32 %k.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca [128 x i32], align 16
%str = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %str) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%arrayidx1 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 1
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1)
%call372 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str)
%cmp.not73 = icmp eq i32 %call372, -1
br i1 %cmp.not73, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end50
%top.074 = phi i32 [ %top.1, %if.end50 ], [ 2, %entry ]
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(2) %str, ptr noundef nonnull dereferenceable(2) @.str.2, i64 2)
%cmp6 = icmp eq i32 %bcmp, 0
br i1 %cmp6, label %if.then, label %if.else
if.then: ; preds = %while.body
%sub = add nsw i32 %top.074, -1
%idxprom = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx7, align 4, !tbaa !10
%sub8 = add nsw i32 %top.074, -2
%idxprom9 = sext i32 %sub8 to i64
%arrayidx10 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %idxprom9
%1 = load i32, ptr %arrayidx10, align 4, !tbaa !10
%add = add nsw i32 %1, %0
store i32 %add, ptr %arrayidx10, align 4, !tbaa !10
br label %if.end50
if.else: ; preds = %while.body
%bcmp70 = call i32 @bcmp(ptr noundef nonnull dereferenceable(2) %str, ptr noundef nonnull dereferenceable(2) @.str.3, i64 2)
%cmp16 = icmp eq i32 %bcmp70, 0
br i1 %cmp16, label %if.then17, label %if.else29
if.then17: ; preds = %if.else
%sub18 = add nsw i32 %top.074, -2
%idxprom19 = sext i32 %sub18 to i64
%arrayidx20 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %idxprom19
%2 = load i32, ptr %arrayidx20, align 4, !tbaa !10
%sub21 = add nsw i32 %top.074, -1
%idxprom22 = sext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %idxprom22
%3 = load i32, ptr %arrayidx23, align 4, !tbaa !10
%sub24 = sub nsw i32 %2, %3
store i32 %sub24, ptr %arrayidx20, align 4, !tbaa !10
br label %if.end50
if.else29: ; preds = %if.else
%bcmp71 = call i32 @bcmp(ptr noundef nonnull dereferenceable(2) %str, ptr noundef nonnull dereferenceable(2) @.str.4, i64 2)
%cmp32 = icmp eq i32 %bcmp71, 0
br i1 %cmp32, label %if.then33, label %if.else44
if.then33: ; preds = %if.else29
%sub34 = add nsw i32 %top.074, -1
%idxprom35 = sext i32 %sub34 to i64
%arrayidx36 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %idxprom35
%4 = load i32, ptr %arrayidx36, align 4, !tbaa !10
%sub37 = add nsw i32 %top.074, -2
%idxprom38 = sext i32 %sub37 to i64
%arrayidx39 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %idxprom38
%5 = load i32, ptr %arrayidx39, align 4, !tbaa !10
%mul = mul nsw i32 %5, %4
store i32 %mul, ptr %arrayidx39, align 4, !tbaa !10
br label %if.end50
if.else44: ; preds = %if.else29
%6 = load i8, ptr %str, align 1, !tbaa !5
%cmp.not9.i = icmp eq i8 %6, 0
br i1 %cmp.not9.i, label %s2i.exit, label %for.body.i
for.body.i: ; preds = %if.else44, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 0, %if.else44 ]
%7 = phi i8 [ %8, %for.body.i ], [ %6, %if.else44 ]
%k.011.i = phi i32 [ %add.i, %for.body.i ], [ 0, %if.else44 ]
%conv.i = sext i8 %7 to i32
%mul.i = mul nsw i32 %k.011.i, 10
%sub.i = add nsw i32 %conv.i, -48
%add.i = add i32 %sub.i, %mul.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.i
%8 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%cmp.not.i = icmp eq i8 %8, 0
br i1 %cmp.not.i, label %s2i.exit, label %for.body.i, !llvm.loop !8
s2i.exit: ; preds = %for.body.i, %if.else44
%k.0.lcssa.i = phi i32 [ 0, %if.else44 ], [ %add.i, %for.body.i ]
%idxprom47 = sext i32 %top.074 to i64
%arrayidx48 = getelementptr inbounds [128 x i32], ptr %a, i64 0, i64 %idxprom47
store i32 %k.0.lcssa.i, ptr %arrayidx48, align 4, !tbaa !10
%inc = add nsw i32 %top.074, 1
br label %if.end50
if.end50: ; preds = %if.then17, %s2i.exit, %if.then33, %if.then
%top.1 = phi i32 [ %sub, %if.then ], [ %sub21, %if.then17 ], [ %sub34, %if.then33 ], [ %inc, %s2i.exit ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str)
%cmp.not = icmp eq i32 %call3, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end50, %entry
%9 = load i32, ptr %a, align 16, !tbaa !10
%call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %str) #5
call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %a) #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 willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x) {
/* top を加算してから
その位置へ挿入 */
S[++top] = x;
}
int pop() {
top--;
/* top が指していた要素を返す */
return S[top+1];
}
int main() {
int a, b;
top = 0;
char s[100];
while( scanf("%s", s) != EOF ) {
if ( s[0] == '+' ) {
a = pop();
b = pop();
push(a + b);
} else if ( s[0] == '-' ) {
b = pop();
a = pop();
push(a - b);
} else if ( s[0] == '*' ) {
a = pop();
b = pop();
push(a * b);
} else {
push(atoi(s));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287190/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287190/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
//数式の最大の長さ
#define MAXLENGTH 400
//オペランドの最大個数
#define MAXOP 100
void push(int stack[MAXOP], int *sp, int op);
int pop(int stack[MAXOP], int *sp);
int main(void)
{
//spはスタックのポインタ、opは数式に含まれるオペランドを格納
int i, sp, op;
//calc_value1とcalc_value2は計算用のオペランドを格納
int calc_value1, calc_value2;
int stack[MAXOP];
char formual[MAXLENGTH];
//数式を入力
scanf("%[^\n]", formual);
//初期値は0
sp = 0;
i = 0;
//数式の最後まで繰り返す
while(formual[i] != '\0'){
//数字ならば数値に変換し、プッシュする
if(formual[i] >= '0' && formual[i] <= '9'){
//数値に変換
op = formual[i] - 48;
i++;
//数字が2桁以上の場合の動作
while(formual[i] != ' '){
op *= 10;
op += formual[i] - 48;
i++;
}
push(stack, &sp, op);
}
//演算子ならばポップし、計算する
else if(formual[i] == '+'){
calc_value1 = pop(stack, &sp);
calc_value2 = pop(stack, &sp);
op = calc_value1 + calc_value2;
//計算結果をプッシュ
push(stack, &sp, op);
}
else if(formual[i] == '-'){
calc_value1 = pop(stack, &sp);
calc_value2 = pop(stack, &sp);
op = calc_value2 - calc_value1;
//計算結果をプッシュ
push(stack, &sp, op);
}
else if(formual[i] == '*'){
calc_value1 = pop(stack, &sp);
calc_value2 = pop(stack, &sp);
op = calc_value1 * calc_value2;
//計算結果をプッシュ
push(stack, &sp, op);
}
//インデックスを増加
i++;
}
//結果をポップし出力
op = pop(stack, &sp);
printf("%d\n", op);
return 0;
}
void push(int stack[100], int *sp, int op)
{
stack[*sp] = op;
*sp += 1;
}
int pop(int stack[100], int *sp)
{
int op;
*sp -= 1;
op = stack[*sp];
return op;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287233/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287233/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%[^\0A]\00", align 1
@.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:
%stack = alloca [100 x i32], align 16
%formual = alloca [400 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %stack) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %formual) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %formual)
%0 = load i8, ptr %formual, align 16, !tbaa !5
%cmp.not146 = icmp eq i8 %0, 0
br i1 %cmp.not146, label %while.end70, label %while.body
while.body: ; preds = %entry, %if.end68
%1 = phi i8 [ %13, %if.end68 ], [ %0, %entry ]
%i.0148 = phi i32 [ %inc69, %if.end68 ], [ 0, %entry ]
%sp.0147 = phi i32 [ %sp.1, %if.end68 ], [ 0, %entry ]
%2 = add i8 %1, -48
%or.cond = icmp ult i8 %2, 10
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.body
%conv149 = zext i8 %1 to i32
%sub = add nsw i32 %conv149, -48
%i.1138 = add nsw i32 %i.0148, 1
%idxprom16139 = sext i32 %i.1138 to i64
%arrayidx17140 = getelementptr inbounds [400 x i8], ptr %formual, i64 0, i64 %idxprom16139
%3 = load i8, ptr %arrayidx17140, align 1, !tbaa !5
%cmp19.not141 = icmp eq i8 %3, 32
br i1 %cmp19.not141, label %while.end, label %while.body21
while.body21: ; preds = %if.then, %while.body21
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body21 ], [ %idxprom16139, %if.then ]
%4 = phi i8 [ %5, %while.body21 ], [ %3, %if.then ]
%op.0142 = phi i32 [ %add, %while.body21 ], [ %sub, %if.then ]
%conv18 = sext i8 %4 to i32
%mul = mul nsw i32 %op.0142, 10
%sub25 = add i32 %mul, -48
%add = add i32 %sub25, %conv18
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx17 = getelementptr inbounds [400 x i8], ptr %formual, i64 0, i64 %indvars.iv.next
%5 = load i8, ptr %arrayidx17, align 1, !tbaa !5
%cmp19.not = icmp eq i8 %5, 32
br i1 %cmp19.not, label %while.end.loopexit, label %while.body21, !llvm.loop !8
while.end.loopexit: ; preds = %while.body21
%6 = trunc i64 %indvars.iv.next to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %if.then
%op.0.lcssa = phi i32 [ %sub, %if.then ], [ %add, %while.end.loopexit ]
%i.1.lcssa = phi i32 [ %i.1138, %if.then ], [ %6, %while.end.loopexit ]
%idxprom.i = sext i32 %sp.0147 to i64
%arrayidx.i = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i
store i32 %op.0.lcssa, ptr %arrayidx.i, align 4, !tbaa !10
%add.i = add nsw i32 %sp.0147, 1
br label %if.end68
if.else: ; preds = %while.body
switch i8 %1, label %if.end68 [
i8 43, label %if.then33
i8 45, label %if.then46
i8 42, label %if.then59
]
if.then33: ; preds = %if.else
%sub.i = add nsw i32 %sp.0147, -1
%idxprom.i95 = sext i32 %sub.i to i64
%arrayidx.i96 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i95
%7 = load i32, ptr %arrayidx.i96, align 4, !tbaa !10
%sub.i97 = add nsw i32 %sp.0147, -2
%idxprom.i98 = sext i32 %sub.i97 to i64
%arrayidx.i99 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i98
%8 = load i32, ptr %arrayidx.i99, align 4, !tbaa !10
%add38 = add nsw i32 %8, %7
store i32 %add38, ptr %arrayidx.i99, align 4, !tbaa !10
br label %if.end68
if.then46: ; preds = %if.else
%sub.i103 = add nsw i32 %sp.0147, -1
%idxprom.i104 = sext i32 %sub.i103 to i64
%arrayidx.i105 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i104
%9 = load i32, ptr %arrayidx.i105, align 4, !tbaa !10
%sub.i106 = add nsw i32 %sp.0147, -2
%idxprom.i107 = sext i32 %sub.i106 to i64
%arrayidx.i108 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i107
%10 = load i32, ptr %arrayidx.i108, align 4, !tbaa !10
%sub51 = sub nsw i32 %10, %9
store i32 %sub51, ptr %arrayidx.i108, align 4, !tbaa !10
br label %if.end68
if.then59: ; preds = %if.else
%sub.i112 = add nsw i32 %sp.0147, -1
%idxprom.i113 = sext i32 %sub.i112 to i64
%arrayidx.i114 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i113
%11 = load i32, ptr %arrayidx.i114, align 4, !tbaa !10
%sub.i115 = add nsw i32 %sp.0147, -2
%idxprom.i116 = sext i32 %sub.i115 to i64
%arrayidx.i117 = getelementptr inbounds i32, ptr %stack, i64 %idxprom.i116
%12 = load i32, ptr %arrayidx.i117, align 4, !tbaa !10
%mul64 = mul nsw i32 %12, %11
store i32 %mul64, ptr %arrayidx.i117, align 4, !tbaa !10
br label %if.end68
if.end68: ; preds = %if.else, %if.then33, %if.then59, %if.then46, %while.end
%sp.1 = phi i32 [ %add.i, %while.end ], [ %sp.0147, %if.else ], [ %sub.i112, %if.then59 ], [ %sub.i103, %if.then46 ], [ %sub.i, %if.then33 ]
%i.2 = phi i32 [ %i.1.lcssa, %while.end ], [ %i.0148, %if.else ], [ %i.0148, %if.then59 ], [ %i.0148, %if.then46 ], [ %i.0148, %if.then33 ]
%inc69 = add nsw i32 %i.2, 1
%idxprom = sext i32 %inc69 to i64
%arrayidx = getelementptr inbounds [400 x i8], ptr %formual, i64 0, i64 %idxprom
%13 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %13, 0
br i1 %cmp.not, label %while.end70.loopexit, label %while.body, !llvm.loop !12
while.end70.loopexit: ; preds = %if.end68
%14 = add nsw i32 %sp.1, -1
%15 = sext i32 %14 to i64
br label %while.end70
while.end70: ; preds = %while.end70.loopexit, %entry
%sp.0.lcssa = phi i64 [ -1, %entry ], [ %15, %while.end70.loopexit ]
%arrayidx.i123 = getelementptr inbounds i32, ptr %stack, i64 %sp.0.lcssa
%16 = load i32, ptr %arrayidx.i123, align 4, !tbaa !10
%call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %formual) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %stack) #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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @push(ptr nocapture noundef writeonly %stack, ptr nocapture noundef %sp, i32 noundef %op) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %sp, align 4, !tbaa !10
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds i32, ptr %stack, i64 %idxprom
store i32 %op, ptr %arrayidx, align 4, !tbaa !10
%1 = load i32, ptr %sp, align 4, !tbaa !10
%add = add nsw i32 %1, 1
store i32 %add, ptr %sp, align 4, !tbaa !10
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @pop(ptr nocapture noundef readonly %stack, ptr nocapture noundef %sp) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %sp, align 4, !tbaa !10
%sub = add nsw i32 %0, -1
store i32 %sub, ptr %sp, align 4, !tbaa !10
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds i32, ptr %stack, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !10
ret i32 %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top,S[1000];
void push(int x){
top++;
S[top] = x;
// printf("%d",x);
}
int pop(){
top--;
return S[top+1];
}
int main(){
int a,b;
top=0;
char s[100];
while( scanf("%s",s) != EOF ){
if ( s[0] == '+' ){
a =pop();
b =pop();
push(a + b);
} else if ( s[0] == '-' ){
b=pop();
a=pop();
push(a - b);
} else if ( s[0] == '*' ){
a=pop();
b=pop();
push(a * b);
} else {
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287277/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287277/source.c"
target datalayout = "e-m:e-p270: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 0, align 4
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void push(int);
int pop();
int top;
int dat[10000];
int main() {
int x,y;
char data[100];
while(scanf("%s",data) != EOF) {
if(data[0] == '+') {
x = pop();
y = pop();
push(x + y);
}else if(data[0] == '-') {
y = pop();
x = pop();
push(x - y);
}else if(data[0] == '*') {
x = pop();
y = pop();
push(x * y);
}else{
push(atoi(data));
}
}
printf("%d\n",pop());
return 0;
}
void push(int x) {
dat[++top] = x;
}
int pop() {
top--;
return dat[top + 1];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287327/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287327/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@dat = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%data = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %data) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %data, align 16, !tbaa !5
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !8
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !8
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !8
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !8
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !8
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !8
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !8
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !8
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !8
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !8
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !8
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !8
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !8
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !8
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %data, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !8
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !8
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !8
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !8
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !8
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !8
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %data) #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 norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !8
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: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !8
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !8
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @dat, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !8
ret i32 %1
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1000
void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);
int stack[MAX];
int top;
int main(){
int a,b;
char box[100];
initialize();
while(scanf("%s",box) != EOF){
if(box[0] == '+'){
a = pop();
b = pop();
push(a + b);
}
else if(box[0] == '-'){
a = pop();
b = pop();
push(b - a);
}
else if(box[0] == '*'){
a = pop();
b = pop();
push(a * b);
}
else if(box[0] >= '0' && box[0] <= '9'){
push(atoi(box));
}
else continue;
}
printf("%d\n",pop());
return 0;
}
void initialize(){
top = 0;
}
int isEmpty(void){
if(top == 0) return 0;
else return 1;
}
int isFull(void){
if(top >= MAX - 1) return 0;
else return 1;
}
void push(int x){
if(isFull() == 0){
printf("エラー (オーバーフロー)\n");
exit(2);
}
top++;
stack[top] = x;
}
int pop(void){
if(isEmpty() == 0){
printf("エラー (アンダーフロー)\n");
exit(1);
}
top--;
return stack[top + 1];
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287370/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287370/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@top = dso_local local_unnamed_addr global i32 0, align 4
@stack = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@str = private unnamed_addr constant [36 x i8] c"\E3\82\A8\E3\83\A9\E3\83\BC\E3\80\80(\E3\82\A2\E3\83\B3\E3\83\80\E3\83\BC\E3\83\95\E3\83\AD\E3\83\BC)\00", align 1
@str.4 = private unnamed_addr constant [36 x i8] c"\E3\82\A8\E3\83\A9\E3\83\BC\E3\80\80(\E3\82\AA\E3\83\BC\E3\83\90\E3\83\BC\E3\83\95\E3\83\AD\E3\83\BC)\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%box = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %box) #8
store i32 0, ptr @top, align 4, !tbaa !5
%call109 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %box)
%cmp.not110 = icmp eq i32 %call109, -1
br i1 %cmp.not110, label %while.end, label %while.body
while.body: ; preds = %entry, %while.cond.backedge
%0 = load i8, ptr %box, align 16
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not.i = icmp eq i32 %1, 0
br i1 %cmp.i.not.i, label %if.then.i, label %pop.exit
if.then.i: ; preds = %if.then
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
pop.exit: ; preds = %if.then
%dec.i = add nsw i32 %1, -1
store i32 %dec.i, ptr @top, align 4, !tbaa !5
%cmp.i.not.i42 = icmp eq i32 %dec.i, 0
br i1 %cmp.i.not.i42, label %if.then.i46, label %pop.exit48
if.then.i46: ; preds = %pop.exit
%puts.i47 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
pop.exit48: ; preds = %pop.exit
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%dec.i43 = add nsw i32 %1, -2
store i32 %dec.i43, ptr @top, align 4, !tbaa !5
%cmp.i.i = icmp sgt i32 %1, 1000
br i1 %cmp.i.i, label %if.then.i51, label %push.exit
if.then.i51: ; preds = %pop.exit48
%puts.i52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #9
unreachable
push.exit: ; preds = %pop.exit48
%idxprom.i44 = sext i32 %dec.i to i64
%arrayidx.i45 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i44
%3 = load i32, ptr %arrayidx.i45, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i45, align 4, !tbaa !5
br label %while.cond.backedge
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not.i53 = icmp eq i32 %4, 0
br i1 %cmp.i.not.i53, label %if.then.i57, label %pop.exit59
if.then.i57: ; preds = %if.then9
%puts.i58 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
pop.exit59: ; preds = %if.then9
%dec.i54 = add nsw i32 %4, -1
store i32 %dec.i54, ptr @top, align 4, !tbaa !5
%cmp.i.not.i60 = icmp eq i32 %dec.i54, 0
br i1 %cmp.i.not.i60, label %if.then.i64, label %pop.exit66
if.then.i64: ; preds = %pop.exit59
%puts.i65 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
pop.exit66: ; preds = %pop.exit59
%idxprom.i55 = sext i32 %4 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i55
%5 = load i32, ptr %arrayidx.i56, align 4, !tbaa !5
%dec.i61 = add nsw i32 %4, -2
store i32 %dec.i61, ptr @top, align 4, !tbaa !5
%cmp.i.i67 = icmp sgt i32 %4, 1000
br i1 %cmp.i.i67, label %if.then.i71, label %push.exit73
if.then.i71: ; preds = %pop.exit66
%puts.i72 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #9
unreachable
push.exit73: ; preds = %pop.exit66
%idxprom.i62 = sext i32 %dec.i54 to i64
%arrayidx.i63 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i62
%6 = load i32, ptr %arrayidx.i63, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i54, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i63, align 4, !tbaa !5
br label %while.cond.backedge
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not.i74 = icmp eq i32 %7, 0
br i1 %cmp.i.not.i74, label %if.then.i78, label %pop.exit80
if.then.i78: ; preds = %if.then17
%puts.i79 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
pop.exit80: ; preds = %if.then17
%dec.i75 = add nsw i32 %7, -1
store i32 %dec.i75, ptr @top, align 4, !tbaa !5
%cmp.i.not.i81 = icmp eq i32 %dec.i75, 0
br i1 %cmp.i.not.i81, label %if.then.i85, label %pop.exit87
if.then.i85: ; preds = %pop.exit80
%puts.i86 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
pop.exit87: ; preds = %pop.exit80
%idxprom.i76 = sext i32 %7 to i64
%arrayidx.i77 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i76
%8 = load i32, ptr %arrayidx.i77, align 4, !tbaa !5
%dec.i82 = add nsw i32 %7, -2
store i32 %dec.i82, ptr @top, align 4, !tbaa !5
%cmp.i.i88 = icmp sgt i32 %7, 1000
br i1 %cmp.i.i88, label %if.then.i92, label %push.exit94
if.then.i92: ; preds = %pop.exit87
%puts.i93 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #9
unreachable
push.exit94: ; preds = %pop.exit87
%idxprom.i83 = sext i32 %dec.i75 to i64
%arrayidx.i84 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i83
%9 = load i32, ptr %arrayidx.i84, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i75, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i84, align 4, !tbaa !5
br label %while.cond.backedge
if.else20: ; preds = %while.body
%10 = add i8 %0, -48
%or.cond = icmp ult i8 %10, 10
br i1 %or.cond, label %if.then29, label %while.cond.backedge
if.then29: ; preds = %if.else20
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %box, ptr noundef null, i32 noundef 10) #8
%11 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.i95 = icmp sgt i32 %11, 998
br i1 %cmp.i.i95, label %if.then.i99, label %push.exit101
if.then.i99: ; preds = %if.then29
%puts.i100 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @exit(i32 noundef 2) #9
unreachable
push.exit101: ; preds = %if.then29
%conv.i = trunc i64 %call.i to i32
%inc.i96 = add nsw i32 %11, 1
store i32 %inc.i96, ptr @top, align 4, !tbaa !5
%idxprom.i97 = sext i32 %inc.i96 to i64
%arrayidx.i98 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i97
store i32 %conv.i, ptr %arrayidx.i98, align 4, !tbaa !5
br label %while.cond.backedge
while.cond.backedge: ; preds = %push.exit, %push.exit94, %push.exit101, %push.exit73, %if.else20
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %box)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.cond.backedge, %entry
%12 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not.i102 = icmp eq i32 %12, 0
br i1 %cmp.i.not.i102, label %if.then.i106, label %pop.exit108
if.then.i106: ; preds = %while.end
%puts.i107 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
pop.exit108: ; preds = %while.end
%dec.i103 = add nsw i32 %12, -1
store i32 %dec.i103, ptr @top, align 4, !tbaa !5
%idxprom.i104 = sext i32 %12 to i64
%arrayidx.i105 = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom.i104
%13 = load i32, ptr %arrayidx.i105, align 4, !tbaa !5
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %box) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initialize() local_unnamed_addr #2 {
entry:
store i32 0, ptr @top, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i.not = icmp eq i32 %0, 0
br i1 %cmp.i.not, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
tail call void @exit(i32 noundef 1) #9
unreachable
if.end: ; preds = %entry
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nounwind uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp.i = icmp sgt i32 %0, 998
br i1 %cmp.i, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
tail call void @exit(i32 noundef 2) #9
unreachable
if.end: ; preds = %entry
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @stack, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isEmpty() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp = icmp ne i32 %0, 0
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isFull() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 999
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree 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 #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 norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top,S[1000];
void push(int x)
{
S[++top] = x;
}
int pop()
{
top--;
return S[top + 1];
}
int main(){
int a,b;
char s[100];
top = 0;
while(scanf("%s", s) != EOF)
{
if(s[0] == '+')
{
a = pop();
b = pop();
push(a + b);
}
else if(s[0] == '-')
{
b = pop();
a = pop();
push(a - b);
}
else if(s[0] == '*')
{
a = pop();
b = pop();
push(a * b);
}
else {
push(atoi(s));
}
}
printf("%d\n",pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287428/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287428/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
store i32 0, ptr @top, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x) {
S[++top] = x;
}
int pop() {
top--;
return S[top + 1];
}
int main() {
int a, b;
top = 0;
char s[100];
while (scanf("%s", s) != EOF) {
if (s[0] == '+') {
a = pop();
b = pop();
push(a + b);
}
else if (s[0] == '-') {
b = pop();
a = pop();
push(a - b);
}
else if (s[0] == '*') {
a = pop();
b = pop();
push(a * b);
}
else {
push(atoi(s));
}
}
printf("%d\n", pop());
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287479/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287479/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local local_unnamed_addr global [1000 x i32] zeroinitializer, align 16
@top = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @pop() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [100 x i8], align 16
store i32 0, ptr @top, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%0 = load i8, ptr %s, align 16, !tbaa !9
switch i8 %0, label %if.else20 [
i8 43, label %if.then
i8 45, label %if.then9
i8 42, label %if.then17
]
if.then: ; preds = %while.body
%1 = load i32, ptr @top, align 4, !tbaa !5
%dec.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom.i32 = sext i32 %dec.i to i64
%arrayidx.i33 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i32
%3 = load i32, ptr %arrayidx.i33, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %dec.i, ptr @top, align 4, !tbaa !5
store i32 %add, ptr %arrayidx.i33, align 4, !tbaa !5
br label %if.end24
if.then9: ; preds = %while.body
%4 = load i32, ptr @top, align 4, !tbaa !5
%dec.i36 = add nsw i32 %4, -1
%idxprom.i37 = sext i32 %4 to i64
%arrayidx.i38 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%idxprom.i40 = sext i32 %dec.i36 to i64
%arrayidx.i41 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i40
%6 = load i32, ptr %arrayidx.i41, align 4, !tbaa !5
%sub = sub nsw i32 %6, %5
store i32 %dec.i36, ptr @top, align 4, !tbaa !5
store i32 %sub, ptr %arrayidx.i41, align 4, !tbaa !5
br label %if.end24
if.then17: ; preds = %while.body
%7 = load i32, ptr @top, align 4, !tbaa !5
%dec.i45 = add nsw i32 %7, -1
%idxprom.i46 = sext i32 %7 to i64
%arrayidx.i47 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i46
%8 = load i32, ptr %arrayidx.i47, align 4, !tbaa !5
%idxprom.i49 = sext i32 %dec.i45 to i64
%arrayidx.i50 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i49
%9 = load i32, ptr %arrayidx.i50, align 4, !tbaa !5
%mul = mul nsw i32 %9, %8
store i32 %dec.i45, ptr @top, align 4, !tbaa !5
store i32 %mul, ptr %arrayidx.i50, align 4, !tbaa !5
br label %if.end24
if.else20: ; preds = %while.body
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %s, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%10 = load i32, ptr @top, align 4, !tbaa !5
%inc.i54 = add nsw i32 %10, 1
store i32 %inc.i54, ptr @top, align 4, !tbaa !5
%idxprom.i55 = sext i32 %inc.i54 to i64
%arrayidx.i56 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %conv.i, ptr %arrayidx.i56, align 4, !tbaa !5
br label %if.end24
if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end24, %entry
%11 = load i32, ptr @top, align 4, !tbaa !5
%dec.i57 = add nsw i32 %11, -1
store i32 %dec.i57, ptr @top, align 4, !tbaa !5
%idxprom.i58 = sext i32 %11 to i64
%arrayidx.i59 = getelementptr inbounds [1000 x i32], ptr @S, i64 0, i64 %idxprom.i58
%12 = load i32, ptr %arrayidx.i59, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
int a,t,r;
scanf("%d %d %d",&a,&t,&r);
printf("%f\n",(double)(t*r)/a);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287529/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287529/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%t = alloca i32, align 4
%r = 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 %t) #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 %a, ptr noundef nonnull %t, ptr noundef nonnull %r)
%0 = load i32, ptr %t, align 4, !tbaa !5
%1 = load i32, ptr %r, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%conv = sitofp i32 %mul to double
%2 = load i32, ptr %a, align 4, !tbaa !5
%conv1 = sitofp i32 %2 to double
%div = fdiv double %conv, %conv1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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 d[201][201],l[8],u[8],n,m,r,a;
void df(int c,int p,int e){
if(c==r){if(a>e)a=e;return;}
for(int i=0;i<r;i++)if(u[i]){u[i]=0;if(p==-1)df(c+1,i,0);else df(c+1,i,e+d[l[p]][l[i]]);u[i]=1;}
}
int main(){
int i,j,k,x,y,z;
scanf("%d%d%d",&n,&m,&r);n++;
for(i=0;i<r;i++){scanf("%d",&l[i]);u[i]=1;}
for(i=1;i<n;i++)for(j=1;j<n;j++)d[i][j]=(i!=j)*(1<<29);
for(i=0;i<m;i++){scanf("%d%d%d",&x,&y,&z);d[x][y]=d[y][x]=z;}
for(k=1;k<n;k++)for(i=1;i<n;i++)for(j=1;j<n;j++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
a=1<<29;df(0,-1,0);
printf("%d",a);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287572/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287572/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@r = dso_local global i32 0, align 4
@a = dso_local local_unnamed_addr global i32 0, align 4
@u = dso_local local_unnamed_addr global [8 x i32] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [201 x [201 x i32]] zeroinitializer, align 16
@l = dso_local global [8 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@n = dso_local global i32 0, align 4
@m = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @df(i32 noundef %c, i32 noundef %p, i32 noundef %e) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @r, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %c
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp436 = icmp sgt i32 %0, 0
br i1 %cmp436, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %for.cond.preheader
%cmp8 = icmp eq i32 %p, -1
%add10 = add nsw i32 %c, 1
%idxprom11 = sext i32 %p to i64
%arrayidx12 = getelementptr inbounds [8 x i32], ptr @l, i64 0, i64 %idxprom11
br i1 %cmp8, label %for.body.us, label %for.body
for.body.us: ; preds = %for.body.lr.ph, %for.inc.us
%1 = phi i32 [ %4, %for.inc.us ], [ %0, %for.body.lr.ph ]
%indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.inc.us ], [ 0, %for.body.lr.ph ]
%arrayidx.us = getelementptr inbounds [8 x i32], ptr @u, i64 0, i64 %indvars.iv41
%2 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%tobool.not.us = icmp eq i32 %2, 0
br i1 %tobool.not.us, label %for.inc.us, label %if.then5.us
if.then5.us: ; preds = %for.body.us
store i32 0, ptr %arrayidx.us, align 4, !tbaa !5
%3 = trunc i64 %indvars.iv41 to i32
tail call void @df(i32 noundef %add10, i32 noundef %3, i32 noundef 0)
store i32 1, ptr %arrayidx.us, align 4, !tbaa !5
%.pre44 = load i32, ptr @r, align 4, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %if.then5.us, %for.body.us
%4 = phi i32 [ %.pre44, %if.then5.us ], [ %1, %for.body.us ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%5 = sext i32 %4 to i64
%cmp4.us = icmp slt i64 %indvars.iv.next42, %5
br i1 %cmp4.us, label %for.body.us, label %for.end, !llvm.loop !9
if.then: ; preds = %entry
%6 = load i32, ptr @a, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %6, %e
br i1 %cmp1, label %if.then2, label %for.end
if.then2: ; preds = %if.then
store i32 %e, ptr @a, align 4, !tbaa !5
br label %for.end
for.body: ; preds = %for.body.lr.ph, %for.inc
%7 = phi i32 [ %13, %for.inc ], [ %0, %for.body.lr.ph ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body.lr.ph ]
%arrayidx = getelementptr inbounds [8 x i32], ptr @u, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %for.inc, label %if.then5
if.then5: ; preds = %for.body
store i32 0, ptr %arrayidx, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%idxprom13 = sext i32 %9 to i64
%arrayidx16 = getelementptr inbounds [8 x i32], ptr @l, i64 0, i64 %indvars.iv
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %10 to i64
%arrayidx18 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %idxprom13, i64 %idxprom17
%11 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%add19 = add nsw i32 %11, %e
%12 = trunc i64 %indvars.iv to i32
tail call void @df(i32 noundef %add10, i32 noundef %12, i32 noundef %add19)
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%.pre = load i32, ptr @r, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then5
%13 = phi i32 [ %7, %for.body ], [ %.pre, %if.then5 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%14 = sext i32 %13 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp4, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.inc.us, %for.cond.preheader, %if.then, %if.then2
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = 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 %z) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @r)
%0 = load i32, ptr @n, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @n, align 4, !tbaa !5
%1 = load i32, ptr @r, align 4, !tbaa !5
%cmp116 = icmp sgt i32 %1, 0
br i1 %cmp116, label %for.body, label %for.cond5.preheader
for.cond5.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.cond5.preheader.loopexit, %entry
%2 = phi i32 [ %.pre, %for.cond5.preheader.loopexit ], [ %inc, %entry ]
%cmp6120 = icmp sgt i32 %2, 1
br i1 %cmp6120, label %for.cond8.preheader.us.preheader, label %for.cond22.preheader
for.cond8.preheader.us.preheader: ; preds = %for.cond5.preheader
%wide.trip.count137 = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count137, -1
%min.iters.check = icmp ult i32 %2, 9
%n.vec = and i64 %3, -8
%ind.end = or i64 %n.vec, 1
%cmp.n = icmp eq i64 %3, %n.vec
br label %for.cond8.preheader.us
for.cond8.preheader.us: ; preds = %for.cond8.preheader.us.preheader, %for.cond8.for.inc19_crit_edge.us
%indvars.iv134 = phi i64 [ 1, %for.cond8.preheader.us.preheader ], [ %indvars.iv.next135, %for.cond8.for.inc19_crit_edge.us ]
br i1 %min.iters.check, label %for.body10.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond8.preheader.us
%broadcast.splatinsert = insertelement <4 x i64> poison, i64 %indvars.iv134, i64 0
%broadcast.splat = shufflevector <4 x i64> %broadcast.splatinsert, <4 x i64> 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.ind = phi <4 x i64> [ <i64 1, i64 2, i64 3, i64 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4>
%offset.idx = or i64 %index, 1
%4 = icmp eq <4 x i64> %broadcast.splat, %vec.ind
%5 = icmp eq <4 x i64> %broadcast.splat, %step.add
%6 = select <4 x i1> %4, <4 x i32> zeroinitializer, <4 x i32> <i32 536870912, i32 536870912, i32 536870912, i32 536870912>
%7 = select <4 x i1> %5, <4 x i32> zeroinitializer, <4 x i32> <i32 536870912, i32 536870912, i32 536870912, i32 536870912>
%8 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv134, i64 %offset.idx
store <4 x i32> %6, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
store <4 x i32> %7, ptr %9, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 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
br i1 %cmp.n, label %for.cond8.for.inc19_crit_edge.us, label %for.body10.us.preheader
for.body10.us.preheader: ; preds = %for.cond8.preheader.us, %middle.block
%indvars.iv131.ph = phi i64 [ 1, %for.cond8.preheader.us ], [ %ind.end, %middle.block ]
br label %for.body10.us
for.body10.us: ; preds = %for.body10.us.preheader, %for.body10.us
%indvars.iv131 = phi i64 [ %indvars.iv.next132, %for.body10.us ], [ %indvars.iv131.ph, %for.body10.us.preheader ]
%cmp11.not.us = icmp eq i64 %indvars.iv134, %indvars.iv131
%mul.us = select i1 %cmp11.not.us, i32 0, i32 536870912
%arrayidx15.us = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv134, i64 %indvars.iv131
store i32 %mul.us, ptr %arrayidx15.us, align 4, !tbaa !5
%indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
%exitcond.not = icmp eq i64 %indvars.iv.next132, %wide.trip.count137
br i1 %exitcond.not, label %for.cond8.for.inc19_crit_edge.us, label %for.body10.us, !llvm.loop !14
for.cond8.for.inc19_crit_edge.us: ; preds = %for.body10.us, %middle.block
%indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
%exitcond138.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count137
br i1 %exitcond138.not, label %for.cond22.preheader, label %for.cond8.preheader.us, !llvm.loop !15
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [8 x i32], ptr @l, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx3 = getelementptr inbounds [8 x i32], ptr @u, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = load i32, ptr @r, 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.cond5.preheader.loopexit, !llvm.loop !16
for.cond22.preheader: ; preds = %for.cond8.for.inc19_crit_edge.us, %for.cond5.preheader
%13 = load i32, ptr @m, align 4, !tbaa !5
%cmp23122 = icmp sgt i32 %13, 0
br i1 %cmp23122, label %for.body25, label %for.cond38.preheader
for.cond38.preheader.loopexit: ; preds = %for.body25
%.pre154 = load i32, ptr @n, align 4, !tbaa !5
br label %for.cond38.preheader
for.cond38.preheader: ; preds = %for.cond38.preheader.loopexit, %for.cond22.preheader
%14 = phi i32 [ %.pre154, %for.cond38.preheader.loopexit ], [ %2, %for.cond22.preheader ]
%cmp39128 = icmp sgt i32 %14, 1
br i1 %cmp39128, label %for.cond42.preheader.us.preheader, label %for.end85
for.cond42.preheader.us.preheader: ; preds = %for.cond38.preheader
%wide.trip.count152 = zext i32 %14 to i64
%15 = shl nuw nsw i64 %wide.trip.count152, 2
%16 = add nuw nsw i64 %15, 804
%17 = add nsw i64 %wide.trip.count152, -1
%18 = getelementptr i8, ptr @d, i64 %16
%min.iters.check168 = icmp ult i32 %14, 13
%19 = getelementptr i8, ptr @d, i64 %16
%n.vec171 = and i64 %17, -8
%ind.end172 = or i64 %n.vec171, 1
%cmp.n174 = icmp eq i64 %17, %n.vec171
%20 = and i64 %wide.trip.count152, 1
%lcmp.mod.not.not = icmp eq i64 %20, 0
%21 = sub nsw i64 0, %wide.trip.count152
br label %for.cond42.preheader.us
for.cond42.preheader.us: ; preds = %for.cond42.preheader.us.preheader, %for.cond42.for.inc83_crit_edge.split.us.us
%indvar157 = phi i64 [ 0, %for.cond42.preheader.us.preheader ], [ %indvar.next158, %for.cond42.for.inc83_crit_edge.split.us.us ]
%indvars.iv149 = phi i64 [ 1, %for.cond42.preheader.us.preheader ], [ %indvars.iv.next150, %for.cond42.for.inc83_crit_edge.split.us.us ]
%22 = shl nuw nsw i64 %indvar157, 2
%23 = mul nuw nsw i64 %indvar157, 804
%gep200 = getelementptr i8, ptr getelementptr (i8, ptr @d, i64 808), i64 %23
%scevgep162 = getelementptr i8, ptr %18, i64 %23
%gep201 = getelementptr i8, ptr getelementptr (i8, ptr @d, i64 812), i64 %22
%gep202 = getelementptr i8, ptr getelementptr (i8, ptr @d, i64 808), i64 %22
%bound1 = icmp ult ptr %gep202, %19
br label %for.cond46.preheader.us.us
for.cond46.preheader.us.us: ; preds = %for.cond46.for.inc80_crit_edge.us.us, %for.cond42.preheader.us
%indvar = phi i64 [ %indvar.next, %for.cond46.for.inc80_crit_edge.us.us ], [ 0, %for.cond42.preheader.us ]
%indvars.iv144 = phi i64 [ %indvars.iv.next145, %for.cond46.for.inc80_crit_edge.us.us ], [ 1, %for.cond42.preheader.us ]
%arrayidx57.us.us = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %indvars.iv149
br i1 %min.iters.check168, label %for.body49.us.us.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.cond46.preheader.us.us
%24 = mul nuw nsw i64 %indvar, 804
%scevgep160 = getelementptr i8, ptr %gep201, i64 %24
%scevgep156 = getelementptr i8, ptr %19, i64 %24
%gep = getelementptr i8, ptr getelementptr (i8, ptr @d, i64 808), i64 %24
%bound0 = icmp ult ptr %gep, %scevgep160
%found.conflict = and i1 %bound0, %bound1
%bound0163 = icmp ult ptr %gep, %scevgep162
%bound1164 = icmp ult ptr %gep200, %scevgep156
%found.conflict165 = and i1 %bound0163, %bound1164
%conflict.rdx = or i1 %found.conflict, %found.conflict165
br i1 %conflict.rdx, label %for.body49.us.us.preheader, label %vector.ph169
vector.ph169: ; preds = %vector.memcheck
%25 = load i32, ptr %arrayidx57.us.us, align 4, !tbaa !5, !alias.scope !17
%broadcast.splatinsert183 = insertelement <4 x i32> poison, i32 %25, i64 0
%broadcast.splat184 = shufflevector <4 x i32> %broadcast.splatinsert183, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body175
vector.body175: ; preds = %pred.store.continue198, %vector.ph169
%index176 = phi i64 [ 0, %vector.ph169 ], [ %index.next199, %pred.store.continue198 ]
%offset.idx177 = or i64 %index176, 1
%26 = or i64 %index176, 5
%27 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %offset.idx177
%wide.load = load <4 x i32>, ptr %27, align 4, !tbaa !5, !alias.scope !20, !noalias !22
%28 = getelementptr inbounds i32, ptr %27, i64 4
%wide.load178 = load <4 x i32>, ptr %28, align 4, !tbaa !5, !alias.scope !20, !noalias !22
%29 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv149, i64 %offset.idx177
%wide.load179 = load <4 x i32>, ptr %29, align 4, !tbaa !5, !alias.scope !24
%30 = getelementptr inbounds i32, ptr %29, i64 4
%wide.load180 = load <4 x i32>, ptr %30, align 4, !tbaa !5, !alias.scope !24
%31 = add nsw <4 x i32> %wide.load179, %broadcast.splat184
%32 = add nsw <4 x i32> %wide.load180, %broadcast.splat184
%33 = icmp sgt <4 x i32> %wide.load, %31
%34 = icmp sgt <4 x i32> %wide.load178, %32
%35 = extractelement <4 x i1> %33, i64 0
br i1 %35, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body175
%36 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %offset.idx177
%37 = extractelement <4 x i32> %31, i64 0
store i32 %37, ptr %36, align 4, !tbaa !5, !alias.scope !20, !noalias !22
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body175
%38 = extractelement <4 x i1> %33, i64 1
br i1 %38, label %pred.store.if185, label %pred.store.continue186
pred.store.if185: ; preds = %pred.store.continue
%39 = or i64 %index176, 2
%40 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %39
%41 = extractelement <4 x i32> %31, i64 1
store i32 %41, ptr %40, align 4, !tbaa !5, !alias.scope !20, !noalias !22
br label %pred.store.continue186
pred.store.continue186: ; preds = %pred.store.if185, %pred.store.continue
%42 = extractelement <4 x i1> %33, i64 2
br i1 %42, label %pred.store.if187, label %pred.store.continue188
pred.store.if187: ; preds = %pred.store.continue186
%43 = or i64 %index176, 3
%44 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %43
%45 = extractelement <4 x i32> %31, i64 2
store i32 %45, ptr %44, align 4, !tbaa !5, !alias.scope !20, !noalias !22
br label %pred.store.continue188
pred.store.continue188: ; preds = %pred.store.if187, %pred.store.continue186
%46 = extractelement <4 x i1> %33, i64 3
br i1 %46, label %pred.store.if189, label %pred.store.continue190
pred.store.if189: ; preds = %pred.store.continue188
%47 = or i64 %index176, 4
%48 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %47
%49 = extractelement <4 x i32> %31, i64 3
store i32 %49, ptr %48, align 4, !tbaa !5, !alias.scope !20, !noalias !22
br label %pred.store.continue190
pred.store.continue190: ; preds = %pred.store.if189, %pred.store.continue188
%50 = extractelement <4 x i1> %34, i64 0
br i1 %50, label %pred.store.if191, label %pred.store.continue192
pred.store.if191: ; preds = %pred.store.continue190
%51 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %26
%52 = extractelement <4 x i32> %32, i64 0
store i32 %52, ptr %51, align 4, !tbaa !5, !alias.scope !20, !noalias !22
br label %pred.store.continue192
pred.store.continue192: ; preds = %pred.store.if191, %pred.store.continue190
%53 = extractelement <4 x i1> %34, i64 1
br i1 %53, label %pred.store.if193, label %pred.store.continue194
pred.store.if193: ; preds = %pred.store.continue192
%54 = or i64 %index176, 6
%55 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %54
%56 = extractelement <4 x i32> %32, i64 1
store i32 %56, ptr %55, align 4, !tbaa !5, !alias.scope !20, !noalias !22
br label %pred.store.continue194
pred.store.continue194: ; preds = %pred.store.if193, %pred.store.continue192
%57 = extractelement <4 x i1> %34, i64 2
br i1 %57, label %pred.store.if195, label %pred.store.continue196
pred.store.if195: ; preds = %pred.store.continue194
%58 = or i64 %index176, 7
%59 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %58
%60 = extractelement <4 x i32> %32, i64 2
store i32 %60, ptr %59, align 4, !tbaa !5, !alias.scope !20, !noalias !22
br label %pred.store.continue196
pred.store.continue196: ; preds = %pred.store.if195, %pred.store.continue194
%61 = extractelement <4 x i1> %34, i64 3
br i1 %61, label %pred.store.if197, label %pred.store.continue198
pred.store.if197: ; preds = %pred.store.continue196
%62 = add i64 %index176, 8
%63 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %62
%64 = extractelement <4 x i32> %32, i64 3
store i32 %64, ptr %63, align 4, !tbaa !5, !alias.scope !20, !noalias !22
br label %pred.store.continue198
pred.store.continue198: ; preds = %pred.store.if197, %pred.store.continue196
%index.next199 = add nuw i64 %index176, 8
%65 = icmp eq i64 %index.next199, %n.vec171
br i1 %65, label %middle.block166, label %vector.body175, !llvm.loop !25
middle.block166: ; preds = %pred.store.continue198
br i1 %cmp.n174, label %for.cond46.for.inc80_crit_edge.us.us, label %for.body49.us.us.preheader
for.body49.us.us.preheader: ; preds = %vector.memcheck, %for.cond46.preheader.us.us, %middle.block166
%indvars.iv139.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %for.cond46.preheader.us.us ], [ %ind.end172, %middle.block166 ]
br i1 %lcmp.mod.not.not, label %for.body49.us.us.prol, label %for.body49.us.us.prol.loopexit
for.body49.us.us.prol: ; preds = %for.body49.us.us.preheader
%arrayidx53.us.us.prol = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %indvars.iv139.ph
%66 = load i32, ptr %arrayidx53.us.us.prol, align 4, !tbaa !5
%67 = load i32, ptr %arrayidx57.us.us, align 4, !tbaa !5
%arrayidx61.us.us.prol = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv149, i64 %indvars.iv139.ph
%68 = load i32, ptr %arrayidx61.us.us.prol, align 4, !tbaa !5
%add.us.us.prol = add nsw i32 %68, %67
%cmp62.us.us.prol = icmp sgt i32 %66, %add.us.us.prol
br i1 %cmp62.us.us.prol, label %if.then.us.us.prol, label %for.inc77.us.us.prol
if.then.us.us.prol: ; preds = %for.body49.us.us.prol
store i32 %add.us.us.prol, ptr %arrayidx53.us.us.prol, align 4, !tbaa !5
br label %for.inc77.us.us.prol
for.inc77.us.us.prol: ; preds = %if.then.us.us.prol, %for.body49.us.us.prol
%indvars.iv.next140.prol = add nuw nsw i64 %indvars.iv139.ph, 1
br label %for.body49.us.us.prol.loopexit
for.body49.us.us.prol.loopexit: ; preds = %for.inc77.us.us.prol, %for.body49.us.us.preheader
%indvars.iv139.unr = phi i64 [ %indvars.iv139.ph, %for.body49.us.us.preheader ], [ %indvars.iv.next140.prol, %for.inc77.us.us.prol ]
%69 = xor i64 %indvars.iv139.ph, %21
%70 = icmp eq i64 %69, -1
br i1 %70, label %for.cond46.for.inc80_crit_edge.us.us, label %for.body49.us.us
for.body49.us.us: ; preds = %for.body49.us.us.prol.loopexit, %for.inc77.us.us.1
%indvars.iv139 = phi i64 [ %indvars.iv.next140.1, %for.inc77.us.us.1 ], [ %indvars.iv139.unr, %for.body49.us.us.prol.loopexit ]
%arrayidx53.us.us = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %indvars.iv139
%71 = load i32, ptr %arrayidx53.us.us, align 4, !tbaa !5
%72 = load i32, ptr %arrayidx57.us.us, align 4, !tbaa !5
%arrayidx61.us.us = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv149, i64 %indvars.iv139
%73 = load i32, ptr %arrayidx61.us.us, align 4, !tbaa !5
%add.us.us = add nsw i32 %73, %72
%cmp62.us.us = icmp sgt i32 %71, %add.us.us
br i1 %cmp62.us.us, label %if.then.us.us, label %for.inc77.us.us
if.then.us.us: ; preds = %for.body49.us.us
store i32 %add.us.us, ptr %arrayidx53.us.us, align 4, !tbaa !5
br label %for.inc77.us.us
for.inc77.us.us: ; preds = %if.then.us.us, %for.body49.us.us
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%arrayidx53.us.us.1 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv144, i64 %indvars.iv.next140
%74 = load i32, ptr %arrayidx53.us.us.1, align 4, !tbaa !5
%75 = load i32, ptr %arrayidx57.us.us, align 4, !tbaa !5
%arrayidx61.us.us.1 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %indvars.iv149, i64 %indvars.iv.next140
%76 = load i32, ptr %arrayidx61.us.us.1, align 4, !tbaa !5
%add.us.us.1 = add nsw i32 %76, %75
%cmp62.us.us.1 = icmp sgt i32 %74, %add.us.us.1
br i1 %cmp62.us.us.1, label %if.then.us.us.1, label %for.inc77.us.us.1
if.then.us.us.1: ; preds = %for.inc77.us.us
store i32 %add.us.us.1, ptr %arrayidx53.us.us.1, align 4, !tbaa !5
br label %for.inc77.us.us.1
for.inc77.us.us.1: ; preds = %if.then.us.us.1, %for.inc77.us.us
%indvars.iv.next140.1 = add nuw nsw i64 %indvars.iv139, 2
%exitcond143.not.1 = icmp eq i64 %indvars.iv.next140.1, %wide.trip.count152
br i1 %exitcond143.not.1, label %for.cond46.for.inc80_crit_edge.us.us, label %for.body49.us.us, !llvm.loop !26
for.cond46.for.inc80_crit_edge.us.us: ; preds = %for.body49.us.us.prol.loopexit, %for.inc77.us.us.1, %middle.block166
%indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
%exitcond148.not = icmp eq i64 %indvars.iv.next145, %wide.trip.count152
%indvar.next = add i64 %indvar, 1
br i1 %exitcond148.not, label %for.cond42.for.inc83_crit_edge.split.us.us, label %for.cond46.preheader.us.us, !llvm.loop !27
for.cond42.for.inc83_crit_edge.split.us.us: ; preds = %for.cond46.for.inc80_crit_edge.us.us
%indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
%exitcond153.not = icmp eq i64 %indvars.iv.next150, %wide.trip.count152
%indvar.next158 = add i64 %indvar157, 1
br i1 %exitcond153.not, label %for.end85, label %for.cond42.preheader.us, !llvm.loop !28
for.body25: ; preds = %for.cond22.preheader, %for.body25
%i.2123 = phi i32 [ %inc36, %for.body25 ], [ 0, %for.cond22.preheader ]
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%77 = load i32, ptr %z, align 4, !tbaa !5
%78 = load i32, ptr %y, align 4, !tbaa !5
%idxprom27 = sext i32 %78 to i64
%79 = load i32, ptr %x, align 4, !tbaa !5
%idxprom29 = sext i32 %79 to i64
%arrayidx30 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %idxprom27, i64 %idxprom29
store i32 %77, ptr %arrayidx30, align 4, !tbaa !5
%arrayidx34 = getelementptr inbounds [201 x [201 x i32]], ptr @d, i64 0, i64 %idxprom29, i64 %idxprom27
store i32 %77, ptr %arrayidx34, align 4, !tbaa !5
%inc36 = add nuw nsw i32 %i.2123, 1
%80 = load i32, ptr @m, align 4, !tbaa !5
%cmp23 = icmp slt i32 %inc36, %80
br i1 %cmp23, label %for.body25, label %for.cond38.preheader.loopexit, !llvm.loop !29
for.end85: ; preds = %for.cond42.for.inc83_crit_edge.split.us.us, %for.cond38.preheader
store i32 536870912, ptr @a, align 4, !tbaa !5
call void @df(i32 noundef 0, i32 noundef -1, i32 noundef 0)
%81 = load i32, ptr @a, align 4, !tbaa !5
%call86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %81)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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}
!16 = distinct !{!16, !10}
!17 = !{!18}
!18 = distinct !{!18, !19}
!19 = distinct !{!19, !"LVerDomain"}
!20 = !{!21}
!21 = distinct !{!21, !19}
!22 = !{!18, !23}
!23 = distinct !{!23, !19}
!24 = !{!23}
!25 = distinct !{!25, !10, !12, !13}
!26 = distinct !{!26, !10, !12}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
|
#include <stdio.h>
int main(void)
{
int a, b, i, f, f2 = 0;
while (1){
scanf("%d %d", &a, &b);
if (a == 0 && b == 0){
break;
}
f = 0;
if (f2 == 1){
puts("");
}
f2 = 1;
for (i = a; i <= b; i++){
if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)){
printf("%d\n", i);
f = 1;
}
}
if (f == 0){
printf("NA\n");
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287615/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287615/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call29 = 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
%cmp30 = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp131 = icmp eq i32 %1, 0
%or.cond32 = select i1 %cmp30, i1 %cmp131, i1 false
br i1 %or.cond32, label %while.end, label %if.end5
if.then3.critedge: ; preds = %if.end19
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre34 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end5
if.end5: ; preds = %entry, %if.then3.critedge
%2 = phi i32 [ %.pre34, %if.then3.critedge ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then3.critedge ], [ %0, %entry ]
%cmp6.not26 = icmp sgt i32 %3, %2
br i1 %cmp6.not26, label %if.then17, label %for.body
for.body: ; preds = %if.end5, %for.inc
%4 = phi i32 [ %6, %for.inc ], [ %2, %if.end5 ]
%f.028 = phi i32 [ %f.1, %for.inc ], [ 0, %if.end5 ]
%i.027 = phi i32 [ %inc, %for.inc ], [ %3, %if.end5 ]
%rem = srem i32 %i.027, 400
%cmp7 = icmp eq i32 %rem, 0
br i1 %cmp7, label %if.then13, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body
%5 = and i32 %i.027, 3
%cmp9 = icmp ne i32 %5, 0
%rem11 = srem i32 %i.027, 100
%cmp12.not = icmp eq i32 %rem11, 0
%or.cond25 = or i1 %cmp9, %cmp12.not
br i1 %or.cond25, label %for.inc, label %if.then13
if.then13: ; preds = %lor.lhs.false, %for.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.027)
%.pre35 = load i32, ptr %b, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %lor.lhs.false, %if.then13
%6 = phi i32 [ %.pre35, %if.then13 ], [ %4, %lor.lhs.false ]
%f.1 = phi i32 [ 1, %if.then13 ], [ %f.028, %lor.lhs.false ]
%inc = add nsw i32 %i.027, 1
%cmp6.not.not = icmp slt i32 %i.027, %6
br i1 %cmp6.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%cmp16 = icmp eq i32 %f.1, 0
br i1 %cmp16, label %if.then17, label %if.end19
if.then17: ; preds = %if.end5, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end19
if.end19: ; preds = %if.then17, %for.end
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%7 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %7, 0
%8 = load i32, ptr %b, align 4
%cmp1 = icmp eq i32 %8, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.then3.critedge
while.end: ; preds = %if.end19, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int a, b, i, n, c;
c = 0;
while (1) {
c++;
n = 0;
scanf("%d %d", &a, &b);
if (a == 0 && b == 0)
break;
if (c != 1)
printf("\n");
for (i = a; i <= b; i++) {
if (i % 4 == 0 && (i % 100 != 0 || i % 400 == 0)) {
n++;
printf("%d\n", i);
}
}
if (n == 0)
printf("NA\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287659/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287659/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call33 = 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
%cmp34 = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp135 = icmp eq i32 %1, 0
%or.cond36 = select i1 %cmp34, i1 %cmp135, i1 false
br i1 %or.cond36, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end21
%2 = phi i32 [ %10, %if.end21 ], [ %1, %entry ]
%3 = phi i32 [ %9, %if.end21 ], [ %0, %entry ]
%cmp2.not = phi i1 [ false, %if.end21 ], [ true, %entry ]
br i1 %cmp2.not, label %if.end5, label %if.then3
if.then3: ; preds = %if.end
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre39 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%4 = phi i32 [ %.pre39, %if.then3 ], [ %2, %if.end ]
%5 = phi i32 [ %.pre, %if.then3 ], [ %3, %if.end ]
%cmp6.not30 = icmp sgt i32 %5, %4
br i1 %cmp6.not30, label %if.then19, label %for.body
for.body: ; preds = %if.end5, %for.inc
%6 = phi i32 [ %8, %for.inc ], [ %4, %if.end5 ]
%n.032 = phi i32 [ %n.1, %for.inc ], [ 0, %if.end5 ]
%i.031 = phi i32 [ %inc17, %for.inc ], [ %5, %if.end5 ]
%7 = and i32 %i.031, 3
%cmp7 = icmp eq i32 %7, 0
br i1 %cmp7, label %land.lhs.true8, label %for.inc
land.lhs.true8: ; preds = %for.body
%rem9 = srem i32 %i.031, 100
%cmp10.not = icmp ne i32 %rem9, 0
%rem11 = srem i32 %i.031, 400
%cmp12 = icmp eq i32 %rem11, 0
%or.cond29 = or i1 %cmp10.not, %cmp12
br i1 %or.cond29, label %if.then13, label %for.inc
if.then13: ; preds = %land.lhs.true8
%inc14 = add nsw i32 %n.032, 1
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.031)
%.pre40 = load i32, ptr %b, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %land.lhs.true8, %for.body, %if.then13
%8 = phi i32 [ %.pre40, %if.then13 ], [ %6, %for.body ], [ %6, %land.lhs.true8 ]
%n.1 = phi i32 [ %inc14, %if.then13 ], [ %n.032, %for.body ], [ %n.032, %land.lhs.true8 ]
%inc17 = add nsw i32 %i.031, 1
%cmp6.not.not = icmp slt i32 %i.031, %8
br i1 %cmp6.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%cmp18 = icmp eq i32 %n.1, 0
br i1 %cmp18, label %if.then19, label %if.end21
if.then19: ; preds = %if.end5, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end21
if.end21: ; preds = %if.then19, %for.end
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%9 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %b, 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 %if.end
while.end: ; preds = %if.end21, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int leap(int x){
if(x % 400 == 0)return 1;
if(x % 100 == 0)return 0;
if(x % 4 == 0)return 1;
return 0;
}
int main(){
int a, b, num, i, first = 1;
while(1){
scanf("%d%d", &a, &b);
if(a == 0 && b == 0)return 0;
if(!first)puts("");
first = 0;
num = 0;
for(i = a;i <= b;i++){
if(leap(i)){
printf("%d\n", i);
num++;
}
}
if(num == 0)puts("NA");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287723/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287723/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NA\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @leap(i32 noundef %x) local_unnamed_addr #0 {
entry:
%rem = srem i32 %x, 400
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%rem1 = srem i32 %x, 100
%cmp2 = icmp eq i32 %rem1, 0
br i1 %cmp2, label %return, label %if.end4
if.end4: ; preds = %if.end
%0 = and i32 %x, 3
%cmp6 = icmp eq i32 %0, 0
%. = zext i1 %cmp6 to i32
br label %return
return: ; preds = %if.end4, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ %., %if.end4 ]
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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call29 = 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
%cmp30 = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp131 = icmp eq i32 %1, 0
%or.cond32 = select i1 %cmp30, i1 %cmp131, i1 false
br i1 %or.cond32, label %if.then, label %if.end4
if.then: ; preds = %if.end15, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
if.then2.critedge: ; preds = %if.end15
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre34 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end4
if.end4: ; preds = %entry, %if.then2.critedge
%2 = phi i32 [ %.pre34, %if.then2.critedge ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then2.critedge ], [ %0, %entry ]
%cmp5.not26 = icmp sgt i32 %3, %2
br i1 %cmp5.not26, label %if.then13, label %for.body
for.body: ; preds = %if.end4, %for.inc
%4 = phi i32 [ %6, %for.inc ], [ %2, %if.end4 ]
%i.028 = phi i32 [ %inc11, %for.inc ], [ %3, %if.end4 ]
%num.027 = phi i32 [ %num.1, %for.inc ], [ 0, %if.end4 ]
%rem.i = srem i32 %i.028, 400
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %if.then8, label %if.end.i
if.end.i: ; preds = %for.body
%rem1.i = srem i32 %i.028, 100
%cmp2.i = icmp ne i32 %rem1.i, 0
%5 = and i32 %i.028, 3
%cmp6.i.not = icmp eq i32 %5, 0
%or.cond25 = and i1 %cmp2.i, %cmp6.i.not
br i1 %or.cond25, label %if.then8, label %for.inc
if.then8: ; preds = %if.end.i, %for.body
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.028)
%inc = add nsw i32 %num.027, 1
%.pre35 = load i32, ptr %b, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end.i, %if.then8
%6 = phi i32 [ %.pre35, %if.then8 ], [ %4, %if.end.i ]
%num.1 = phi i32 [ %inc, %if.then8 ], [ %num.027, %if.end.i ]
%inc11 = add nsw i32 %i.028, 1
%cmp5.not.not = icmp slt i32 %i.028, %6
br i1 %cmp5.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%cmp12 = icmp eq i32 %num.1, 0
br i1 %cmp12, label %if.then13, label %if.end15
if.then13: ; preds = %if.end4, %for.end
%call14 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end15
if.end15: ; preds = %if.then13, %for.end
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%7 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp eq i32 %7, 0
%8 = load i32, ptr %b, align 4
%cmp1 = icmp eq i32 %8, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.then, label %if.then2.critedge
}
; 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: 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 #4
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 = { 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(){
int i, j, a, b, f = -1;
while(scanf("%d%d", &a, &b) && (a || b)){
if(f != -1) puts("");
f = 1;
for(i = a;i <= b;i++){
if(i % 4 == 0 && (i % 100 || i % 400 == 0)){
printf("%d\n", i);
f = 0;
}
}
if(f) puts("NA");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287767/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287767/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%tobool.not27 = icmp eq i32 %call26, 0
br i1 %tobool.not27, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %if.end16
%f.028 = phi i32 [ %f.1.lcssa34, %if.end16 ], [ -1, %entry ]
%0 = load i32, ptr %a, align 4, !tbaa !5
%tobool1 = icmp ne i32 %0, 0
%1 = load i32, ptr %b, align 4
%tobool2 = icmp ne i32 %1, 0
%2 = select i1 %tobool1, i1 true, i1 %tobool2
br i1 %2, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%cmp.not = icmp eq i32 %f.028, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre29 = load i32, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%3 = phi i32 [ %.pre29, %if.then ], [ %1, %while.body ]
%4 = phi i32 [ %.pre, %if.then ], [ %0, %while.body ]
%cmp4.not23 = icmp sgt i32 %4, %3
br i1 %cmp4.not23, label %if.then14, label %for.body
for.body: ; preds = %if.end, %for.inc
%5 = phi i32 [ %7, %for.inc ], [ %3, %if.end ]
%f.125 = phi i32 [ %f.2, %for.inc ], [ 1, %if.end ]
%i.024 = phi i32 [ %inc, %for.inc ], [ %4, %if.end ]
%6 = and i32 %i.024, 3
%cmp5 = icmp eq i32 %6, 0
br i1 %cmp5, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%rem6 = srem i32 %i.024, 100
%tobool7.not = icmp ne i32 %rem6, 0
%rem8 = srem i32 %i.024, 400
%cmp9 = icmp eq i32 %rem8, 0
%or.cond = or i1 %tobool7.not, %cmp9
br i1 %or.cond, label %if.then10, label %for.inc
if.then10: ; preds = %land.lhs.true
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.024)
%.pre30 = load i32, ptr %b, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %land.lhs.true, %for.body, %if.then10
%7 = phi i32 [ %.pre30, %if.then10 ], [ %5, %for.body ], [ %5, %land.lhs.true ]
%f.2 = phi i32 [ 0, %if.then10 ], [ %f.125, %for.body ], [ %f.125, %land.lhs.true ]
%inc = add nsw i32 %i.024, 1
%cmp4.not.not = icmp slt i32 %i.024, %7
br i1 %cmp4.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%tobool13.not = icmp eq i32 %f.2, 0
br i1 %tobool13.not, label %if.end16, label %if.then14
if.then14: ; preds = %if.end, %for.end
%f.1.lcssa33 = phi i32 [ %f.2, %for.end ], [ 1, %if.end ]
%call15 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end16
if.end16: ; preds = %if.then14, %for.end
%f.1.lcssa34 = phi i32 [ %f.1.lcssa33, %if.then14 ], [ 0, %for.end ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %while.end, label %land.rhs, !llvm.loop !11
while.end: ; preds = %land.rhs, %if.end16, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int bills;
long int howMuch (int a);
int main () {
int v;
long int x;
while (scanf ("%d", &v) != EOF) {
if (v == -1) break;
bills = 0;
x = 4280 - howMuch (v);
printf ("%ld\n", x);
}
return 0;
}
long int howMuch (int v) {
if (v <= 10) { // volume ? 10
bills += 1150;
return bills;
} else if ((v > 10) && (v <= 20)) { // 10 < volume ? 20
if ((v % 10) == 0) {
bills += 1250;
return howMuch(v-10);
} else {
bills += (v % 10) * 125;
return howMuch(v-(v%10));
}
} else if ((v > 20) && (v <= 30)) { // 20 < volume ? 30
if ((v % 10) == 0) {
bills += 1400;
return howMuch(v-10);
} else {
bills += (v % 10) * 140;
return howMuch(v-(v%10));
}
} else { // 30 < volume
if ((v % 30) == 0) {
bills += (v - 30) * 160;
return howMuch(30);
} else {
bills += (v % 30) * 160;
return howMuch(v-(v%30));
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287817/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287817/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@bills = dso_local local_unnamed_addr global i32 0, align 4
@.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:
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%cmp6 = icmp eq i32 %call5, -1
%0 = load i32, ptr %v, align 4
%cmp17 = icmp eq i32 %0, -1
%or.cond8 = select i1 %cmp6, i1 true, i1 %cmp17
br i1 %or.cond8, label %while.end, label %if.end
if.end: ; preds = %entry, %howMuch.exit
%1 = phi i32 [ %4, %howMuch.exit ], [ %0, %entry ]
%cmp77.i = icmp slt i32 %1, 11
br i1 %cmp77.i, label %howMuch.exit, label %if.else.i
if.else.i: ; preds = %if.end, %tailrecurse.backedge.i
%v.tr79.i = phi i32 [ %v.tr.be.i, %tailrecurse.backedge.i ], [ %1, %if.end ]
%add497578.i = phi i32 [ %add4976.i, %tailrecurse.backedge.i ], [ 0, %if.end ]
%cmp3.i = icmp ult i32 %v.tr79.i, 21
br i1 %cmp3.i, label %if.then5.i, label %if.else16.i
if.then5.i: ; preds = %if.else.i
%rem.lhs.trunc.i = trunc i32 %v.tr79.i to i8
%rem73.i = urem i8 %rem.lhs.trunc.i, 10
%cmp6.i = icmp eq i8 %rem73.i, 0
br i1 %cmp6.i, label %tailrecurse.backedge.thread.i, label %if.else10.i
tailrecurse.backedge.thread.i: ; preds = %if.then5.i
%add9.i = add nsw i32 %add497578.i, 1250
br label %howMuch.exit
tailrecurse.backedge.i: ; preds = %if.else46.i, %if.then41.i, %if.else30.i, %if.then26.i, %if.else10.i
%add4976.i = phi i32 [ %add12.i, %if.else10.i ], [ %add27.i, %if.then26.i ], [ %add33.i, %if.else30.i ], [ %add44.i, %if.then41.i ], [ %add49.i, %if.else46.i ]
%v.tr.be.i = phi i32 [ %sub14.i, %if.else10.i ], [ %sub28.i, %if.then26.i ], [ %sub35.i, %if.else30.i ], [ 30, %if.then41.i ], [ %sub51.i, %if.else46.i ]
%cmp.i = icmp ult i32 %v.tr.be.i, 11
br i1 %cmp.i, label %howMuch.exit, label %if.else.i
if.else10.i: ; preds = %if.then5.i
%rem.zext.i = zext i8 %rem73.i to i32
%mul.i = mul nuw nsw i32 %rem.zext.i, 125
%add12.i = add nsw i32 %mul.i, %add497578.i
store i32 %add12.i, ptr @bills, align 4, !tbaa !5
%sub14.i = sub nuw nsw i32 %v.tr79.i, %rem.zext.i
br label %tailrecurse.backedge.i
if.else16.i: ; preds = %if.else.i
%cmp20.i = icmp ult i32 %v.tr79.i, 31
br i1 %cmp20.i, label %if.then22.i, label %if.else37.i
if.then22.i: ; preds = %if.else16.i
%rem23.lhs.trunc.i = trunc i32 %v.tr79.i to i8
%rem2374.i = urem i8 %rem23.lhs.trunc.i, 10
%cmp24.i = icmp eq i8 %rem2374.i, 0
br i1 %cmp24.i, label %if.then26.i, label %if.else30.i
if.then26.i: ; preds = %if.then22.i
%add27.i = add nsw i32 %add497578.i, 1400
store i32 %add27.i, ptr @bills, align 4, !tbaa !5
%sub28.i = add nsw i32 %v.tr79.i, -10
br label %tailrecurse.backedge.i
if.else30.i: ; preds = %if.then22.i
%rem23.zext.i = zext i8 %rem2374.i to i32
%mul32.i = mul nuw nsw i32 %rem23.zext.i, 140
%add33.i = add nsw i32 %mul32.i, %add497578.i
store i32 %add33.i, ptr @bills, align 4, !tbaa !5
%sub35.i = sub nuw nsw i32 %v.tr79.i, %rem23.zext.i
br label %tailrecurse.backedge.i
if.else37.i: ; preds = %if.else16.i
%rem38.i = urem i32 %v.tr79.i, 30
%cmp39.i = icmp eq i32 %rem38.i, 0
br i1 %cmp39.i, label %if.then41.i, label %if.else46.i
if.then41.i: ; preds = %if.else37.i
%2 = mul i32 %v.tr79.i, 160
%mul43.i = add i32 %2, -4800
%add44.i = add nsw i32 %mul43.i, %add497578.i
br label %tailrecurse.backedge.i
if.else46.i: ; preds = %if.else37.i
%mul48.i = mul nuw nsw i32 %rem38.i, 160
%add49.i = add nsw i32 %mul48.i, %add497578.i
%sub51.i = sub nuw nsw i32 %v.tr79.i, %rem38.i
br label %tailrecurse.backedge.i
howMuch.exit: ; preds = %tailrecurse.backedge.i, %if.end, %tailrecurse.backedge.thread.i
%3 = phi i32 [ 0, %if.end ], [ %add9.i, %tailrecurse.backedge.thread.i ], [ %add4976.i, %tailrecurse.backedge.i ]
%add.i = add nsw i32 %3, 1150
store i32 %add.i, ptr @bills, align 4, !tbaa !5
%conv.i = sext i32 %add.i to i64
%sub = sub nsw i64 4280, %conv.i
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%cmp = icmp eq i32 %call, -1
%4 = load i32, ptr %v, align 4
%cmp1 = icmp eq i32 %4, -1
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
br i1 %or.cond, label %while.end, label %if.end, !llvm.loop !9
while.end: ; preds = %howMuch.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @howMuch(i32 noundef %v) local_unnamed_addr #3 {
entry:
%bills.promoted = load i32, ptr @bills, align 4, !tbaa !5
%cmp77 = icmp slt i32 %v, 11
br i1 %cmp77, label %if.then, label %if.else
if.then: ; preds = %tailrecurse.backedge, %tailrecurse.backedge.thread, %entry
%0 = phi i32 [ %bills.promoted, %entry ], [ %add9, %tailrecurse.backedge.thread ], [ %add4976, %tailrecurse.backedge ]
%add = add nsw i32 %0, 1150
store i32 %add, ptr @bills, align 4, !tbaa !5
%conv = sext i32 %add to i64
ret i64 %conv
if.else: ; preds = %entry, %tailrecurse.backedge
%v.tr79 = phi i32 [ %v.tr.be, %tailrecurse.backedge ], [ %v, %entry ]
%add497578 = phi i32 [ %add4976, %tailrecurse.backedge ], [ %bills.promoted, %entry ]
%cmp3 = icmp ult i32 %v.tr79, 21
br i1 %cmp3, label %if.then5, label %if.else16
if.then5: ; preds = %if.else
%rem.lhs.trunc = trunc i32 %v.tr79 to i8
%rem73 = urem i8 %rem.lhs.trunc, 10
%cmp6 = icmp eq i8 %rem73, 0
br i1 %cmp6, label %tailrecurse.backedge.thread, label %if.else10
tailrecurse.backedge.thread: ; preds = %if.then5
%add9 = add nsw i32 %add497578, 1250
br label %if.then
tailrecurse.backedge: ; preds = %if.else10, %if.then26, %if.else30, %if.then41, %if.else46
%add4976 = phi i32 [ %add12, %if.else10 ], [ %add27, %if.then26 ], [ %add33, %if.else30 ], [ %add44, %if.then41 ], [ %add49, %if.else46 ]
%v.tr.be = phi i32 [ %sub14, %if.else10 ], [ %sub28, %if.then26 ], [ %sub35, %if.else30 ], [ 30, %if.then41 ], [ %sub51, %if.else46 ]
%cmp = icmp ult i32 %v.tr.be, 11
br i1 %cmp, label %if.then, label %if.else
if.else10: ; preds = %if.then5
%rem.zext = zext i8 %rem73 to i32
%mul = mul nuw nsw i32 %rem.zext, 125
%add12 = add nsw i32 %add497578, %mul
store i32 %add12, ptr @bills, align 4, !tbaa !5
%sub14 = sub nuw nsw i32 %v.tr79, %rem.zext
br label %tailrecurse.backedge
if.else16: ; preds = %if.else
%cmp20 = icmp ult i32 %v.tr79, 31
br i1 %cmp20, label %if.then22, label %if.else37
if.then22: ; preds = %if.else16
%rem23.lhs.trunc = trunc i32 %v.tr79 to i8
%rem2374 = urem i8 %rem23.lhs.trunc, 10
%cmp24 = icmp eq i8 %rem2374, 0
br i1 %cmp24, label %if.then26, label %if.else30
if.then26: ; preds = %if.then22
%add27 = add nsw i32 %add497578, 1400
store i32 %add27, ptr @bills, align 4, !tbaa !5
%sub28 = add nsw i32 %v.tr79, -10
br label %tailrecurse.backedge
if.else30: ; preds = %if.then22
%rem23.zext = zext i8 %rem2374 to i32
%mul32 = mul nuw nsw i32 %rem23.zext, 140
%add33 = add nsw i32 %add497578, %mul32
store i32 %add33, ptr @bills, align 4, !tbaa !5
%sub35 = sub nuw nsw i32 %v.tr79, %rem23.zext
br label %tailrecurse.backedge
if.else37: ; preds = %if.else16
%rem38 = urem i32 %v.tr79, 30
%cmp39 = icmp eq i32 %rem38, 0
br i1 %cmp39, label %if.then41, label %if.else46
if.then41: ; preds = %if.else37
%1 = mul i32 %v.tr79, 160
%mul43 = add i32 %1, -4800
%add44 = add nsw i32 %mul43, %add497578
store i32 %add44, ptr @bills, align 4, !tbaa !5
br label %tailrecurse.backedge
if.else46: ; preds = %if.else37
%mul48 = mul nuw nsw i32 %rem38, 160
%add49 = add nsw i32 %add497578, %mul48
%sub51 = sub nuw nsw i32 %v.tr79, %rem38
br label %tailrecurse.backedge
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int ans, w;
while (scanf("%d", &w), w != -1){
ans = 1150;
if (30 <= w) ans += (w - 30) * 160, w -= w - 30;
if (20 <= w) ans += (w - 20) * 140, w -= w - 20;
if (10 < w) ans += (w - 10) * 125;
printf("%d\n", 4280 - ans);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287875/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287875/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%0 = load i32, ptr %w, align 4, !tbaa !5
%cmp.not31 = icmp eq i32 %0, -1
br i1 %cmp.not31, label %while.end, label %while.body
while.body: ; preds = %entry, %4
%1 = phi i32 [ %6, %4 ], [ %0, %entry ]
%.fr = freeze i32 %1
%cmp1 = icmp sgt i32 %.fr, 29
br i1 %cmp1, label %if.end.thread, label %if.end
if.end.thread: ; preds = %while.body
%.neg = mul i32 %.fr, -160
%add.neg = add i32 %.neg, 3650
br label %if.end11.thread
if.end: ; preds = %while.body
%cmp4 = icmp sgt i32 %.fr, 19
br i1 %cmp4, label %if.end11.thread, label %if.end11
if.end11.thread: ; preds = %if.end, %if.end.thread
%ans.027.neg = phi i32 [ %add.neg, %if.end.thread ], [ -1150, %if.end ]
%2 = phi i32 [ 30, %if.end.thread ], [ %.fr, %if.end ]
%.neg28 = mul nsw i32 %2, -140
%mul7.neg = add i32 %ans.027.neg, 2800
%add8.neg = add i32 %mul7.neg, %.neg28
store i32 20, ptr %w, align 4, !tbaa !5
br label %3
if.end11: ; preds = %if.end
%cmp12 = icmp sgt i32 %.fr, 10
%.neg29 = mul i32 %.fr, -125
%mul15.neg = add i32 %.neg29, 1250
br i1 %cmp12, label %3, label %4
3: ; preds = %if.end11.thread, %if.end11
%mul15.neg39 = phi i32 [ -1250, %if.end11.thread ], [ %mul15.neg, %if.end11 ]
%ans.1.neg38 = phi i32 [ %add8.neg, %if.end11.thread ], [ -1150, %if.end11 ]
br label %4
4: ; preds = %if.end11, %3
%ans.1.neg37 = phi i32 [ %ans.1.neg38, %3 ], [ -1150, %if.end11 ]
%5 = phi i32 [ %mul15.neg39, %3 ], [ 0, %if.end11 ]
%ans.2.neg = add i32 %ans.1.neg37, 4280
%sub18 = add i32 %ans.2.neg, %5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub18)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp.not = icmp eq i32 %6, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %4, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void)
{
long long n,i,s=0,p;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&p);
s+=p;
}
printf("%lld\n",s/n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287925/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287925/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%p = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp5 = icmp sgt i64 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%s.07 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%i.06 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%1 = load i64, ptr %p, align 8, !tbaa !5
%add = add nsw i64 %1, %s.07
%inc = add nuw nsw i64 %i.06, 1
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%s.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]
%.lcssa = phi i64 [ %0, %entry ], [ %2, %for.body ]
%div = sdiv i64 %s.0.lcssa, %.lcssa
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
long i,n,k,j = 0;
scanf("%ld",&i);
for(j = 0;j < i;j++){
scanf("%ld",&n);
k=k+n;
}
printf("%ld\n",k / i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_287969/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_287969/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%i = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !5
%cmp5 = icmp sgt i64 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%j.07 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%k.06 = phi i64 [ %add, %for.body ], [ undef, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %1, %k.06
%inc = add nuw nsw i64 %j.07, 1
%2 = load i64, ptr %i, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%k.0.lcssa = phi i64 [ undef, %entry ], [ %add, %for.body ]
%.lcssa = phi i64 [ %0, %entry ], [ %2, %for.body ]
%div = sdiv i64 %k.0.lcssa, %.lcssa
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll power(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
//your code here!
int cmp(const void *a, const void *b){
ll A=*(ll *)a, B=*(ll *)b;
if(A==B)return 0;
else return A>B ? 1:-1;//昇順ソート 1,2,....9
}
int main(void){
ll N, score[1001], ans=0;
scanf("%lld", &N);
rep(i, N) {
scanf("%lld", score+i);
ans += score[i];
}
if(ans%10) printf("%lld\n", ans);
else {
ll is_score_0=1;
qsort(score, N, sizeof(ll), cmp);
rep(i, N) {
if(score[i]%10) {
is_score_0 = 0;
ans -= score[i];
break;
}
}
if(is_score_0) puts("0");
else printf("%lld\n", ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288018/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288018/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@.str.2 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @power(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
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 ]
%r.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
%r.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.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 %r.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 !5
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%r.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 %r.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 !7
}
; 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 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #2 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !9
%1 = load i64, ptr %b, align 8, !tbaa !9
%cmp = icmp eq i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = select i1 %cmp1, i32 1, i32 -1
%retval.0 = select i1 %cmp, i32 0, i32 %cond
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i64, align 8
%score = alloca [1001 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 8008, ptr nonnull %score) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !9
%cmp40 = icmp sgt i64 %0, 0
br i1 %cmp40, label %for.body, label %if.else
for.cond.cleanup: ; preds = %for.body
%rem = srem i64 %add, 10
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %if.else, label %if.then
for.body: ; preds = %entry, %for.body
%i.042 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%ans.041 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i64, ptr %score, i64 %i.042
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%1 = load i64, ptr %add.ptr, align 8, !tbaa !9
%add = add nsw i64 %1, %ans.041
%inc = add nuw nsw i64 %i.042, 1
%2 = load i64, ptr %N, align 8, !tbaa !9
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
if.then: ; preds = %for.cond.cleanup
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
br label %if.end23
if.else: ; preds = %entry, %for.cond.cleanup
%.lcssa3953 = phi i64 [ %2, %for.cond.cleanup ], [ %0, %entry ]
%ans.0.lcssa52 = phi i64 [ %add, %for.cond.cleanup ], [ 0, %entry ]
call void @qsort(ptr noundef nonnull %score, i64 noundef %.lcssa3953, i64 noundef 8, ptr noundef nonnull @cmp) #6
%3 = load i64, ptr %N, align 8, !tbaa !9
%cmp644 = icmp sgt i64 %3, 0
br i1 %cmp644, label %for.body8, label %if.then18
for.cond5: ; preds = %for.body8
%inc15 = add nuw nsw i64 %i4.045, 1
%exitcond.not = icmp eq i64 %inc15, %3
br i1 %exitcond.not, label %if.then18, label %for.body8, !llvm.loop !14
for.body8: ; preds = %if.else, %for.cond5
%i4.045 = phi i64 [ %inc15, %for.cond5 ], [ 0, %if.else ]
%arrayidx9 = getelementptr inbounds [1001 x i64], ptr %score, i64 0, i64 %i4.045
%4 = load i64, ptr %arrayidx9, align 8, !tbaa !9
%rem10 = srem i64 %4, 10
%tobool11.not = icmp eq i64 %rem10, 0
br i1 %tobool11.not, label %for.cond5, label %if.else20
if.then18: ; preds = %for.cond5, %if.else
%call19 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end23
if.else20: ; preds = %for.body8
%sub = sub nsw i64 %ans.0.lcssa52, %4
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
br label %if.end23
if.end23: ; preds = %if.then18, %if.else20, %if.then
call void @llvm.lifetime.end.p0(i64 8008, ptr nonnull %score) #6
call void @llvm.lifetime.end.p0(i64 8, 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: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 = { 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"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.unroll.disable"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.mustprogress"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = distinct !{!13, !8}
!14 = distinct !{!14, !8}
|
#include <stdio.h>
int main()
{
int n,i;
int x = 0;
int min = 100;
int s[100] = {};
scanf("%d", &n);
for(i=0; i<n; i++)
{
scanf("%d", &s[i]);
x = x + s[i];
if(s[i] % 10 != 0)
{
if(min > s[i])
{
min = s[i];
}
}
}
if(x % 10 != 0)
{
printf("%d", x);
}
else if(min % 10 != 0)
{
printf("%d", x-min);
}
else
{
printf("0");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288061/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288061/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %s) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %s, i8 0, i64 400, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body, label %if.else22
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%min.040 = phi i32 [ %min.1, %for.body ], [ 100, %entry ]
%x.039 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %1, %x.039
%rem = srem i32 %1, 10
%cmp6.not = icmp ne i32 %rem, 0
%cmp9 = icmp sgt i32 %min.040, %1
%or.cond = select i1 %cmp6.not, i1 %cmp9, i1 false
%min.1 = select i1 %or.cond, i32 %1, i32 %min.040
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%rem14 = srem i32 %add, 10
%cmp15.not = icmp eq i32 %rem14, 0
br i1 %cmp15.not, label %if.else, label %if.then16
if.then16: ; preds = %for.end
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
br label %if.end25
if.else: ; preds = %for.end
%rem18 = srem i32 %min.1, 10
%cmp19.not = icmp eq i32 %rem18, 0
br i1 %cmp19.not, label %if.else22, label %if.then20
if.then20: ; preds = %if.else
%sub = sub nsw i32 %add, %min.1
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
br label %if.end25
if.else22: ; preds = %entry, %if.else
%putchar = call i32 @putchar(i32 48)
br label %if.end25
if.end25: ; preds = %if.then20, %if.else22, %if.then16
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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: 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main( void )
{
int N ;
while( 1 )
{
scanf( "%d" ,&N ) ;
if( N == 0 )
{
return 0 ;
}
int begin[ 10000 + 2 ] = { 0 } ;
int p = 0 ;
int maxy = 0 ;
char RBY[ 10000 + 2 ] = { 0 } ;
char color[ 10000 + 2 ] = { 0 } ;
color[ 0 ] = 4 ;
int rby[ 10000 + 2 ] = { 0 } ;
int i ,j ;
for( i = 1 ; i <= N ; ++i )
{
scanf( "%*c%c" ,color + i ) ;
}
for( i = 1 ; i <= N ; ++i )
{
if( color[ i ] == color[ i - 1 ] || color[ i ] == color[ i + 1 ] )
{
if( color[ i ] != RBY[ p ] )
{
++p ;
}
++rby[ p ] ;
}
else
{
++p ;
if( rby[ p ] == 0 )
{
rby[ p ] = 1 ;
}
begin[ p ] = i ;
}
RBY[ p ] = color[ i ] ;
}
for( i = 1 ; i <= p ; ++i )
{
int next ;
int prev ;
int kale = 0 ;
if( rby[ i ] == 1 && i != 1 && i != p )
{
for( j = 1 ; ; ++j )
{
next = i + j ;
prev = i - j ;
if( prev < 1 || next > p )
{
break ;
}
if( RBY[ prev ] == RBY[ next ] && rby[ prev ] + rby[ next ] > 3 )
{
kale += rby[ prev ] + rby[ next ] ; }
else if( kale > 0 )
{
maxy = maxy < kale + rby[ i ] ? kale + rby[ i ] : maxy ;
break ;
}
}
}
else if( rby[ i ] > 2 )
{
if( i == 1 || i == p )
{
maxy = maxy < rby[ i ] + 1 ? rby[ i ] + 1 : maxy ;
}
else
{
prev = i - 1 ;
next = i + 1 ;
for( j = 1 ; ; ++j )
{
if( j == 1 )
{
if( RBY[ prev ] == RBY[ next ] && rby[ prev ] + rby[ next ] > 3 )
{
kale += rby[ i ] + rby[ prev ] + rby[ next ] ;
++next ;
--prev ;
}
else
{
break ;
}
}
else if( RBY[ prev ] == RBY[ next ] && rby[ prev ] + rby[ next ] > 3 )
{
kale += rby[ prev ] + rby[ next ] ;
++next ;
--prev ;
}
else
{
maxy = maxy < kale ? kale : maxy ;
break ;
}
}
}
}
}
printf( "%d\n" ,N - maxy ) ;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288104/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288104/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%*c%c\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
%RBY = alloca [10002 x i8], align 16
%color = alloca [10002 x i8], align 16
%rby = alloca [10002 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call329 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp330 = icmp eq i32 %0, 0
br i1 %cmp330, label %if.then, label %if.end
if.then: ; preds = %for.end221, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
if.end: ; preds = %entry, %for.end221
%1 = phi i32 [ %30, %for.end221 ], [ %0, %entry ]
call void @llvm.lifetime.start.p0(i64 10002, ptr nonnull %RBY) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10002) %RBY, i8 0, i64 10002, i1 false)
call void @llvm.lifetime.start.p0(i64 10002, ptr nonnull %color) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10002) %color, i8 0, i64 10002, i1 false)
store i8 4, ptr %color, align 16, !tbaa !9
call void @llvm.lifetime.start.p0(i64 40008, ptr nonnull %rby) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40008) %rby, i8 0, i64 40008, i1 false)
%cmp1.not309 = icmp slt i32 %1, 1
br i1 %cmp1.not309, label %for.end221, label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp4.not311 = icmp slt i32 %3, 1
br i1 %cmp4.not311, label %for.end221, label %for.body5.preheader
for.body5.preheader: ; preds = %for.cond3.preheader
%2 = add nuw i32 %3, 1
%wide.trip.count = zext i32 %2 to i64
%.pre = load i8, ptr %color, align 16, !tbaa !9
br label %for.body5
for.body: ; preds = %if.end, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %if.end ]
%add.ptr = getelementptr inbounds i8, ptr %color, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp1.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp1.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !10
for.cond54.preheader: ; preds = %if.end46
%cmp55.not324 = icmp slt i32 %p.2, 1
br i1 %cmp55.not324, label %for.end221, label %for.body57.preheader
for.body57.preheader: ; preds = %for.cond54.preheader
%5 = zext i32 %p.2 to i64
%6 = zext i32 %p.2 to i64
br label %for.body57
for.body5: ; preds = %for.body5.preheader, %if.end46
%7 = phi i8 [ 0, %for.body5.preheader ], [ %9, %if.end46 ]
%8 = phi i8 [ %.pre, %for.body5.preheader ], [ %9, %if.end46 ]
%indvars.iv336 = phi i64 [ 1, %for.body5.preheader ], [ %.pre372, %if.end46 ]
%p.0312 = phi i32 [ 0, %for.body5.preheader ], [ %p.2, %if.end46 ]
%arrayidx6 = getelementptr inbounds [10002 x i8], ptr %color, i64 0, i64 %indvars.iv336
%9 = load i8, ptr %arrayidx6, align 1, !tbaa !9
%cmp10 = icmp eq i8 %9, %8
%.pre372 = add nuw nsw i64 %indvars.iv336, 1
br i1 %cmp10, label %if.then20, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body5
%idxprom15 = and i64 %.pre372, 4294967295
%arrayidx16 = getelementptr inbounds [10002 x i8], ptr %color, i64 0, i64 %idxprom15
%10 = load i8, ptr %arrayidx16, align 1, !tbaa !9
%cmp18 = icmp eq i8 %9, %10
br i1 %cmp18, label %if.then20, label %if.else
if.then20: ; preds = %for.body5, %lor.lhs.false
%cmp27.not = icmp ne i8 %9, %7
%inc30 = zext i1 %cmp27.not to i32
%spec.select = add nsw i32 %p.0312, %inc30
%idxprom32 = sext i32 %spec.select to i64
%arrayidx33 = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %idxprom32
%11 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%inc34 = add nsw i32 %11, 1
store i32 %inc34, ptr %arrayidx33, align 4, !tbaa !5
br label %if.end46
if.else: ; preds = %lor.lhs.false
%inc35 = add nsw i32 %p.0312, 1
%idxprom36 = sext i32 %inc35 to i64
%arrayidx37 = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %idxprom36
%12 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%spec.store.select = call i32 @llvm.umax.i32(i32 %12, i32 1)
store i32 %spec.store.select, ptr %arrayidx37, align 4
br label %if.end46
if.end46: ; preds = %if.else, %if.then20
%idxprom49.pre-phi = phi i64 [ %idxprom36, %if.else ], [ %idxprom32, %if.then20 ]
%p.2 = phi i32 [ %inc35, %if.else ], [ %spec.select, %if.then20 ]
%arrayidx50 = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %idxprom49.pre-phi
store i8 %9, ptr %arrayidx50, align 1, !tbaa !9
%exitcond.not = icmp eq i64 %.pre372, %wide.trip.count
br i1 %exitcond.not, label %for.cond54.preheader, label %for.body5, !llvm.loop !12
for.body57: ; preds = %for.body57.preheader, %if.end218
%indvars.iv358 = phi i64 [ 1, %for.body57.preheader ], [ %indvars.iv.next359, %if.end218 ]
%indvars.iv345 = phi i64 [ 2, %for.body57.preheader ], [ %indvars.iv.next346, %if.end218 ]
%indvars.iv341 = phi i64 [ 0, %for.body57.preheader ], [ %indvars.iv.next342, %if.end218 ]
%maxy.0325 = phi i32 [ 0, %for.body57.preheader ], [ %maxy.1, %if.end218 ]
%arrayidx59 = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %indvars.iv358
%13 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%cmp60 = icmp ne i32 %13, 1
%cmp62 = icmp eq i64 %indvars.iv358, 1
%or.cond.not305 = or i1 %cmp62, %cmp60
%cmp65.not = icmp eq i64 %indvars.iv358, %5
%or.cond302 = or i1 %cmp65.not, %or.cond.not305
br i1 %or.cond302, label %if.else118, label %for.cond68.preheader
for.cond68.preheader: ; preds = %for.body57
%cmp74318.not = icmp ult i64 %indvars.iv358, %6
br i1 %cmp74318.not, label %if.end77, label %if.end218
if.end77: ; preds = %for.cond68.preheader, %for.inc115
%indvars.iv349 = phi i64 [ %indvars.iv.next350, %for.inc115 ], [ 1, %for.cond68.preheader ]
%indvars.iv347 = phi i64 [ %indvars.iv.next348, %for.inc115 ], [ %indvars.iv345, %for.cond68.preheader ]
%indvars.iv343 = phi i64 [ %indvars.iv.next344, %for.inc115 ], [ %indvars.iv341, %for.cond68.preheader ]
%kale.0321 = phi i32 [ %kale.1, %for.inc115 ], [ 0, %for.cond68.preheader ]
%arrayidx79 = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %indvars.iv343
%14 = load i8, ptr %arrayidx79, align 1, !tbaa !9
%arrayidx82 = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %indvars.iv347
%15 = load i8, ptr %arrayidx82, align 1, !tbaa !9
%cmp84 = icmp eq i8 %14, %15
br i1 %cmp84, label %land.lhs.true86, label %if.else101
land.lhs.true86: ; preds = %if.end77
%arrayidx88 = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %indvars.iv343
%16 = load i32, ptr %arrayidx88, align 4, !tbaa !5
%arrayidx90 = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %indvars.iv347
%17 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%add91 = add nsw i32 %17, %16
%cmp92 = icmp sgt i32 %add91, 3
br i1 %cmp92, label %if.then94, label %if.else101
if.then94: ; preds = %land.lhs.true86
%add100 = add nsw i32 %add91, %kale.0321
br label %for.inc115
if.else101: ; preds = %land.lhs.true86, %if.end77
%cmp102 = icmp sgt i32 %kale.0321, 0
br i1 %cmp102, label %if.then104, label %for.inc115
if.then104: ; preds = %if.else101
%add107 = add nuw nsw i32 %kale.0321, 1
%add107.maxy.0 = call i32 @llvm.smax.i32(i32 %maxy.0325, i32 %add107)
br label %if.end218
for.inc115: ; preds = %if.then94, %if.else101
%kale.1 = phi i32 [ %add100, %if.then94 ], [ %kale.0321, %if.else101 ]
%indvars.iv.next350 = add nuw nsw i64 %indvars.iv349, 1
%18 = add nuw nsw i64 %indvars.iv.next350, %indvars.iv358
%indvars.iv.next348 = add nuw nsw i64 %indvars.iv347, 1
%indvars.iv.next344 = add nsw i64 %indvars.iv343, -1
%cmp71 = icmp ule i64 %indvars.iv358, %indvars.iv.next350
%19 = trunc i64 %18 to i32
%cmp74 = icmp slt i32 %p.2, %19
%or.cond303 = select i1 %cmp71, i1 true, i1 %cmp74
br i1 %or.cond303, label %if.end218, label %if.end77
if.else118: ; preds = %for.body57
%cmp121 = icmp sgt i32 %13, 2
br i1 %cmp121, label %if.then123, label %if.end218
if.then123: ; preds = %if.else118
%or.cond304 = or i1 %cmp62, %cmp65.not
br i1 %or.cond304, label %if.then129, label %if.then148.peel
if.then148.peel: ; preds = %if.then123
%indvars.iv.next363.peel = add nsw i64 %indvars.iv358, -1
%indvars.iv.next361.peel = add nuw nsw i64 %indvars.iv358, 1
%arrayidx150.peel = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %indvars.iv.next363.peel
%20 = load i8, ptr %arrayidx150.peel, align 1, !tbaa !9
%arrayidx153.peel = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %indvars.iv.next361.peel
%21 = load i8, ptr %arrayidx153.peel, align 1, !tbaa !9
%cmp155.peel = icmp eq i8 %20, %21
br i1 %cmp155.peel, label %land.lhs.true157.peel, label %if.end218
land.lhs.true157.peel: ; preds = %if.then148.peel
%arrayidx159.peel = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %indvars.iv.next363.peel
%22 = load i32, ptr %arrayidx159.peel, align 4, !tbaa !5
%arrayidx161.peel = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %indvars.iv.next361.peel
%23 = load i32, ptr %arrayidx161.peel, align 4, !tbaa !5
%add162.peel = add i32 %23, %22
%cmp163.peel = icmp sgt i32 %add162.peel, 3
br i1 %cmp163.peel, label %for.inc213.peel, label %if.end218
for.inc213.peel: ; preds = %land.lhs.true157.peel
%add173.peel = add nuw i32 %add162.peel, %13
%indvars.iv.next363382 = add nsw i64 %indvars.iv358, -2
%indvars.iv.next361383 = add nuw i64 %indvars.iv358, 2
%arrayidx180384 = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %indvars.iv.next363382
%24 = load i8, ptr %arrayidx180384, align 1, !tbaa !9
%arrayidx183385 = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %indvars.iv.next361383
%25 = load i8, ptr %arrayidx183385, align 1, !tbaa !9
%cmp185386 = icmp eq i8 %24, %25
br i1 %cmp185386, label %land.lhs.true187, label %if.else204
if.then129: ; preds = %if.then123
%cmp133.not = icmp sgt i32 %maxy.0325, %13
%add132 = add nuw nsw i32 %13, 1
%cond141 = select i1 %cmp133.not, i32 %maxy.0325, i32 %add132
br label %if.end218
if.else178: ; preds = %land.lhs.true187
%kale.3 = add nsw i32 %add192, %kale.2387
%indvars.iv.next363 = add i64 %indvars.iv.next363388, -1
%indvars.iv.next361 = add nuw i64 %indvars.iv.next361389, 1
%arrayidx180 = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %indvars.iv.next363
%26 = load i8, ptr %arrayidx180, align 1, !tbaa !9
%arrayidx183 = getelementptr inbounds [10002 x i8], ptr %RBY, i64 0, i64 %indvars.iv.next361
%27 = load i8, ptr %arrayidx183, align 1, !tbaa !9
%cmp185 = icmp eq i8 %26, %27
br i1 %cmp185, label %land.lhs.true187, label %if.else204, !llvm.loop !13
land.lhs.true187: ; preds = %for.inc213.peel, %if.else178
%indvars.iv.next361389 = phi i64 [ %indvars.iv.next361, %if.else178 ], [ %indvars.iv.next361383, %for.inc213.peel ]
%indvars.iv.next363388 = phi i64 [ %indvars.iv.next363, %if.else178 ], [ %indvars.iv.next363382, %for.inc213.peel ]
%kale.2387 = phi i32 [ %kale.3, %if.else178 ], [ %add173.peel, %for.inc213.peel ]
%arrayidx189 = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %indvars.iv.next363388
%28 = load i32, ptr %arrayidx189, align 4, !tbaa !5
%arrayidx191 = getelementptr inbounds [10002 x i32], ptr %rby, i64 0, i64 %indvars.iv.next361389
%29 = load i32, ptr %arrayidx191, align 4, !tbaa !5
%add192 = add nsw i32 %29, %28
%cmp193 = icmp sgt i32 %add192, 3
br i1 %cmp193, label %if.else178, label %if.else204
if.else204: ; preds = %if.else178, %land.lhs.true187, %for.inc213.peel
%kale.2.lcssa = phi i32 [ %add173.peel, %for.inc213.peel ], [ %kale.3, %if.else178 ], [ %kale.2387, %land.lhs.true187 ]
%cond210 = call i32 @llvm.smax.i32(i32 %maxy.0325, i32 %kale.2.lcssa)
br label %if.end218
if.end218: ; preds = %for.inc115, %if.then148.peel, %land.lhs.true157.peel, %for.cond68.preheader, %if.else118, %if.else204, %if.then129, %if.then104
%maxy.1 = phi i32 [ %add107.maxy.0, %if.then104 ], [ %cond141, %if.then129 ], [ %cond210, %if.else204 ], [ %maxy.0325, %if.else118 ], [ %maxy.0325, %for.cond68.preheader ], [ %maxy.0325, %land.lhs.true157.peel ], [ %maxy.0325, %if.then148.peel ], [ %maxy.0325, %for.inc115 ]
%indvars.iv.next359 = add nuw nsw i64 %indvars.iv358, 1
%indvars.iv.next342 = add nuw nsw i64 %indvars.iv341, 1
%indvars.iv.next346 = add nuw nsw i64 %indvars.iv345, 1
%exitcond370.not = icmp eq i64 %indvars.iv.next342, %5
br i1 %exitcond370.not, label %for.end221, label %for.body57, !llvm.loop !15
for.end221: ; preds = %if.end218, %if.end, %for.cond3.preheader, %for.cond54.preheader
%.lcssa375379 = phi i32 [ %3, %for.cond54.preheader ], [ %3, %for.cond3.preheader ], [ %1, %if.end ], [ %3, %if.end218 ]
%maxy.0.lcssa = phi i32 [ 0, %for.cond54.preheader ], [ 0, %for.cond3.preheader ], [ 0, %if.end ], [ %maxy.1, %if.end218 ]
%sub222 = sub nsw i32 %.lcssa375379, %maxy.0.lcssa
%call223 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub222)
call void @llvm.lifetime.end.p0(i64 40008, ptr nonnull %rby) #5
call void @llvm.lifetime.end.p0(i64 10002, ptr nonnull %color) #5
call void @llvm.lifetime.end.p0(i64 10002, ptr nonnull %RBY) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%30 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp eq i32 %30, 0
br i1 %cmp, label %if.then, label %if.end
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !11}
|
#include <stdio.h>
int wa[100010];
int main(){
int n,m;
scanf("%d%d",&n,&m);
int ac=0,pena=0;
for(int i=0;i<m;i++){
int p;
char s[9];
scanf("%d%s",&p,s);
if(wa[p]!=-1){
if(s[0]=='A'){
ac++;
pena+=wa[p];
wa[p]=-1;
}else{
wa[p]++;
}
}
}
printf("%d %d",ac,pena);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288155/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288155/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%d%s\00", align 1
@wa = dso_local local_unnamed_addr global [100010 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%p = alloca i32, align 4
%s = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end14, %entry
%ac.0.lcssa = phi i32 [ 0, %entry ], [ %ac.1, %if.end14 ]
%pena.0.lcssa = phi i32 [ 0, %entry ], [ %pena.1, %if.end14 ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ac.0.lcssa, i32 noundef %pena.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %entry, %if.end14
%i.023 = phi i32 [ %inc15, %if.end14 ], [ 0, %entry ]
%pena.022 = phi i32 [ %pena.1, %if.end14 ], [ 0, %entry ]
%ac.021 = phi i32 [ %ac.1, %if.end14 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %s) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %p, ptr noundef nonnull %s)
%1 = load i32, ptr %p, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [100010 x i32], ptr @wa, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp2.not = icmp eq i32 %2, -1
br i1 %cmp2.not, label %if.end14, label %if.then
if.then: ; preds = %for.body
%3 = load i8, ptr %s, align 1, !tbaa !9
%cmp4 = icmp eq i8 %3, 65
%inc13 = add nuw nsw i32 %2, 1
%.sink = select i1 %cmp4, i32 -1, i32 %inc13
%inc = zext i1 %cmp4 to i32
%ac.1.ph = add nsw i32 %ac.021, %inc
%add = select i1 %cmp4, i32 %2, i32 0
%pena.1.ph = add nsw i32 %pena.022, %add
store i32 %.sink, ptr %arrayidx, align 4, !tbaa !5
br label %if.end14
if.end14: ; preds = %if.then, %for.body
%ac.1 = phi i32 [ %ac.021, %for.body ], [ %ac.1.ph, %if.then ]
%pena.1 = phi i32 [ %pena.022, %for.body ], [ %pena.1.ph, %if.then ]
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #3
%inc15 = add nuw nsw i32 %i.023, 1
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc15, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !10
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int n,m,p,c[100000]={},f[100000]={},i,a=0,b=0;
char s[3];
int main(){
scanf("%d%d",&n,&m);
for(i=0;i<m;i++){
scanf("%d%s",&p,s);
if(f[p]==1)continue;
if(!strcmp(s,"AC")){
a++;
f[p]=1;
b+=c[p];
if(a==n)break;
}
else c[p]++;
}
printf("%d %d",a,b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288199/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288199/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@a = dso_local local_unnamed_addr global i32 0, align 4
@b = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@n = dso_local global i32 0, align 4
@m = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%s\00", align 1
@p = dso_local global i32 0, align 4
@s = dso_local global [3 x i8] zeroinitializer, align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
@.str.3 = 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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
store i32 0, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @m, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @p, ptr noundef nonnull @s)
%1 = load i32, ptr @p, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @f, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp2 = icmp eq i32 %2, 1
br i1 %cmp2, label %for.inc, label %if.end
if.end: ; preds = %for.body
%bcmp = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(3) @s, ptr noundef nonnull dereferenceable(3) @.str.2, i64 3)
%tobool.not = icmp eq i32 %bcmp, 0
br i1 %tobool.not, label %if.then4, label %if.else
if.then4: ; preds = %if.end
%3 = load i32, ptr @a, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr @a, align 4, !tbaa !5
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr @c, i64 0, i64 %idxprom
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%5 = load i32, ptr @b, align 4, !tbaa !5
%add = add nsw i32 %5, %4
store i32 %add, ptr @b, align 4, !tbaa !5
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp9 = icmp eq i32 %inc, %6
br i1 %cmp9, label %for.end, label %for.inc
if.else: ; preds = %if.end
%arrayidx13 = getelementptr inbounds [100000 x i32], ptr @c, i64 0, i64 %idxprom
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%inc14 = add nsw i32 %7, 1
store i32 %inc14, ptr %arrayidx13, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.else, %if.then4, %for.body
%8 = load i32, ptr @i, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @i, align 4, !tbaa !5
%9 = load i32, ptr @m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc16, %9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %if.then4, %entry
%10 = load i32, ptr @a, align 4, !tbaa !5
%11 = load i32, ptr @b, align 4, !tbaa !5
%call17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10, i32 noundef %11)
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 willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) 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 willreturn memory(argmem: 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"}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
int i, N, M;
scanf("%d %d", &N, &M);
int p[M];
char str[M][2];
int error[N + 1];
int judge[N + 1];
int c1 = 0;
int c2 = 0;
for (i = 0; i <= N; i++)
{
error[i] = 0;
judge[i] = 0;
}
for (i = 0; i < M; i++)
{
scanf("%d %s", &p[i], str[i]);
if (strcmp(str[i], "WA") == 0 && judge[p[i]] == 0)
{
error[p[i]] += 1;
}
else if (strcmp(str[i], "AC") == 0 && judge[p[i]] == 0)
{
c1 += 1;
c2 += error[p[i]];
judge[p[i]] += 1;
}
}
printf("%d %d\n", c1, c2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_288249/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_288249/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"WA\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = 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 = 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 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %M, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca [2 x i8], i64 %4, align 16
%5 = load i32, ptr %N, align 4, !tbaa !5
%add = add i32 %5, 1
%6 = zext i32 %add to i64
%vla2 = alloca i32, i64 %6, align 16
%vla4 = alloca i32, i64 %6, align 16
%cmp.not74 = icmp slt i32 %5, 0
br i1 %cmp.not74, label %for.cond7.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%7 = shl nuw nsw i64 %6, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla2, i8 0, i64 %7, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla4, i8 0, i64 %7, i1 false), !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp876 = icmp sgt i32 %3, 0
br i1 %cmp876, label %for.body9, label %for.end56
for.body9: ; preds = %for.cond7.preheader, %for.inc54
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc54 ], [ 0, %for.cond7.preheader ]
%c2.079 = phi i32 [ %c2.1, %for.inc54 ], [ 0, %for.cond7.preheader ]
%c1.078 = phi i32 [ %c1.1, %for.inc54 ], [ 0, %for.cond7.preheader ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx13 = getelementptr inbounds [2 x i8], ptr %vla1, i64 %indvars.iv
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11, ptr noundef nonnull %arrayidx13)
%call18 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx13, ptr noundef nonnull dereferenceable(3) @.str.2) #7
%cmp19 = icmp eq i32 %call18, 0
br i1 %cmp19, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %for.body9
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%idxprom22 = sext i32 %8 to i64
%arrayidx23 = getelementptr inbounds i32, ptr %vla4, i64 %idxprom22
%9 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp eq i32 %9, 0
br i1 %cmp24, label %if.then, label %if.else
if.then: ; preds = %land.lhs.true
%arrayidx28 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom22
%10 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%add29 = add nsw i32 %10, 1
store i32 %add29, ptr %arrayidx28, align 4, !tbaa !5
br label %for.inc54
if.else: ; preds = %land.lhs.true, %for.body9
%call33 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx13, ptr noundef nonnull dereferenceable(3) @.str.3) #7
%cmp34 = icmp eq i32 %call33, 0
br i1 %cmp34, label %land.lhs.true35, label %for.inc54
land.lhs.true35: ; preds = %if.else
%11 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%idxprom38 = sext i32 %11 to i64
%arrayidx39 = getelementptr inbounds i32, ptr %vla4, i64 %idxprom38
%12 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp40 = icmp eq i32 %12, 0
br i1 %cmp40, label %if.then41, label %for.inc54
if.then41: ; preds = %land.lhs.true35
%add42 = add nsw i32 %c1.078, 1
%arrayidx46 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom38
%13 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%add47 = add nsw i32 %13, %c2.079
store i32 1, ptr %arrayidx39, align 4, !tbaa !5
br label %for.inc54
for.inc54: ; preds = %if.then, %if.then41, %land.lhs.true35, %if.else
%c1.1 = phi i32 [ %c1.078, %if.then ], [ %add42, %if.then41 ], [ %c1.078, %land.lhs.true35 ], [ %c1.078, %if.else ]
%c2.1 = phi i32 [ %c2.079, %if.then ], [ %add47, %if.then41 ], [ %c2.079, %land.lhs.true35 ], [ %c2.079, %if.else ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%14 = load i32, ptr %M, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp8 = icmp slt i64 %indvars.iv.next, %15
br i1 %cmp8, label %for.body9, label %for.end56, !llvm.loop !9
for.end56: ; preds = %for.inc54, %for.cond7.preheader
%c1.0.lcssa = phi i32 [ 0, %for.cond7.preheader ], [ %c1.1, %for.inc54 ]
%c2.0.lcssa = phi i32 [ 0, %for.cond7.preheader ], [ %c2.1, %for.inc54 ]
%call57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %c1.0.lcssa, i32 noundef %c2.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 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
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree 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 = { 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 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int S, D, L ;
scanf("%d %d %d", &S, &D, &L) ;
printf("%d\n", ((S - D) * L + D - 1) / D) ;
return 0 ;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2883/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2883/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
%D = alloca i32, align 4
%L = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %D, ptr noundef nonnull %L)
%0 = load i32, ptr %S, align 4, !tbaa !5
%1 = load i32, ptr %D, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %L, align 4, !tbaa !5
%mul = mul nsw i32 %sub, %2
%add = add i32 %1, -1
%sub1 = add i32 %add, %mul
%div = sdiv i32 %sub1, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #3
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"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.