Source_Code
stringlengths 69
484k
| IR_Original
stringlengths 2.05k
17.9M
|
---|---|
#include <stdio.h>
int A[102];
char C(int v)
{
int t;
char r;
for (t = 2; t * t <= v; t++)
{
if (v % t == 0)
{
break;
}
}
if (t * t <= v)
{
r = 1;
}
else
{
r = 0;
}
return r;
}
int main()
{
int i;
int T;
int t;
int n;
int c;
int V;
scanf("%d", &T);
while (T--)
{
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
scanf("%d", &A[i]);
}
V = 0;
for (i = 1; i <= n; i++)
{
V += A[i];
}
if (C(V))
{
printf("%d\n", n);
for (t = 1; t <= n; t++)
{
printf("%d ", t);
}
printf("\n");
}
else
{
c = 0;
for (t = 1; t <= n; t++)
{
if (A[t] & 1)
{
c++;
}
}
printf("%d\n", n - 1);
for (t = 1; t <= n; t++)
{
if (c <= 1)
{
break;
}
if (A[t] & 1)
{
printf("%d ", t);
c--;
}
}
for (t = 1; t <= n; t++)
{
if (A[t] % 2 == 0)
{
printf("%d ", t);
}
}
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_0/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_0/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@A = dso_local global [102 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local signext i8 @C(i32 noundef %v) local_unnamed_addr #0 {
entry:
%cmp.not13 = icmp sgt i32 %v, 3
br i1 %cmp.not13, label %for.body, label %for.end
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %t.014, 1
%mul = mul nsw i32 %inc, %inc
%cmp.not.not = icmp sgt i32 %mul, %v
br i1 %cmp.not.not, label %for.end.loopexit, label %for.body, !llvm.loop !5
for.body: ; preds = %entry, %for.cond
%t.014 = phi i32 [ %inc, %for.cond ], [ 2, %entry ]
%rem = srem i32 %v, %t.014
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.end.loopexit, label %for.cond
for.end.loopexit: ; preds = %for.body, %for.cond
%0 = zext i1 %cmp1 to i8
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%cmp.not.lcssa = phi i8 [ 0, %entry ], [ %0, %for.end.loopexit ]
ret i8 %cmp.not.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%T = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%0 = load i32, ptr %T, align 4, !tbaa !7
%dec106 = add nsw i32 %0, -1
store i32 %dec106, ptr %T, align 4, !tbaa !7
%tobool.not107 = icmp eq i32 %0, 0
br i1 %tobool.not107, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end64
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !7
%cmp.not87 = icmp slt i32 %1, 1
br i1 %cmp.not87, label %for.end32, label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp4.not89 = icmp slt i32 %10, 1
br i1 %cmp4.not89, label %for.end32, label %for.body5.preheader
for.body5.preheader: ; preds = %for.cond3.preheader
%2 = add nuw i32 %10, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%min.iters.check154 = icmp ult i32 %10, 8
br i1 %min.iters.check154, label %for.body5.preheader173, label %vector.ph155
vector.ph155: ; preds = %for.body5.preheader
%n.vec157 = and i64 %3, -8
%ind.end158 = or i64 %n.vec157, 1
br label %vector.body161
vector.body161: ; preds = %vector.body161, %vector.ph155
%index162 = phi i64 [ 0, %vector.ph155 ], [ %index.next168, %vector.body161 ]
%vec.phi163 = phi <4 x i32> [ zeroinitializer, %vector.ph155 ], [ %6, %vector.body161 ]
%vec.phi164 = phi <4 x i32> [ zeroinitializer, %vector.ph155 ], [ %7, %vector.body161 ]
%offset.idx165 = or i64 %index162, 1
%4 = getelementptr inbounds [102 x i32], ptr @A, i64 0, i64 %offset.idx165
%wide.load166 = load <4 x i32>, ptr %4, align 4, !tbaa !7
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load167 = load <4 x i32>, ptr %5, align 4, !tbaa !7
%6 = add <4 x i32> %wide.load166, %vec.phi163
%7 = add <4 x i32> %wide.load167, %vec.phi164
%index.next168 = add nuw i64 %index162, 8
%8 = icmp eq i64 %index.next168, %n.vec157
br i1 %8, label %middle.block152, label %vector.body161, !llvm.loop !11
middle.block152: ; preds = %vector.body161
%bin.rdx169 = add <4 x i32> %7, %6
%9 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx169)
%cmp.n160 = icmp eq i64 %3, %n.vec157
br i1 %cmp.n160, label %for.end10, label %for.body5.preheader173
for.body5.preheader173: ; preds = %for.body5.preheader, %middle.block152
%indvars.iv110.ph = phi i64 [ 1, %for.body5.preheader ], [ %ind.end158, %middle.block152 ]
%V.091.ph = phi i32 [ 0, %for.body5.preheader ], [ %9, %middle.block152 ]
br label %for.body5
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %while.body ]
%arrayidx = getelementptr inbounds [102 x i32], ptr @A, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %n, align 4, !tbaa !7
%11 = sext i32 %10 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %11
br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !14
for.body5: ; preds = %for.body5.preheader173, %for.body5
%indvars.iv110 = phi i64 [ %indvars.iv.next111, %for.body5 ], [ %indvars.iv110.ph, %for.body5.preheader173 ]
%V.091 = phi i32 [ %add, %for.body5 ], [ %V.091.ph, %for.body5.preheader173 ]
%arrayidx7 = getelementptr inbounds [102 x i32], ptr @A, i64 0, i64 %indvars.iv110
%12 = load i32, ptr %arrayidx7, align 4, !tbaa !7
%add = add nsw i32 %12, %V.091
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%exitcond.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count
br i1 %exitcond.not, label %for.end10, label %for.body5, !llvm.loop !15
for.end10: ; preds = %for.body5, %middle.block152
%add.lcssa = phi i32 [ %9, %middle.block152 ], [ %add, %for.body5 ]
%cmp.not13.i = icmp sgt i32 %add.lcssa, 3
br i1 %cmp.not13.i, label %for.body.i, label %C.exit.thread
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %t.014.i, 1
%mul.i = mul nsw i32 %inc.i, %inc.i
%cmp.not.not.i = icmp sgt i32 %mul.i, %add.lcssa
br i1 %cmp.not.not.i, label %for.cond22.preheader, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.end10, %for.cond.i
%t.014.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.end10 ]
%rem.i = srem i32 %add.lcssa, %t.014.i
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %if.then, label %for.cond.i
C.exit.thread: ; preds = %for.end10
br i1 %cmp4.not89, label %for.end32, label %for.body24.preheader
for.cond22.preheader: ; preds = %for.cond.i
br i1 %cmp4.not89, label %for.end32, label %for.body24.preheader
for.body24.preheader: ; preds = %C.exit.thread, %for.cond22.preheader
%13 = add i32 %10, 1
%wide.trip.count116 = zext i32 %13 to i64
%14 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %10, 8
br i1 %min.iters.check, label %for.body24.preheader172, label %vector.ph
vector.ph: ; preds = %for.body24.preheader
%n.vec = and i64 %14, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%vec.phi150 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
%offset.idx = or i64 %index, 1
%15 = getelementptr inbounds [102 x i32], ptr @A, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %15, align 4, !tbaa !7
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load151 = load <4 x i32>, ptr %16, align 4, !tbaa !7
%17 = and <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%18 = and <4 x i32> %wide.load151, <i32 1, i32 1, i32 1, i32 1>
%19 = add <4 x i32> %17, %vec.phi
%20 = add <4 x i32> %18, %vec.phi150
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %20, %19
%22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %14, %n.vec
br i1 %cmp.n, label %for.end32, label %for.body24.preheader172
for.body24.preheader172: ; preds = %for.body24.preheader, %middle.block
%indvars.iv113.ph = phi i64 [ 1, %for.body24.preheader ], [ %ind.end, %middle.block ]
%c.097.ph = phi i32 [ 0, %for.body24.preheader ], [ %22, %middle.block ]
br label %for.body24
if.then: ; preds = %for.body.i
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
%23 = load i32, ptr %n, align 4, !tbaa !7
%cmp15.not93 = icmp slt i32 %23, 1
br i1 %cmp15.not93, label %if.end64, label %for.body16
for.body16: ; preds = %if.then, %for.body16
%t.094 = phi i32 [ %inc19, %for.body16 ], [ 1, %if.then ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %t.094)
%inc19 = add nuw nsw i32 %t.094, 1
%24 = load i32, ptr %n, align 4, !tbaa !7
%cmp15.not.not = icmp slt i32 %t.094, %24
br i1 %cmp15.not.not, label %for.body16, label %if.end64, !llvm.loop !17
for.body24: ; preds = %for.body24.preheader172, %for.body24
%indvars.iv113 = phi i64 [ %indvars.iv.next114, %for.body24 ], [ %indvars.iv113.ph, %for.body24.preheader172 ]
%c.097 = phi i32 [ %spec.select, %for.body24 ], [ %c.097.ph, %for.body24.preheader172 ]
%arrayidx26 = getelementptr inbounds [102 x i32], ptr @A, i64 0, i64 %indvars.iv113
%25 = load i32, ptr %arrayidx26, align 4, !tbaa !7
%and = and i32 %25, 1
%spec.select = add i32 %and, %c.097
%indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
%exitcond117.not = icmp eq i64 %indvars.iv.next114, %wide.trip.count116
br i1 %exitcond117.not, label %for.end32, label %for.body24, !llvm.loop !18
for.end32: ; preds = %for.body24, %middle.block, %while.body, %for.cond3.preheader, %C.exit.thread, %for.cond22.preheader
%.lcssa127134139144 = phi i32 [ %10, %for.cond22.preheader ], [ %10, %C.exit.thread ], [ %1, %while.body ], [ %10, %for.cond3.preheader ], [ %10, %middle.block ], [ %10, %for.body24 ]
%c.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ 0, %C.exit.thread ], [ 0, %while.body ], [ 0, %for.cond3.preheader ], [ %22, %middle.block ], [ %spec.select, %for.body24 ]
%sub = add nsw i32 %.lcssa127134139144, -1
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%26 = load i32, ptr %n, align 4, !tbaa !7
%cmp3599 = icmp slt i32 %26, 1
%cmp37100 = icmp slt i32 %c.0.lcssa, 2
%or.cond101 = select i1 %cmp3599, i1 true, i1 %cmp37100
br i1 %or.cond101, label %for.cond51.preheader, label %if.end39
for.cond51.preheader: ; preds = %for.inc48, %for.end32
%27 = phi i32 [ %26, %for.end32 ], [ %31, %for.inc48 ]
%cmp52.not104 = icmp slt i32 %27, 1
br i1 %cmp52.not104, label %if.end64, label %for.body53
if.end39: ; preds = %for.end32, %for.inc48
%28 = phi i32 [ %31, %for.inc48 ], [ %26, %for.end32 ]
%indvars.iv118 = phi i64 [ %indvars.iv.next119, %for.inc48 ], [ 1, %for.end32 ]
%c.2103 = phi i32 [ %c.3, %for.inc48 ], [ %c.0.lcssa, %for.end32 ]
%arrayidx41 = getelementptr inbounds [102 x i32], ptr @A, i64 0, i64 %indvars.iv118
%29 = load i32, ptr %arrayidx41, align 4, !tbaa !7
%and42 = and i32 %29, 1
%tobool43.not = icmp eq i32 %and42, 0
br i1 %tobool43.not, label %for.inc48, label %if.then44
if.then44: ; preds = %if.end39
%30 = trunc i64 %indvars.iv118 to i32
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%dec46 = add nsw i32 %c.2103, -1
%.pre = load i32, ptr %n, align 4, !tbaa !7
br label %for.inc48
for.inc48: ; preds = %if.end39, %if.then44
%31 = phi i32 [ %.pre, %if.then44 ], [ %28, %if.end39 ]
%c.3 = phi i32 [ %dec46, %if.then44 ], [ %c.2103, %if.end39 ]
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%32 = sext i32 %31 to i64
%cmp35 = icmp sge i64 %indvars.iv118, %32
%cmp37 = icmp slt i32 %c.3, 2
%or.cond = select i1 %cmp35, i1 true, i1 %cmp37
br i1 %or.cond, label %for.cond51.preheader, label %if.end39, !llvm.loop !19
for.body53: ; preds = %for.cond51.preheader, %for.inc60
%33 = phi i32 [ %37, %for.inc60 ], [ %27, %for.cond51.preheader ]
%indvars.iv121 = phi i64 [ %indvars.iv.next122, %for.inc60 ], [ 1, %for.cond51.preheader ]
%arrayidx55 = getelementptr inbounds [102 x i32], ptr @A, i64 0, i64 %indvars.iv121
%34 = load i32, ptr %arrayidx55, align 4, !tbaa !7
%35 = and i32 %34, 1
%cmp56 = icmp eq i32 %35, 0
br i1 %cmp56, label %if.then57, label %for.inc60
if.then57: ; preds = %for.body53
%36 = trunc i64 %indvars.iv121 to i32
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%.pre124 = load i32, ptr %n, align 4, !tbaa !7
br label %for.inc60
for.inc60: ; preds = %for.body53, %if.then57
%37 = phi i32 [ %33, %for.body53 ], [ %.pre124, %if.then57 ]
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%38 = sext i32 %37 to i64
%cmp52.not.not = icmp slt i64 %indvars.iv121, %38
br i1 %cmp52.not.not, label %for.body53, label %if.end64, !llvm.loop !20
if.end64: ; preds = %for.body16, %for.inc60, %for.cond51.preheader, %if.then
%putchar = call i32 @putchar(i32 10)
%39 = load i32, ptr %T, align 4, !tbaa !7
%dec = add nsw i32 %39, -1
store i32 %dec, ptr %T, align 4, !tbaa !7
%tobool.not = icmp eq i32 %39, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !21
while.end: ; preds = %if.end64, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6, !13, !12}
!16 = distinct !{!16, !6, !12, !13}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6, !13, !12}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
|
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
int i, j, k, ip;
int h_array[300], w_array[300];
for (i = 0; i < 300; i++) {
scanf("%d %d", &h_array[i], &w_array[i]);
if (h_array[i] == 0 && w_array[i] == 0) {
ip = i;
break;
}
}
for (k = 0; k < ip; k++) {
for (i = 0; i < h_array[k]; i++) {
for (j = 0; j < w_array[k]; j++) {
if (i == 0 || i == (h_array[k]-1)) {
printf("#");
}
else if (j == 0 || j == (w_array[k]-1)) {
printf("#");
}
else {
printf(".");
}
}
printf("\n");
if (h_array[k] == 0 && w_array[k] == 0) {
break;
}
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100039/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100039/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h_array = alloca [300 x i32], align 16
%w_array = alloca [300 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %h_array) #4
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %w_array) #4
br label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [300 x i32], ptr %h_array, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [300 x i32], ptr %w_array, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5 = icmp eq i32 %0, 0
br i1 %cmp5, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp8 = icmp eq i32 %1, 0
br i1 %cmp8, label %for.end, label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 300
br i1 %exitcond.not, label %for.cond12.preheader.preheader, label %for.body, !llvm.loop !9
for.end: ; preds = %land.lhs.true
%2 = and i64 %indvars.iv, 4294967295
%cmp1091.not = icmp eq i64 %2, 0
br i1 %cmp1091.not, label %for.end59, label %for.cond12.preheader.preheader
for.cond12.preheader.preheader: ; preds = %for.inc, %for.end
%i.0.lcssa102 = phi i64 [ %indvars.iv, %for.end ], [ 300, %for.inc ]
%wide.trip.count = and i64 %i.0.lcssa102, 4294967295
br label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.cond12.preheader.preheader, %for.end55
%indvars.iv96 = phi i64 [ 0, %for.cond12.preheader.preheader ], [ %indvars.iv.next97, %for.end55 ]
%arrayidx14 = getelementptr inbounds [300 x i32], ptr %h_array, i64 0, i64 %indvars.iv96
%3 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp1588 = icmp sgt i32 %3, 0
br i1 %cmp1588, label %for.cond17.preheader.lr.ph, label %for.end55
for.cond17.preheader.lr.ph: ; preds = %for.cond12.preheader
%arrayidx19 = getelementptr inbounds [300 x i32], ptr %w_array, i64 0, i64 %indvars.iv96
br label %for.cond17.preheader
for.cond17.preheader: ; preds = %for.cond17.preheader.backedge, %for.cond17.preheader.lr.ph
%i.189 = phi i32 [ 0, %for.cond17.preheader.lr.ph ], [ %i.189.be, %for.cond17.preheader.backedge ]
%4 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp2085 = icmp sgt i32 %4, 0
br i1 %cmp2085, label %for.body21.lr.ph, label %for.end42
for.body21.lr.ph: ; preds = %for.cond17.preheader
%cmp22 = icmp eq i32 %i.189, 0
br i1 %cmp22, label %for.body21.us, label %for.body21.preheader
for.body21.preheader: ; preds = %for.body21.lr.ph
%putchar83.peel = call i32 @putchar(i32 35)
%5 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp20.peel = icmp sgt i32 %5, 1
br i1 %cmp20.peel, label %for.body21, label %for.end42
for.body21.us: ; preds = %for.body21.lr.ph, %for.body21.us
%j.086.us = phi i32 [ %inc41.us, %for.body21.us ], [ 0, %for.body21.lr.ph ]
%putchar83.us = call i32 @putchar(i32 35)
%inc41.us = add nuw nsw i32 %j.086.us, 1
%6 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp20.us = icmp slt i32 %inc41.us, %6
br i1 %cmp20.us, label %for.body21.us, label %for.end42, !llvm.loop !11
for.body21: ; preds = %for.body21.preheader, %for.body21
%7 = phi i32 [ %10, %for.body21 ], [ %5, %for.body21.preheader ]
%j.086 = phi i32 [ %inc41, %for.body21 ], [ 1, %for.body21.preheader ]
%8 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%sub = add nsw i32 %8, -1
%cmp25 = icmp eq i32 %i.189, %sub
%sub32 = add nsw i32 %7, -1
%cmp33 = icmp eq i32 %j.086, %sub32
%9 = select i1 %cmp25, i1 true, i1 %cmp33
%.sink = select i1 %9, i32 35, i32 46
%putchar83 = call i32 @putchar(i32 %.sink)
%inc41 = add nuw nsw i32 %j.086, 1
%10 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp20 = icmp slt i32 %inc41, %10
br i1 %cmp20, label %for.body21, label %for.end42, !llvm.loop !12
for.end42: ; preds = %for.body21, %for.body21.us, %for.body21.preheader, %for.cond17.preheader
%putchar = call i32 @putchar(i32 10)
%11 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp46 = icmp eq i32 %11, 0
br i1 %cmp46, label %land.lhs.true47, label %for.inc53
land.lhs.true47: ; preds = %for.end42
%12 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp50 = icmp ne i32 %12, 0
%inc54 = add nuw nsw i32 %i.189, 1
%cmp15 = icmp slt i32 %inc54, %11
%or.cond = select i1 %cmp50, i1 %cmp15, i1 false
br i1 %or.cond, label %for.cond17.preheader.backedge, label %for.end55
for.inc53: ; preds = %for.end42
%inc54.old = add nuw nsw i32 %i.189, 1
%cmp15.old = icmp slt i32 %inc54.old, %11
br i1 %cmp15.old, label %for.cond17.preheader.backedge, label %for.end55
for.cond17.preheader.backedge: ; preds = %for.inc53, %land.lhs.true47
%i.189.be = phi i32 [ %inc54.old, %for.inc53 ], [ %inc54, %land.lhs.true47 ]
br label %for.cond17.preheader, !llvm.loop !14
for.end55: ; preds = %for.inc53, %land.lhs.true47, %for.cond12.preheader
%putchar80 = call i32 @putchar(i32 10)
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%exitcond99.not = icmp eq i64 %indvars.iv.next97, %wide.trip.count
br i1 %exitcond99.not, label %for.end59, label %for.cond12.preheader, !llvm.loop !15
for.end59: ; preds = %for.end55, %for.end
call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %w_array) #4
call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %h_array) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main (void)
{
int H,W,i,j;
while(1)
{
scanf("%d %d",&H,&W);
if (H==0 && W==0) break;
for(i=0;i<H;i++)
{
for(j=0;j<W;j++)
{
if(i==0||i==H-1||j==0||j==W-1)
printf("#");
else
printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100082/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100082/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.037, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.034 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp7 = icmp eq i32 %i.037, %sub
%cmp9 = icmp eq i32 %j.034, 0
%or.cond22 = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %j.034, %sub11
%or.cond32 = select i1 %or.cond22, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int H=1,W=1;
int h,w;
while(1){
scanf("%d%d", &H, &W);
if(H==0 && W==0)
break;
for(h=0;h<H;h++){
for(w=0;w<W;w++)
if(h == 0 || w == 0 || h == H-1 || w == W-1)
printf("#");
else
printf(".");
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100132/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100132/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
store i32 1, ptr %H, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
store i32 1, ptr %W, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%h.037 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %h.037, 0
br i1 %cmp6, label %for.body5.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body5.lr.ph
%putchar31.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %W, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.peel, label %lor.lhs.false8, label %for.end
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%w.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %w.034.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
lor.lhs.false8: ; preds = %for.inc.peel, %lor.lhs.false8
%5 = phi i32 [ %7, %lor.lhs.false8 ], [ %.pre, %for.inc.peel ]
%w.034 = phi i32 [ %inc, %lor.lhs.false8 ], [ 1, %for.inc.peel ]
%6 = load i32, ptr %H, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp9 = icmp eq i32 %h.037, %sub
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %w.034, %sub11
%or.cond32 = select i1 %cmp9, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %w.034, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %lor.lhs.false8, label %for.end, !llvm.loop !11
for.end: ; preds = %lor.lhs.false8, %for.body5.us, %for.inc.peel, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %h.037, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !13
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int H,W,a,b;
while(1){
scanf("%d %d",&H,&W);
if(H==0&&W==0)
break;
for(a=1;a<=H;a++){
for(b=1;b<=W;b++){
if(a==1||a==H||b==1||b==W){
printf("#");
}
else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100183/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100183/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp39 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp140 = icmp eq i32 %1, 0
%or.cond41 = select i1 %cmp39, i1 %cmp140, i1 false
br i1 %or.cond41, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end19
%2 = phi i32 [ %9, %for.end19 ], [ %0, %entry ]
%cmp2.not35 = icmp slt i32 %2, 1
br i1 %cmp2.not35, label %for.end19, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%a.036 = phi i32 [ %inc18, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not32 = icmp slt i32 %3, 1
br i1 %cmp4.not32, label %for.end, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %a.036, 1
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%b.033.us = phi i32 [ %inc.us, %for.body5.us ], [ 1, %for.body5.lr.ph ]
%putchar30.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %b.033.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.us.not = icmp slt i32 %b.033.us, %4
br i1 %cmp4.not.us.not, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%b.033 = phi i32 [ %inc, %for.body5 ], [ 1, %for.body5.lr.ph ]
%6 = load i32, ptr %H, align 4, !tbaa !5
%cmp7 = icmp eq i32 %a.036, %6
%cmp9 = icmp eq i32 %b.033, 1
%or.cond21 = or i1 %cmp9, %cmp7
%cmp11 = icmp eq i32 %b.033, %5
%or.cond31 = or i1 %cmp11, %or.cond21
%. = select i1 %or.cond31, i32 35, i32 46
%putchar30 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %b.033, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %b.033, %7
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar28 = call i32 @putchar(i32 10)
%inc18 = add nuw nsw i32 %a.036, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %a.036, %8
br i1 %cmp2.not.not, label %for.cond3.preheader, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end19, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<string.h>
//#include<iostream>
//#include<algorithm>
int main()
{
char str[1010],c1,c2;
int A[100]={0};
//scanf("%s",str);
int i=1,count1=0;
while((c1=getchar())!='}')
{
//printf(" 14 %d %c\n",i,c1);
if(c1>='a' && c1<='z')
{ // printf(" 16 %c\n",c1);
A[c1-97]++;
//printf(" 18 %c %d %d\n",c1,(c1-97),A[(c1-97)]);
}
}
for(i=0;i<26;i++)
{
if(A[i]>0) count1++;
}
printf("%d",count1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10027/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10027/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %A, i8 0, i64 400, i1 false)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i26 = tail call i32 @getc(ptr noundef %0)
%sext27 = shl i32 %call.i26, 24
%cmp.not29 = icmp eq i32 %sext27, 2097152000
br i1 %cmp.not29, label %for.cond.preheader, label %while.body
for.cond.preheader.loopexit: ; preds = %if.end
%arrayidx13.16.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 16
%arrayidx13.20.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 20
%.pre54 = load i32, ptr %arrayidx13.20.phi.trans.insert, align 16, !tbaa !9
%1 = load <16 x i32>, ptr %A, align 16, !tbaa !9
%2 = icmp sgt <16 x i32> %1, zeroinitializer
%3 = load <4 x i32>, ptr %arrayidx13.16.phi.trans.insert, align 16, !tbaa !9
%4 = icmp sgt <4 x i32> %3, zeroinitializer
%5 = icmp sgt i32 %.pre54, 0
%6 = zext i1 %5 to i32
%7 = bitcast <16 x i1> %2 to i16
%8 = tail call i16 @llvm.ctpop.i16(i16 %7), !range !11
%9 = zext i16 %8 to i32
%10 = bitcast <4 x i1> %4 to i4
%11 = tail call i4 @llvm.ctpop.i4(i4 %10), !range !12
%12 = zext i4 %11 to i32
%op.rdx = add nuw nsw i32 %9, %12
%op.rdx55 = add nuw nsw i32 %op.rdx, %6
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.loopexit, %entry
%spec.select.20 = phi i32 [ %op.rdx55, %for.cond.preheader.loopexit ], [ 0, %entry ]
%arrayidx13.21 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 21
%13 = load <4 x i32>, ptr %arrayidx13.21, align 4, !tbaa !9
%14 = icmp sgt <4 x i32> %13, zeroinitializer
%arrayidx13.25 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 25
%15 = load i32, ptr %arrayidx13.25, align 4, !tbaa !9
%cmp14.25 = icmp sgt i32 %15, 0
%inc17.25 = zext i1 %cmp14.25 to i32
%16 = bitcast <4 x i1> %14 to i4
%17 = tail call i4 @llvm.ctpop.i4(i4 %16), !range !12
%18 = zext i4 %17 to i32
%op.rdx56 = add nuw nsw i32 %18, %inc17.25
%op.rdx57 = add nsw i32 %op.rdx56, %spec.select.20
%call20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %op.rdx57)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #5
ret i32 0
while.body: ; preds = %entry, %if.end
%sext30 = phi i32 [ %sext, %if.end ], [ %sext27, %entry ]
%19 = add i32 %sext30, -1610612737
%or.cond = icmp ult i32 %19, 452984831
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %while.body
%conv131 = lshr exact i32 %sext30, 24
%sub = add nsw i32 %conv131, -97
%idxprom = zext i32 %sub to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom
%20 = load i32, ptr %arrayidx, align 4, !tbaa !9
%inc = add nsw i32 %20, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %while.body
%21 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %21)
%sext = shl i32 %call.i, 24
%cmp.not = icmp eq i32 %sext, 2097152000
br i1 %cmp.not, label %for.cond.preheader.loopexit, label %while.body, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 @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 @getc(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i16 @llvm.ctpop.i16(i16) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i4 @llvm.ctpop.i4(i4) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i16 0, i16 17}
!12 = !{i4 0, i4 5}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int H,W,a,b;
while(1){
scanf("%d %d",&H,&W);
if(H==0&&W==0){
break;
}
for(a=1;a<W;a++){
printf("#");
}
printf("#\n");
for(b=2;b<H;b++){
printf("#");
for(a=2;a<W;a++){
printf(".");
}
printf("#\n");
}
for(a=1;a<W;a++){
printf("#");
}
printf("#\n\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100312/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100312/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.5 = private unnamed_addr constant [3 x i8] c"#\0A\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp48 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp149 = icmp eq i32 %1, 0
%or.cond50 = select i1 %cmp48, i1 %cmp149, i1 false
br i1 %or.cond50, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end26
%2 = phi i32 [ %11, %for.end26 ], [ %1, %entry ]
%cmp239 = icmp sgt i32 %2, 1
br i1 %cmp239, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%a.040 = phi i32 [ %inc, %for.body ], [ 1, %for.cond.preheader ]
%putchar38 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %a.040, 1
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc, %3
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%4 = load i32, ptr %H, align 4, !tbaa !5
%cmp643 = icmp sgt i32 %4, 2
br i1 %cmp643, label %for.body7, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.end15, %for.end
%5 = load i32, ptr %W, align 4, !tbaa !5
%cmp2145 = icmp sgt i32 %5, 1
br i1 %cmp2145, label %for.body22, label %for.end26
for.body7: ; preds = %for.end, %for.end15
%b.044 = phi i32 [ %inc18, %for.end15 ], [ 2, %for.end ]
%putchar35 = call i32 @putchar(i32 35)
%6 = load i32, ptr %W, align 4, !tbaa !5
%cmp1041 = icmp sgt i32 %6, 2
br i1 %cmp1041, label %for.body11, label %for.end15
for.body11: ; preds = %for.body7, %for.body11
%a.142 = phi i32 [ %inc14, %for.body11 ], [ 2, %for.body7 ]
%putchar37 = call i32 @putchar(i32 46)
%inc14 = add nuw nsw i32 %a.142, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc14, %7
br i1 %cmp10, label %for.body11, label %for.end15, !llvm.loop !11
for.end15: ; preds = %for.body11, %for.body7
%puts36 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc18 = add nuw nsw i32 %b.044, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc18, %8
br i1 %cmp6, label %for.body7, label %for.cond20.preheader, !llvm.loop !12
for.body22: ; preds = %for.cond20.preheader, %for.body22
%a.246 = phi i32 [ %inc25, %for.body22 ], [ 1, %for.cond20.preheader ]
%putchar = call i32 @putchar(i32 35)
%inc25 = add nuw nsw i32 %a.246, 1
%9 = load i32, ptr %W, align 4, !tbaa !5
%cmp21 = icmp slt i32 %inc25, %9
br i1 %cmp21, label %for.body22, label %for.end26, !llvm.loop !13
for.end26: ; preds = %for.body22, %for.cond20.preheader
%puts34 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%10 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end26, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main( void )
{
int H, W, H_Cou, W_Cou;
while(1)
{
scanf( "%d %d", &H, &W );
if( H == 0 && W == 0 )
{
break;
}
else
{
for( H_Cou = 0; H_Cou < H; H_Cou++ )
{
if( H_Cou == 0 || H_Cou == H - 1 )
{
for( W_Cou = 0; W_Cou < W; W_Cou++ )
{
printf( "#" );
}
}
else
{
for( W_Cou = 0; W_Cou < W; W_Cou++ )
{
if( W_Cou == 0 || W_Cou == W - 1 )
{
printf( "#" );
}
else
{
printf( "." );
}
}
}
printf( "\n" );
}
printf( "\n" );
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100363/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100363/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp55 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp156 = icmp eq i32 %1, 0
%or.cond57 = select i1 %cmp55, i1 %cmp156, i1 false
br i1 %or.cond57, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end29
%2 = phi i32 [ %9, %for.end29 ], [ %0, %entry ]
%cmp252 = icmp sgt i32 %2, 0
br i1 %cmp252, label %for.body, label %for.end29
for.body: ; preds = %for.cond.preheader, %if.end25
%3 = phi i32 [ %8, %if.end25 ], [ %2, %for.cond.preheader ]
%H_Cou.053 = phi i32 [ %inc28, %if.end25 ], [ 0, %for.cond.preheader ]
%cmp3 = icmp eq i32 %H_Cou.053, 0
%sub = add nsw i32 %3, -1
%cmp4 = icmp eq i32 %H_Cou.053, %sub
%or.cond45 = select i1 %cmp3, i1 true, i1 %cmp4
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp750 = icmp sgt i32 %4, 0
br i1 %or.cond45, label %for.cond6.preheader, label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body
br i1 %cmp750, label %for.inc22.peel, label %if.end25
for.inc22.peel: ; preds = %for.cond11.preheader
%putchar42.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %W, align 4, !tbaa !5
%cmp12.peel = icmp sgt i32 %.pre, 1
br i1 %cmp12.peel, label %for.body13, label %if.end25
for.cond6.preheader: ; preds = %for.body
br i1 %cmp750, label %for.body8, label %if.end25
for.body8: ; preds = %for.cond6.preheader, %for.body8
%W_Cou.051 = phi i32 [ %inc, %for.body8 ], [ 0, %for.cond6.preheader ]
%putchar44 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %W_Cou.051, 1
%5 = load i32, ptr %W, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc, %5
br i1 %cmp7, label %for.body8, label %if.end25, !llvm.loop !9
for.body13: ; preds = %for.inc22.peel, %for.body13
%6 = phi i32 [ %7, %for.body13 ], [ %.pre, %for.inc22.peel ]
%W_Cou.149 = phi i32 [ %inc23, %for.body13 ], [ 1, %for.inc22.peel ]
%sub16 = add nsw i32 %6, -1
%cmp17 = icmp eq i32 %W_Cou.149, %sub16
%. = select i1 %cmp17, i32 35, i32 46
%putchar42 = call i32 @putchar(i32 %.)
%inc23 = add nuw nsw i32 %W_Cou.149, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc23, %7
br i1 %cmp12, label %for.body13, label %if.end25, !llvm.loop !11
if.end25: ; preds = %for.body13, %for.body8, %for.inc22.peel, %for.cond11.preheader, %for.cond6.preheader
%putchar43 = call i32 @putchar(i32 10)
%inc28 = add nuw nsw i32 %H_Cou.053, 1
%8 = load i32, ptr %H, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc28, %8
br i1 %cmp2, label %for.body, label %for.end29, !llvm.loop !13
for.end29: ; preds = %if.end25, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end29, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void)
{
int i,j,h,w;
while(1){
scanf("%d %d",&h,&w);
if(h==0 && w==0) break;
else if(h>2 && w>2){
for(j=0;j<w;j++)
printf("#");
printf("\n");
for(i=0;i<(h-2);i++){
printf("#");
for(j=0;j<(w-2);j++){
printf(".");
}
printf("#\n");
}
for(j=0;j<w;j++)
printf("#");
printf("\n\n");
}
else{
for(i=0;i<h;i++){
for(j=0;j<w;j++)
printf("#");
printf("\n");
}
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100406/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100406/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call83 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp84 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp185 = icmp eq i32 %1, 0
%or.cond86 = select i1 %cmp84, i1 %cmp185, i1 false
br i1 %or.cond86, label %while.end, label %if.else
if.else: ; preds = %entry, %if.end49
%2 = phi i32 [ %15, %if.end49 ], [ %1, %entry ]
%3 = phi i32 [ %14, %if.end49 ], [ %0, %entry ]
%cmp2 = icmp sgt i32 %3, 2
%cmp4 = icmp sgt i32 %2, 2
%or.cond50 = select i1 %cmp2, i1 %cmp4, i1 false
br i1 %or.cond50, label %for.body, label %for.cond34.preheader
for.cond34.preheader: ; preds = %if.else
%cmp3571 = icmp sgt i32 %3, 0
br i1 %cmp3571, label %for.cond37.preheader, label %for.end47
for.body: ; preds = %if.else, %for.body
%j.074 = phi i32 [ %inc, %for.body ], [ 0, %if.else ]
%putchar68 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.074, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc, %4
br i1 %cmp6, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%putchar63 = call i32 @putchar(i32 10)
%5 = load i32, ptr %h, align 4, !tbaa !5
%cmp1079 = icmp sgt i32 %5, 2
br i1 %cmp1079, label %for.body11, label %for.cond25.preheader
for.cond25.preheader: ; preds = %for.end20, %for.end
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp2681 = icmp sgt i32 %6, 0
br i1 %cmp2681, label %for.body27, label %for.end31
for.body11: ; preds = %for.end, %for.end20
%i.080 = phi i32 [ %inc23, %for.end20 ], [ 0, %for.end ]
%putchar65 = call i32 @putchar(i32 35)
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp1576 = icmp sgt i32 %7, 2
br i1 %cmp1576, label %for.body16, label %for.end20
for.body16: ; preds = %for.body11, %for.body16
%j.177 = phi i32 [ %inc19, %for.body16 ], [ 0, %for.body11 ]
%putchar67 = call i32 @putchar(i32 46)
%inc19 = add nuw nsw i32 %j.177, 1
%8 = load i32, ptr %w, align 4, !tbaa !5
%sub14 = add nsw i32 %8, -2
%cmp15 = icmp slt i32 %inc19, %sub14
br i1 %cmp15, label %for.body16, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.body16, %for.body11
%puts66 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc23 = add nuw nsw i32 %i.080, 1
%9 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %9, -2
%cmp10 = icmp slt i32 %inc23, %sub
br i1 %cmp10, label %for.body11, label %for.cond25.preheader, !llvm.loop !12
for.body27: ; preds = %for.cond25.preheader, %for.body27
%j.282 = phi i32 [ %inc30, %for.body27 ], [ 0, %for.cond25.preheader ]
%putchar64 = call i32 @putchar(i32 35)
%inc30 = add nuw nsw i32 %j.282, 1
%10 = load i32, ptr %w, align 4, !tbaa !5
%cmp26 = icmp slt i32 %inc30, %10
br i1 %cmp26, label %for.body27, label %for.end31, !llvm.loop !13
for.end31: ; preds = %for.body27, %for.cond25.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end49
for.cond37.preheader: ; preds = %for.cond34.preheader, %for.end43
%i.172 = phi i32 [ %inc46, %for.end43 ], [ 0, %for.cond34.preheader ]
%11 = load i32, ptr %w, align 4, !tbaa !5
%cmp3869 = icmp sgt i32 %11, 0
br i1 %cmp3869, label %for.body39, label %for.end43
for.body39: ; preds = %for.cond37.preheader, %for.body39
%j.370 = phi i32 [ %inc42, %for.body39 ], [ 0, %for.cond37.preheader ]
%putchar62 = call i32 @putchar(i32 35)
%inc42 = add nuw nsw i32 %j.370, 1
%12 = load i32, ptr %w, align 4, !tbaa !5
%cmp38 = icmp slt i32 %inc42, %12
br i1 %cmp38, label %for.body39, label %for.end43, !llvm.loop !14
for.end43: ; preds = %for.body39, %for.cond37.preheader
%putchar61 = call i32 @putchar(i32 10)
%inc46 = add nuw nsw i32 %i.172, 1
%13 = load i32, ptr %h, align 4, !tbaa !5
%cmp35 = icmp slt i32 %inc46, %13
br i1 %cmp35, label %for.cond37.preheader, label %for.end47, !llvm.loop !15
for.end47: ; preds = %for.end43, %for.cond34.preheader
%putchar = call i32 @putchar(i32 10)
br label %if.end49
if.end49: ; preds = %for.end31, %for.end47
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%14 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %14, 0
%15 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %15, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.else
while.end: ; preds = %if.end49, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#include <string.h>
char g[1001][1001];
int main() {
int k,z,n=2,i,j,b3[30],len=0,from,prev,y;
scanf("%d",&k);
memset(g,'N',sizeof(g));
z=k;
while(z) b3[len++]=z%3,z/=3;
for(i=0;i<len;i++) if(b3[i]) {
/* create path of length len with b3*3^i possibilities */
from=0;
prev=1;
for(j=0;j<i;j++) {
for(z=0;z<prev;z++) for(y=0;y<3;y++) g[from+z][n+y]='Y';
from=n;
prev=3;
n+=3;
}
for(z=0;z<prev;z++) for(y=0;y<b3[i];y++) g[from+z][n+y]='Y';
from=n;
prev=b3[i];
n+=b3[i];
for(;j<len-1;j++) {
for(z=0;z<prev;z++) g[from+z][n]='Y';
from=n;
n++;
prev=1;
}
for(z=0;z<prev;z++) g[from+z][1]='Y';
}
for(i=0;i<n;i++) for(j=0;j<n;j++) if(g[i][j]=='Y') g[j][i]='Y';
printf("%d\n",n);
for(i=0;i<n;i++) {
g[i][n]=0;
puts(g[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10045/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10045/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@g = dso_local global [1001 x [1001 x i8]] 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:
%k = alloca i32, align 4
%b3 = alloca [30 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %b3) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1002001) @g, i8 78, i64 1002001, i1 false)
%0 = load i32, ptr %k, align 4, !tbaa !5
%tobool.not182 = icmp eq i32 %0, 0
br i1 %tobool.not182, label %for.cond85.preheader.us.preheader, label %while.body
for.cond.preheader: ; preds = %while.body
%1 = trunc i64 %indvars.iv.next to i32
%cmp211.not = icmp eq i32 %1, 0
br i1 %cmp211.not, label %for.cond85.preheader.us.preheader, label %for.body.lr.ph
for.body.lr.ph: ; preds = %for.cond.preheader
%sub = add i32 %1, -1
%2 = sext i32 %sub to i64
%wide.trip.count263 = and i64 %indvars.iv.next, 4294967295
br label %for.body
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%z.0183 = phi i32 [ %div, %while.body ], [ %0, %entry ]
%rem = srem i32 %z.0183, 3
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [30 x i32], ptr %b3, i64 0, i64 %indvars.iv
store i32 %rem, ptr %arrayidx, align 4, !tbaa !5
%div = sdiv i32 %z.0183, 3
%z.0183.off = add i32 %z.0183, 2
%tobool.not = icmp ult i32 %z.0183.off, 5
br i1 %tobool.not, label %for.cond.preheader, label %while.body, !llvm.loop !9
for.cond82.preheader: ; preds = %for.inc79
%cmp83218 = icmp sgt i32 %n.3, 0
br i1 %cmp83218, label %for.cond85.preheader.us.preheader, label %for.end105.thread
for.end105.thread: ; preds = %for.cond82.preheader
%call106297 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.3)
br label %for.end120
for.cond85.preheader.us.preheader: ; preds = %entry, %for.cond.preheader, %for.cond82.preheader
%n.0.lcssa285 = phi i32 [ %n.3, %for.cond82.preheader ], [ 2, %for.cond.preheader ], [ 2, %entry ]
%wide.trip.count273 = zext i32 %n.0.lcssa285 to i64
%xtraiter304 = and i64 %wide.trip.count273, 1
%3 = icmp eq i32 %n.0.lcssa285, 1
%unroll_iter307 = and i64 %wide.trip.count273, 2147483646
%lcmp.mod306.not = icmp eq i64 %xtraiter304, 0
br label %for.cond85.preheader.us
for.cond85.preheader.us: ; preds = %for.cond85.preheader.us.preheader, %for.cond85.for.inc103_crit_edge.us
%indvars.iv270 = phi i64 [ 0, %for.cond85.preheader.us.preheader ], [ %indvars.iv.next271, %for.cond85.for.inc103_crit_edge.us ]
br i1 %3, label %for.cond85.for.inc103_crit_edge.us.unr-lcssa, label %for.body87.us
for.body87.us: ; preds = %for.cond85.preheader.us, %for.inc100.us.1
%indvars.iv265 = phi i64 [ %indvars.iv.next266.1, %for.inc100.us.1 ], [ 0, %for.cond85.preheader.us ]
%niter308 = phi i64 [ %niter308.next.1, %for.inc100.us.1 ], [ 0, %for.cond85.preheader.us ]
%arrayidx91.us = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %indvars.iv270, i64 %indvars.iv265
%4 = load i8, ptr %arrayidx91.us, align 1, !tbaa !11
%cmp92.us = icmp eq i8 %4, 89
br i1 %cmp92.us, label %if.then94.us, label %for.inc100.us
if.then94.us: ; preds = %for.body87.us
%arrayidx98.us = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %indvars.iv265, i64 %indvars.iv270
store i8 89, ptr %arrayidx98.us, align 1, !tbaa !11
br label %for.inc100.us
for.inc100.us: ; preds = %if.then94.us, %for.body87.us
%indvars.iv.next266 = or i64 %indvars.iv265, 1
%arrayidx91.us.1 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %indvars.iv270, i64 %indvars.iv.next266
%5 = load i8, ptr %arrayidx91.us.1, align 1, !tbaa !11
%cmp92.us.1 = icmp eq i8 %5, 89
br i1 %cmp92.us.1, label %if.then94.us.1, label %for.inc100.us.1
if.then94.us.1: ; preds = %for.inc100.us
%arrayidx98.us.1 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %indvars.iv.next266, i64 %indvars.iv270
store i8 89, ptr %arrayidx98.us.1, align 1, !tbaa !11
br label %for.inc100.us.1
for.inc100.us.1: ; preds = %if.then94.us.1, %for.inc100.us
%indvars.iv.next266.1 = add nuw nsw i64 %indvars.iv265, 2
%niter308.next.1 = add i64 %niter308, 2
%niter308.ncmp.1 = icmp eq i64 %niter308.next.1, %unroll_iter307
br i1 %niter308.ncmp.1, label %for.cond85.for.inc103_crit_edge.us.unr-lcssa, label %for.body87.us, !llvm.loop !12
for.cond85.for.inc103_crit_edge.us.unr-lcssa: ; preds = %for.inc100.us.1, %for.cond85.preheader.us
%indvars.iv265.unr = phi i64 [ 0, %for.cond85.preheader.us ], [ %indvars.iv.next266.1, %for.inc100.us.1 ]
br i1 %lcmp.mod306.not, label %for.cond85.for.inc103_crit_edge.us, label %for.body87.us.epil
for.body87.us.epil: ; preds = %for.cond85.for.inc103_crit_edge.us.unr-lcssa
%arrayidx91.us.epil = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %indvars.iv270, i64 %indvars.iv265.unr
%6 = load i8, ptr %arrayidx91.us.epil, align 1, !tbaa !11
%cmp92.us.epil = icmp eq i8 %6, 89
br i1 %cmp92.us.epil, label %if.then94.us.epil, label %for.cond85.for.inc103_crit_edge.us
if.then94.us.epil: ; preds = %for.body87.us.epil
%arrayidx98.us.epil = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %indvars.iv265.unr, i64 %indvars.iv270
store i8 89, ptr %arrayidx98.us.epil, align 1, !tbaa !11
br label %for.cond85.for.inc103_crit_edge.us
for.cond85.for.inc103_crit_edge.us: ; preds = %for.body87.us.epil, %if.then94.us.epil, %for.cond85.for.inc103_crit_edge.us.unr-lcssa
%indvars.iv.next271 = add nuw nsw i64 %indvars.iv270, 1
%exitcond274.not = icmp eq i64 %indvars.iv.next271, %wide.trip.count273
br i1 %exitcond274.not, label %for.end105, label %for.cond85.preheader.us, !llvm.loop !13
for.body: ; preds = %for.body.lr.ph, %for.inc79
%indvars.iv260 = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next261, %for.inc79 ]
%n.0212 = phi i32 [ 2, %for.body.lr.ph ], [ %n.3, %for.inc79 ]
%arrayidx2 = getelementptr inbounds [30 x i32], ptr %b3, i64 0, i64 %indvars.iv260
%7 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%tobool3.not = icmp eq i32 %7, 0
br i1 %tobool3.not, label %for.inc79, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body
%cmp5187.not = icmp eq i64 %indvars.iv260, 0
br i1 %cmp5187.not, label %for.cond26.preheader, label %for.cond7.preheader.preheader
for.cond7.preheader.preheader: ; preds = %for.cond4.preheader
%8 = sext i32 %n.0212 to i64
%invariant.gep = getelementptr i8, ptr @g, i64 %8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %invariant.gep, i8 89, i64 3, i1 false), !tbaa !11
%add22.peel = add nsw i32 %n.0212, 3
%exitcond233.not.peel = icmp eq i64 %indvars.iv260, 1
br i1 %exitcond233.not.peel, label %for.cond26.preheader, label %for.cond7.preheader
for.cond26.preheader: ; preds = %for.cond7.preheader.preheader, %for.cond7.preheader, %for.cond4.preheader
%n.1.lcssa = phi i32 [ %n.0212, %for.cond4.preheader ], [ %add22.peel, %for.cond7.preheader.preheader ], [ %add22, %for.cond7.preheader ]
%from.0.lcssa = phi i32 [ 0, %for.cond4.preheader ], [ %n.0212, %for.cond7.preheader.preheader ], [ %n.1188, %for.cond7.preheader ]
%cmp32196 = icmp sgt i32 %7, 0
br i1 %cmp32196, label %for.cond29.preheader.us.preheader, label %for.end45
for.cond29.preheader.us.preheader: ; preds = %for.cond26.preheader
%9 = sext i32 %from.0.lcssa to i64
%10 = mul nsw i64 %9, 1001
%11 = sext i32 %n.1.lcssa to i64
%12 = zext i32 %7 to i64
%13 = getelementptr i8, ptr @g, i64 %10
%14 = getelementptr i8, ptr %13, i64 %11
call void @llvm.memset.p0.i64(ptr align 1 %14, i8 89, i64 %12, i1 false), !tbaa !11
br i1 %cmp5187.not, label %for.end45, label %for.cond29.preheader.us.1, !llvm.loop !14
for.cond29.preheader.us.1: ; preds = %for.cond29.preheader.us.preheader
%scevgep236.1 = getelementptr i8, ptr %14, i64 1001
call void @llvm.memset.p0.i64(ptr align 1 %scevgep236.1, i8 89, i64 %12, i1 false), !tbaa !11
%scevgep236.2 = getelementptr i8, ptr %14, i64 2002
call void @llvm.memset.p0.i64(ptr align 1 %scevgep236.2, i8 89, i64 %12, i1 false), !tbaa !11
br label %for.end45
for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.cond7.preheader
%indvar = phi i64 [ %indvar.next, %for.cond7.preheader ], [ 1, %for.cond7.preheader.preheader ]
%from.0190 = phi i32 [ %n.1188, %for.cond7.preheader ], [ %n.0212, %for.cond7.preheader.preheader ]
%n.1188 = phi i32 [ %add22, %for.cond7.preheader ], [ %add22.peel, %for.cond7.preheader.preheader ]
%15 = mul nuw nsw i64 %indvar, 3
%16 = sext i32 %from.0190 to i64
%17 = mul nsw i64 %16, 1001
%gep = getelementptr i8, ptr %invariant.gep, i64 %15
%18 = getelementptr i8, ptr %gep, i64 %17
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %18, i8 89, i64 3, i1 false), !tbaa !11
%scevgep.1 = getelementptr i8, ptr %18, i64 1001
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %scevgep.1, i8 89, i64 3, i1 false), !tbaa !11
%scevgep.2 = getelementptr i8, ptr %18, i64 2002
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %scevgep.2, i8 89, i64 3, i1 false), !tbaa !11
%add22 = add nsw i32 %n.1188, 3
%indvar.next = add nuw nsw i64 %indvar, 1
%exitcond233.not = icmp eq i64 %indvar.next, %indvars.iv260
br i1 %exitcond233.not, label %for.cond26.preheader, label %for.cond7.preheader, !llvm.loop !15
for.end45: ; preds = %for.cond29.preheader.us.preheader, %for.cond29.preheader.us.1, %for.cond26.preheader
%add50 = add i32 %n.1.lcssa, %7
%cmp52201 = icmp slt i64 %indvars.iv260, %2
br i1 %cmp52201, label %for.cond54.preheader.preheader, label %for.cond69.preheader
for.cond54.preheader.preheader: ; preds = %for.end45
%19 = sext i32 %add50 to i64
%20 = trunc i64 %indvars.iv260 to i32
br label %for.cond54.preheader
for.cond69.preheader.thread: ; preds = %for.end64
%21 = trunc i64 %indvars.iv.next251 to i32
br label %for.body71.preheader
for.cond69.preheader: ; preds = %for.end45
%cmp70209 = icmp sgt i32 %7, 0
br i1 %cmp70209, label %for.body71.preheader, label %for.inc79
for.body71.preheader: ; preds = %for.cond69.preheader.thread, %for.cond69.preheader
%prev.1.lcssa294 = phi i32 [ 1, %for.cond69.preheader.thread ], [ %7, %for.cond69.preheader ]
%from.1.lcssa293 = phi i32 [ %31, %for.cond69.preheader.thread ], [ %n.1.lcssa, %for.cond69.preheader ]
%n.2.lcssa292 = phi i32 [ %21, %for.cond69.preheader.thread ], [ %add50, %for.cond69.preheader ]
%22 = sext i32 %from.1.lcssa293 to i64
%wide.trip.count258 = zext i32 %prev.1.lcssa294 to i64
%xtraiter299 = and i64 %wide.trip.count258, 3
%23 = icmp ult i32 %prev.1.lcssa294, 4
br i1 %23, label %for.inc79.loopexit.unr-lcssa, label %for.body71.preheader.new
for.body71.preheader.new: ; preds = %for.body71.preheader
%unroll_iter302 = and i64 %wide.trip.count258, 2147483644
br label %for.body71
for.cond54.preheader: ; preds = %for.cond54.preheader.preheader, %for.end64
%indvars.iv250 = phi i64 [ %19, %for.cond54.preheader.preheader ], [ %indvars.iv.next251, %for.end64 ]
%prev.1205 = phi i32 [ %7, %for.cond54.preheader.preheader ], [ 1, %for.end64 ]
%from.1204 = phi i32 [ %n.1.lcssa, %for.cond54.preheader.preheader ], [ %31, %for.end64 ]
%j.1203 = phi i32 [ %20, %for.cond54.preheader.preheader ], [ %inc67, %for.end64 ]
%cmp55199 = icmp sgt i32 %prev.1205, 0
br i1 %cmp55199, label %for.body56.lr.ph, label %for.end64
for.body56.lr.ph: ; preds = %for.cond54.preheader
%24 = sext i32 %from.1204 to i64
%wide.trip.count248 = zext i32 %prev.1205 to i64
%xtraiter = and i64 %wide.trip.count248, 3
%25 = icmp ult i32 %prev.1205, 4
br i1 %25, label %for.end64.loopexit.unr-lcssa, label %for.body56.lr.ph.new
for.body56.lr.ph.new: ; preds = %for.body56.lr.ph
%unroll_iter = and i64 %wide.trip.count248, 4294967292
br label %for.body56
for.body56: ; preds = %for.body56, %for.body56.lr.ph.new
%indvars.iv244 = phi i64 [ 0, %for.body56.lr.ph.new ], [ %indvars.iv.next245.3, %for.body56 ]
%niter = phi i64 [ 0, %for.body56.lr.ph.new ], [ %niter.next.3, %for.body56 ]
%26 = add nsw i64 %indvars.iv244, %24
%arrayidx61 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %26, i64 %indvars.iv250
store i8 89, ptr %arrayidx61, align 1, !tbaa !11
%indvars.iv.next245 = or i64 %indvars.iv244, 1
%27 = add nsw i64 %indvars.iv.next245, %24
%arrayidx61.1 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %27, i64 %indvars.iv250
store i8 89, ptr %arrayidx61.1, align 1, !tbaa !11
%indvars.iv.next245.1 = or i64 %indvars.iv244, 2
%28 = add nsw i64 %indvars.iv.next245.1, %24
%arrayidx61.2 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %28, i64 %indvars.iv250
store i8 89, ptr %arrayidx61.2, align 1, !tbaa !11
%indvars.iv.next245.2 = or i64 %indvars.iv244, 3
%29 = add nsw i64 %indvars.iv.next245.2, %24
%arrayidx61.3 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %29, i64 %indvars.iv250
store i8 89, ptr %arrayidx61.3, align 1, !tbaa !11
%indvars.iv.next245.3 = add nuw nsw i64 %indvars.iv244, 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.end64.loopexit.unr-lcssa, label %for.body56, !llvm.loop !17
for.end64.loopexit.unr-lcssa: ; preds = %for.body56, %for.body56.lr.ph
%indvars.iv244.unr = phi i64 [ 0, %for.body56.lr.ph ], [ %indvars.iv.next245.3, %for.body56 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end64, label %for.body56.epil
for.body56.epil: ; preds = %for.end64.loopexit.unr-lcssa, %for.body56.epil
%indvars.iv244.epil = phi i64 [ %indvars.iv.next245.epil, %for.body56.epil ], [ %indvars.iv244.unr, %for.end64.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body56.epil ], [ 0, %for.end64.loopexit.unr-lcssa ]
%30 = add nsw i64 %indvars.iv244.epil, %24
%arrayidx61.epil = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %30, i64 %indvars.iv250
store i8 89, ptr %arrayidx61.epil, align 1, !tbaa !11
%indvars.iv.next245.epil = add nuw nsw i64 %indvars.iv244.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.end64, label %for.body56.epil, !llvm.loop !18
for.end64: ; preds = %for.end64.loopexit.unr-lcssa, %for.body56.epil, %for.cond54.preheader
%indvars.iv.next251 = add nsw i64 %indvars.iv250, 1
%inc67 = add nuw nsw i32 %j.1203, 1
%31 = trunc i64 %indvars.iv250 to i32
%exitcond253.not = icmp eq i32 %inc67, %sub
br i1 %exitcond253.not, label %for.cond69.preheader.thread, label %for.cond54.preheader, !llvm.loop !20
for.body71: ; preds = %for.body71, %for.body71.preheader.new
%indvars.iv254 = phi i64 [ 0, %for.body71.preheader.new ], [ %indvars.iv.next255.3, %for.body71 ]
%niter303 = phi i64 [ 0, %for.body71.preheader.new ], [ %niter303.next.3, %for.body71 ]
%32 = add nsw i64 %indvars.iv254, %22
%arrayidx75 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %32, i64 1
store i8 89, ptr %arrayidx75, align 1, !tbaa !11
%indvars.iv.next255 = or i64 %indvars.iv254, 1
%33 = add nsw i64 %indvars.iv.next255, %22
%arrayidx75.1 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %33, i64 1
store i8 89, ptr %arrayidx75.1, align 1, !tbaa !11
%indvars.iv.next255.1 = or i64 %indvars.iv254, 2
%34 = add nsw i64 %indvars.iv.next255.1, %22
%arrayidx75.2 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %34, i64 1
store i8 89, ptr %arrayidx75.2, align 1, !tbaa !11
%indvars.iv.next255.2 = or i64 %indvars.iv254, 3
%35 = add nsw i64 %indvars.iv.next255.2, %22
%arrayidx75.3 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %35, i64 1
store i8 89, ptr %arrayidx75.3, align 1, !tbaa !11
%indvars.iv.next255.3 = add nuw nsw i64 %indvars.iv254, 4
%niter303.next.3 = add i64 %niter303, 4
%niter303.ncmp.3 = icmp eq i64 %niter303.next.3, %unroll_iter302
br i1 %niter303.ncmp.3, label %for.inc79.loopexit.unr-lcssa, label %for.body71, !llvm.loop !21
for.inc79.loopexit.unr-lcssa: ; preds = %for.body71, %for.body71.preheader
%indvars.iv254.unr = phi i64 [ 0, %for.body71.preheader ], [ %indvars.iv.next255.3, %for.body71 ]
%lcmp.mod301.not = icmp eq i64 %xtraiter299, 0
br i1 %lcmp.mod301.not, label %for.inc79, label %for.body71.epil
for.body71.epil: ; preds = %for.inc79.loopexit.unr-lcssa, %for.body71.epil
%indvars.iv254.epil = phi i64 [ %indvars.iv.next255.epil, %for.body71.epil ], [ %indvars.iv254.unr, %for.inc79.loopexit.unr-lcssa ]
%epil.iter300 = phi i64 [ %epil.iter300.next, %for.body71.epil ], [ 0, %for.inc79.loopexit.unr-lcssa ]
%36 = add nsw i64 %indvars.iv254.epil, %22
%arrayidx75.epil = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %36, i64 1
store i8 89, ptr %arrayidx75.epil, align 1, !tbaa !11
%indvars.iv.next255.epil = add nuw nsw i64 %indvars.iv254.epil, 1
%epil.iter300.next = add i64 %epil.iter300, 1
%epil.iter300.cmp.not = icmp eq i64 %epil.iter300.next, %xtraiter299
br i1 %epil.iter300.cmp.not, label %for.inc79, label %for.body71.epil, !llvm.loop !22
for.inc79: ; preds = %for.inc79.loopexit.unr-lcssa, %for.body71.epil, %for.cond69.preheader, %for.body
%n.3 = phi i32 [ %n.0212, %for.body ], [ %add50, %for.cond69.preheader ], [ %n.2.lcssa292, %for.body71.epil ], [ %n.2.lcssa292, %for.inc79.loopexit.unr-lcssa ]
%indvars.iv.next261 = add nuw nsw i64 %indvars.iv260, 1
%exitcond264.not = icmp eq i64 %indvars.iv.next261, %wide.trip.count263
br i1 %exitcond264.not, label %for.cond82.preheader, label %for.body, !llvm.loop !23
for.end105: ; preds = %for.cond85.for.inc103_crit_edge.us
%call106 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.0.lcssa285)
%idxprom113 = zext i32 %n.0.lcssa285 to i64
%wide.trip.count278 = zext i32 %n.0.lcssa285 to i64
br label %for.body110
for.body110: ; preds = %for.end105, %for.body110
%indvars.iv275 = phi i64 [ 0, %for.end105 ], [ %indvars.iv.next276, %for.body110 ]
%arrayidx112 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %indvars.iv275
%arrayidx114 = getelementptr inbounds [1001 x [1001 x i8]], ptr @g, i64 0, i64 %indvars.iv275, i64 %idxprom113
store i8 0, ptr %arrayidx114, align 1, !tbaa !11
%call117 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %arrayidx112)
%indvars.iv.next276 = add nuw nsw i64 %indvars.iv275, 1
%exitcond279.not = icmp eq i64 %indvars.iv.next276, %wide.trip.count278
br i1 %exitcond279.not, label %for.end120, label %for.body110, !llvm.loop !24
for.end120: ; preds = %for.body110, %for.end105.thread
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %b3) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
|
#include <stdio.h>
int
main (
int argc,
char *argv[ ]
)
{
int i, j;
for ( ; ; )
{
int h, w;
scanf ( "%d%d", &h, &w );
if ( h == 0 && w == 0 ) break ;
for ( i = 0; i < h; ++i )
{
for ( j = 0; j < w; ++j )
{
if ( i == 0 || i == h - 1
|| j == 0 || j == w - 1 )
{
putchar ( '#' );
}
else
{
putchar ( '.' );
}
}
puts ( "" );
}
puts ( "" );
}
return ( 0 );
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100536/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100536/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp48 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp149 = icmp eq i32 %1, 0
%or.cond50 = select i1 %cmp48, i1 %cmp149, i1 false
br i1 %or.cond50, label %for.end24, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %cleanup
%2 = phi i32 [ %13, %cleanup ], [ %0, %entry ]
%cmp344 = icmp sgt i32 %2, 0
br i1 %cmp344, label %for.cond4.preheader, label %cleanup
for.cond4.preheader: ; preds = %for.cond2.preheader, %for.end
%i.045 = phi i32 [ %inc20, %for.end ], [ 0, %for.cond2.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp541 = icmp sgt i32 %3, 0
br i1 %cmp541, label %for.body6.lr.ph, label %for.end
for.body6.lr.ph: ; preds = %for.cond4.preheader
%cmp7 = icmp eq i32 %i.045, 0
br i1 %cmp7, label %for.body6.us, label %for.body6
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%j.042.us = phi i32 [ %inc.us, %for.body6.us ], [ 0, %for.body6.lr.ph ]
%4 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i.us = call noundef i32 @putc(i32 noundef 35, ptr noundef %4)
%inc.us = add nuw nsw i32 %j.042.us, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp5.us = icmp slt i32 %inc.us, %5
br i1 %cmp5.us, label %for.body6.us, label %for.end, !llvm.loop !11
for.body6: ; preds = %for.body6.lr.ph, %for.body6
%6 = phi i32 [ %9, %for.body6 ], [ %3, %for.body6.lr.ph ]
%j.042 = phi i32 [ %inc, %for.body6 ], [ 0, %for.body6.lr.ph ]
%7 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%cmp8 = icmp eq i32 %i.045, %sub
%cmp10 = icmp eq i32 %j.042, 0
%or.cond27 = or i1 %cmp10, %cmp8
%sub12 = add nsw i32 %6, -1
%cmp13 = icmp eq i32 %j.042, %sub12
%or.cond35 = select i1 %or.cond27, i1 true, i1 %cmp13
%8 = load ptr, ptr @stdout, align 8, !tbaa !9
%. = select i1 %or.cond35, i32 35, i32 46
%call.i = call noundef i32 @putc(i32 noundef %., ptr noundef %8)
%inc = add nuw nsw i32 %j.042, 1
%9 = load i32, ptr %w, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc, %9
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body6, %for.body6.us, %for.cond4.preheader
%10 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i37 = call noundef i32 @putc(i32 noundef 10, ptr noundef %10)
%inc20 = add nuw nsw i32 %i.045, 1
%11 = load i32, ptr %h, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc20, %11
br i1 %cmp3, label %for.cond4.preheader, label %cleanup, !llvm.loop !13
cleanup: ; preds = %for.end, %for.cond2.preheader
%12 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i38 = call noundef i32 @putc(i32 noundef 10, ptr noundef %12)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%13 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %13, 0
%14 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %14, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end24, label %for.cond2.preheader
for.end24: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
int main()
{
int h,w;
int i,j;
while(1)
{
scanf("%d %d",&h,&w);
if(h==0&&w==0)
{
break;
}
for(i=0;i<h;i++)
{
for(j=0;j<w;j++)
{
if(( i==0 )||( i==h-1 )||( j==0 )||( j==w-1 ))
{
printf("#");
}
else
{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100587/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100587/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.037, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.034 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp7 = icmp eq i32 %i.037, %sub
%cmp9 = icmp eq i32 %j.034, 0
%or.cond22 = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %j.034, %sub11
%or.cond32 = select i1 %or.cond22, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int w,h;
int i,j,k;
while(1){
scanf("%d %d",&h,&w);
if(h == 0 && w == 0) break;
for(i = 0;i < w;i++){
printf("#");
}
printf("\n");
for(i = 0;i < h - 2;i++){
printf("#");
for(j = 0;j < w - 2;j++){
printf(".");
}
printf("#\n");
}
if(h - 1 > 0){
for(i = 0; i < w;i++){
printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100637/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100637/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
%call56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp57 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp158 = icmp eq i32 %1, 0
%or.cond59 = select i1 %cmp57, i1 %cmp158, i1 false
br i1 %or.cond59, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %if.end32
%2 = phi i32 [ %11, %if.end32 ], [ %1, %entry ]
%cmp246 = icmp sgt i32 %2, 0
br i1 %cmp246, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%i.047 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%putchar45 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %i.047, 1
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc, %3
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp652 = icmp sgt i32 %4, 2
br i1 %cmp652, label %for.body7, label %for.end20
for.body7: ; preds = %for.end, %for.end16
%i.153 = phi i32 [ %inc19, %for.end16 ], [ 0, %for.end ]
%putchar43 = call i32 @putchar(i32 35)
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp1149 = icmp sgt i32 %5, 2
br i1 %cmp1149, label %for.body12, label %for.end16
for.body12: ; preds = %for.body7, %for.body12
%j.050 = phi i32 [ %inc15, %for.body12 ], [ 0, %for.body7 ]
%putchar44 = call i32 @putchar(i32 46)
%inc15 = add nuw nsw i32 %j.050, 1
%6 = load i32, ptr %w, align 4, !tbaa !5
%sub10 = add nsw i32 %6, -2
%cmp11 = icmp slt i32 %inc15, %sub10
br i1 %cmp11, label %for.body12, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.body12, %for.body7
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%inc19 = add nuw nsw i32 %i.153, 1
%7 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %7, -2
%cmp6 = icmp slt i32 %inc19, %sub
br i1 %cmp6, label %for.body7, label %for.end20, !llvm.loop !12
for.end20: ; preds = %for.end16, %for.end
%.lcssa = phi i32 [ %4, %for.end ], [ %7, %for.end16 ]
%cmp22 = icmp sgt i32 %.lcssa, 1
br i1 %cmp22, label %for.cond24.preheader, label %if.end32
for.cond24.preheader: ; preds = %for.end20
%8 = load i32, ptr %w, align 4, !tbaa !5
%cmp2554 = icmp sgt i32 %8, 0
br i1 %cmp2554, label %for.body26, label %for.end30
for.body26: ; preds = %for.cond24.preheader, %for.body26
%i.255 = phi i32 [ %inc29, %for.body26 ], [ 0, %for.cond24.preheader ]
%putchar42 = call i32 @putchar(i32 35)
%inc29 = add nuw nsw i32 %i.255, 1
%9 = load i32, ptr %w, align 4, !tbaa !5
%cmp25 = icmp slt i32 %inc29, %9
br i1 %cmp25, label %for.body26, label %for.end30, !llvm.loop !13
for.end30: ; preds = %for.body26, %for.cond24.preheader
%putchar40 = call i32 @putchar(i32 10)
br label %if.end32
if.end32: ; preds = %for.end30, %for.end20
%putchar41 = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
%11 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %11, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %if.end32, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(void){
int h,w,i,j,k;
for(i = 0;;i++){
scanf("%d%d",&h,&w);
if(h==0 && w==0)break;
for(j = 0;j < h;j++){
for(k = 0;k < w;k++){
if(j == 0 || j == h-1)
printf("#");
else if(k == 0 || k == w-1)
printf("#");
else
printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100695/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100695/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp47 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp148 = icmp eq i32 %1, 0
%or.cond49 = select i1 %cmp47, i1 %cmp148, i1 false
br i1 %or.cond49, label %for.end28, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end24
%2 = phi i32 [ %11, %for.end24 ], [ %0, %entry ]
%cmp343 = icmp sgt i32 %2, 0
br i1 %cmp343, label %for.cond4.preheader, label %for.end24
for.cond4.preheader: ; preds = %for.cond2.preheader, %for.end
%j.044 = phi i32 [ %inc23, %for.end ], [ 0, %for.cond2.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp540 = icmp sgt i32 %3, 0
br i1 %cmp540, label %for.body6.lr.ph, label %for.end
for.body6.lr.ph: ; preds = %for.cond4.preheader
%cmp7 = icmp eq i32 %j.044, 0
br i1 %cmp7, label %for.body6.us, label %for.body6.preheader
for.body6.preheader: ; preds = %for.body6.lr.ph
%putchar38.peel = call i32 @putchar(i32 35)
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp5.peel = icmp sgt i32 %4, 1
br i1 %cmp5.peel, label %for.body6, label %for.end
for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us
%k.041.us = phi i32 [ %inc.us, %for.body6.us ], [ 0, %for.body6.lr.ph ]
%putchar38.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %k.041.us, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp5.us = icmp slt i32 %inc.us, %5
br i1 %cmp5.us, label %for.body6.us, label %for.end, !llvm.loop !9
for.body6: ; preds = %for.body6.preheader, %for.body6
%6 = phi i32 [ %9, %for.body6 ], [ %4, %for.body6.preheader ]
%k.041 = phi i32 [ %inc, %for.body6 ], [ 1, %for.body6.preheader ]
%7 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%cmp8 = icmp eq i32 %j.044, %sub
%sub13 = add nsw i32 %6, -1
%cmp14 = icmp eq i32 %k.041, %sub13
%8 = select i1 %cmp8, i1 true, i1 %cmp14
%.sink = select i1 %8, i32 35, i32 46
%putchar38 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %k.041, 1
%9 = load i32, ptr %w, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc, %9
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body6, %for.body6.us, %for.body6.preheader, %for.cond4.preheader
%putchar35 = call i32 @putchar(i32 10)
%inc23 = add nuw nsw i32 %j.044, 1
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc23, %10
br i1 %cmp3, label %for.cond4.preheader, label %for.end24, !llvm.loop !13
for.end24: ; preds = %for.end, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%11 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %11, 0
%12 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %12, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end28, label %for.cond2.preheader
for.end28: ; preds = %for.end24, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
void mid(int w) {
int i;
for (i=0; i<w; i++) {
if (i == 0) {
printf("#");
continue;
}
if (i == w-1) {
printf("#\n");
continue;
}
printf(".");
}
}
void draw(int h, int w) {
int i, j;
for (i=0; i<h; i++) {
if (i == 0 || i == h-1) {
for (j=0; j<w; j++) printf("#");
printf("\n");
} else {
mid(w);
}
}
}
void process() {
int h, w;
do {
scanf("%d %d", &h, &w);
if (h == 0 && w == 0) break;
draw(h, w);
printf("\n");
} while (h != 0 || w != 0);
}
int main(void) {
process();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100738/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100738/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.4 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @mid(i32 noundef %w) local_unnamed_addr #0 {
entry:
%cmp12 = icmp sgt i32 %w, 0
br i1 %cmp12, label %for.inc.peel, label %for.end
for.inc.peel: ; preds = %entry
%sub = add nsw i32 %w, -1
%putchar11.peel = tail call i32 @putchar(i32 35)
%exitcond.peel.not = icmp eq i32 %w, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %for.inc.peel, %for.inc
%i.013 = phi i32 [ %inc, %for.inc ], [ 1, %for.inc.peel ]
%cmp2 = icmp eq i32 %i.013, %sub
br i1 %cmp2, label %if.then3, label %if.end5
if.then3: ; preds = %if.end
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.end5: ; preds = %if.end
%putchar = tail call i32 @putchar(i32 46)
br label %for.inc
for.inc: ; preds = %if.end5, %if.then3
%inc = add nuw nsw i32 %i.013, 1
%exitcond.not = icmp eq i32 %inc, %w
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !5
for.end: ; preds = %for.inc, %for.inc.peel, %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 void @draw(i32 noundef %h, i32 noundef %w) local_unnamed_addr #0 {
entry:
%cmp19 = icmp sgt i32 %h, 0
br i1 %cmp19, label %for.body.lr.ph, label %for.end9
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %h, -1
%cmp12.i = icmp sgt i32 %w, 0
%sub.i = add nsw i32 %w, -1
br i1 %cmp12.i, label %for.body.lr.ph.split.us, label %for.inc7.peel
for.inc7.peel: ; preds = %for.body.lr.ph
%putchar.peel = tail call i32 @putchar(i32 10)
%exitcond.peel.not = icmp eq i32 %h, 1
br i1 %exitcond.peel.not, label %for.end9, label %for.body
for.body.lr.ph.split.us: ; preds = %for.body.lr.ph
%exitcond.peel.not.i = icmp eq i32 %w, 1
br i1 %exitcond.peel.not.i, label %for.body.us.us.us.peel, label %for.body.us
for.body.us.us.us.peel: ; preds = %for.body.lr.ph.split.us
%putchar16.us.us.us.peel = tail call i32 @putchar(i32 35)
%putchar.us.us.us.peel = tail call i32 @putchar(i32 10)
%exitcond48.not.peel = icmp eq i32 %h, 1
br i1 %exitcond48.not.peel, label %for.end9, label %for.body.us.us.us
for.body.us.us.us: ; preds = %for.body.us.us.us.peel, %for.inc7.us.us.us
%i.020.us.us.us = phi i32 [ %inc8.us.us.us, %for.inc7.us.us.us ], [ 1, %for.body.us.us.us.peel ]
%cmp2.us.us.us = icmp eq i32 %i.020.us.us.us, %sub
%putchar16.us.us.us = tail call i32 @putchar(i32 35)
br i1 %cmp2.us.us.us, label %for.cond3.for.end_crit_edge.us.us.us, label %for.inc7.us.us.us
for.inc7.us.us.us: ; preds = %for.body.us.us.us, %for.cond3.for.end_crit_edge.us.us.us
%inc8.us.us.us = add nuw nsw i32 %i.020.us.us.us, 1
%exitcond48.not = icmp eq i32 %inc8.us.us.us, %h
br i1 %exitcond48.not, label %for.end9, label %for.body.us.us.us, !llvm.loop !8
for.cond3.for.end_crit_edge.us.us.us: ; preds = %for.body.us.us.us
%putchar.us.us.us = tail call i32 @putchar(i32 10)
br label %for.inc7.us.us.us
for.body.us: ; preds = %for.body.lr.ph.split.us, %for.inc7.us
%i.020.us = phi i32 [ %inc8.us, %for.inc7.us ], [ 0, %for.body.lr.ph.split.us ]
%cmp1.us = icmp eq i32 %i.020.us, 0
%cmp2.us = icmp eq i32 %i.020.us, %sub
%or.cond.us = select i1 %cmp1.us, i1 true, i1 %cmp2.us
br i1 %or.cond.us, label %for.body5.us, label %if.else.us
if.else.us: ; preds = %for.body.us
%putchar11.peel.i.us = tail call i32 @putchar(i32 35)
br label %if.end.i.us
if.end.i.us: ; preds = %if.else.us, %for.inc.i.us
%i.013.i.us = phi i32 [ %inc.i.us, %for.inc.i.us ], [ 1, %if.else.us ]
%cmp2.i.us = icmp eq i32 %i.013.i.us, %sub.i
br i1 %cmp2.i.us, label %if.then3.i.us, label %if.end5.i.us
if.end5.i.us: ; preds = %if.end.i.us
%putchar.i.us = tail call i32 @putchar(i32 46)
br label %for.inc.i.us
if.then3.i.us: ; preds = %if.end.i.us
%puts.i.us = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc.i.us
for.inc.i.us: ; preds = %if.then3.i.us, %if.end5.i.us
%inc.i.us = add nuw nsw i32 %i.013.i.us, 1
%exitcond.not.i.us = icmp eq i32 %inc.i.us, %w
br i1 %exitcond.not.i.us, label %for.inc7.us, label %if.end.i.us, !llvm.loop !5
for.end.us: ; preds = %for.body5.us
%putchar.us = tail call i32 @putchar(i32 10)
br label %for.inc7.us
for.inc7.us: ; preds = %for.inc.i.us, %for.end.us
%inc8.us = add nuw nsw i32 %i.020.us, 1
%exitcond45.not = icmp eq i32 %inc8.us, %h
br i1 %exitcond45.not, label %for.end9, label %for.body.us, !llvm.loop !9
for.body5.us: ; preds = %for.body.us, %for.body5.us
%j.018.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body.us ]
%putchar16.us = tail call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.018.us, 1
%exitcond44.not = icmp eq i32 %inc.us, %w
br i1 %exitcond44.not, label %for.end.us, label %for.body5.us, !llvm.loop !10
for.body: ; preds = %for.inc7.peel, %for.inc7
%i.020 = phi i32 [ %inc8, %for.inc7 ], [ 1, %for.inc7.peel ]
%cmp2 = icmp eq i32 %i.020, %sub
br i1 %cmp2, label %for.cond3.preheader, label %for.inc7
for.cond3.preheader: ; preds = %for.body
%putchar = tail call i32 @putchar(i32 10)
br label %for.inc7
for.inc7: ; preds = %for.body, %for.cond3.preheader
%inc8 = add nuw nsw i32 %i.020, 1
%exitcond.not = icmp eq i32 %inc8, %h
br i1 %exitcond.not, label %for.end9, label %for.body, !llvm.loop !11
for.end9: ; preds = %for.inc7, %for.inc7.us, %for.body.us.us.us.peel, %for.inc7.us.us.us, %for.inc7.peel, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @process() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
br label %do.body
do.body: ; preds = %if.end, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !12
%cmp = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %1, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %do.end, label %if.end
if.end: ; preds = %do.body
call void @draw(i32 noundef %0, i32 noundef %1)
%putchar = call i32 @putchar(i32 10)
%2 = load i32, ptr %h, align 4, !tbaa !12
%cmp3 = icmp ne i32 %2, 0
%3 = load i32, ptr %w, align 4
%cmp4 = icmp ne i32 %3, 0
%4 = select i1 %cmp3, i1 true, i1 %cmp4
br i1 %4, label %do.body, label %do.end, !llvm.loop !16
do.end: ; preds = %do.body, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret void
}
; 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 @main() local_unnamed_addr #0 {
entry:
%h.i = alloca i32, align 4
%w.i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h.i) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w.i) #4
br label %do.body.i
do.body.i: ; preds = %if.end.i, %entry
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %h.i, ptr noundef nonnull %w.i)
%0 = load i32, ptr %h.i, align 4, !tbaa !12
%cmp.i = icmp eq i32 %0, 0
%1 = load i32, ptr %w.i, align 4
%cmp1.i = icmp eq i32 %1, 0
%or.cond.i = select i1 %cmp.i, i1 %cmp1.i, i1 false
br i1 %or.cond.i, label %process.exit, label %if.end.i
if.end.i: ; preds = %do.body.i
call void @draw(i32 noundef %0, i32 noundef %1)
%putchar.i = call i32 @putchar(i32 10)
%2 = load i32, ptr %h.i, align 4, !tbaa !12
%cmp3.i = icmp ne i32 %2, 0
%3 = load i32, ptr %w.i, align 4
%cmp4.i = icmp ne i32 %3, 0
%4 = select i1 %cmp3.i, i1 true, i1 %cmp4.i
br i1 %4, label %do.body.i, label %process.exit, !llvm.loop !16
process.exit: ; preds = %do.body.i, %if.end.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w.i) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h.i) #4
ret i32 0
}
; 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 = distinct !{!5, !6, !7}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.peeled.count", i32 1}
!8 = distinct !{!8, !6, !7}
!9 = distinct !{!9, !6}
!10 = distinct !{!10, !6}
!11 = distinct !{!11, !6, !7}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !14, i64 0}
!14 = !{!"omnipotent char", !15, i64 0}
!15 = !{!"Simple C/C++ TBAA"}
!16 = distinct !{!16, !6}
|
#include<stdio.h>
int rectangle(int tate,int yoko);
int main(void){
int H[1000],W[1000],a,j;
j=0;
while(1){
scanf("%d %d",&H[j] ,&W[j]);
if((H[j]==0)&&(W[j]==0)){
break;
}
j++;
}
for(a=0;a<j;a++){
rectangle(H[a],W[a]);
printf("\n");
}
return 0;
}
int rectangle(int tate,int yoko){
int h,i;
for(h=0;h<tate;h++){
for(i=0;i<yoko;i++){
if((h>0)&&(h<tate-1)&&(i>0)&&(i<yoko-1)){
printf(".");
}
else{
printf("#");
}
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100781/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100781/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca [1000 x i32], align 16
%W = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %W) #4
br label %while.cond
while.cond: ; preds = %if.end, %entry
%indvars.iv30 = phi i32 [ %indvars.iv.next31, %if.end ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %H, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr %W, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.cond
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp7 = icmp eq i32 %1, 0
br i1 %cmp7, label %for.cond.preheader, label %if.end
for.cond.preheader: ; preds = %land.lhs.true
%2 = and i64 %indvars.iv, 4294967295
%cmp824.not = icmp eq i64 %2, 0
br i1 %cmp824.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %indvars.iv30 to i64
br label %for.body
if.end: ; preds = %land.lhs.true, %while.cond
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next31 = add nuw i32 %indvars.iv30, 1
br label %while.cond
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv27 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next28, %for.body ]
%arrayidx10 = getelementptr inbounds [1000 x i32], ptr %H, i64 0, i64 %indvars.iv27
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [1000 x i32], ptr %W, i64 0, i64 %indvars.iv27
%4 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 @rectangle(i32 noundef %3, i32 noundef %4)
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%exitcond.not = icmp eq i64 %indvars.iv.next28, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @rectangle(i32 noundef %tate, i32 noundef %yoko) local_unnamed_addr #0 {
entry:
%cmp37 = icmp sgt i32 %tate, 0
br i1 %cmp37, label %for.cond1.preheader.lr.ph, label %for.end15
for.cond1.preheader.lr.ph: ; preds = %entry
%cmp227 = icmp sgt i32 %yoko, 0
%sub = add nsw i32 %tate, -1
%sub9 = add nsw i32 %yoko, -1
br i1 %cmp227, label %for.cond1.preheader.us.preheader, label %for.cond1.preheader
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph
%exitcond52.peel.not = icmp eq i32 %yoko, 1
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.end_crit_edge.us
%h.038.us = phi i32 [ %inc14.us, %for.cond1.for.end_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ]
%cmp4.not.us = icmp eq i32 %h.038.us, 0
br i1 %cmp4.not.us, label %for.body3.us.us, label %for.body3.lr.ph.split.us45
for.body3.us39: ; preds = %for.inc.us.peel, %for.body3.us39
%i.028.us40 = phi i32 [ %inc.us42, %for.body3.us39 ], [ 1, %for.inc.us.peel ]
%cmp10.us = icmp slt i32 %i.028.us40, %sub9
%. = select i1 %cmp10.us, i32 46, i32 35
%putchar24.us41 = tail call i32 @putchar(i32 %.)
%inc.us42 = add nuw nsw i32 %i.028.us40, 1
%exitcond52.not = icmp eq i32 %inc.us42, %yoko
br i1 %exitcond52.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us39, !llvm.loop !11
for.body3.lr.ph.split.us45: ; preds = %for.cond1.preheader.us
%cmp5.us = icmp slt i32 %h.038.us, %sub
%cmp5.fr.us = freeze i1 %cmp5.us
br i1 %cmp5.fr.us, label %for.inc.us.peel, label %for.body3.us30.us
for.inc.us.peel: ; preds = %for.body3.lr.ph.split.us45
%putchar24.us41.peel = tail call i32 @putchar(i32 35)
br i1 %exitcond52.peel.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us39
for.cond1.for.end_crit_edge.us: ; preds = %for.body3.us30.us, %for.body3.us39, %for.body3.us.us, %for.inc.us.peel
%putchar.us = tail call i32 @putchar(i32 10)
%inc14.us = add nuw nsw i32 %h.038.us, 1
%exitcond55.not = icmp eq i32 %inc14.us, %tate
br i1 %exitcond55.not, label %for.end15, label %for.cond1.preheader.us, !llvm.loop !13
for.body3.us.us: ; preds = %for.cond1.preheader.us, %for.body3.us.us
%i.028.us.us = phi i32 [ %inc.us.us, %for.body3.us.us ], [ 0, %for.cond1.preheader.us ]
%putchar24.us.us = tail call i32 @putchar(i32 35)
%inc.us.us = add nuw nsw i32 %i.028.us.us, 1
%exitcond54.not = icmp eq i32 %inc.us.us, %yoko
br i1 %exitcond54.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us.us, !llvm.loop !14
for.body3.us30.us: ; preds = %for.body3.lr.ph.split.us45, %for.body3.us30.us
%i.028.us31.us = phi i32 [ %inc.us35.us, %for.body3.us30.us ], [ 0, %for.body3.lr.ph.split.us45 ]
%putchar24.us33.us = tail call i32 @putchar(i32 35)
%inc.us35.us = add nuw nsw i32 %i.028.us31.us, 1
%exitcond51.not = icmp eq i32 %inc.us35.us, %yoko
br i1 %exitcond51.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us30.us, !llvm.loop !14
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.preheader
%h.038 = phi i32 [ %inc14, %for.cond1.preheader ], [ 0, %for.cond1.preheader.lr.ph ]
%putchar = tail call i32 @putchar(i32 10)
%inc14 = add nuw nsw i32 %h.038, 1
%exitcond.not = icmp eq i32 %inc14, %tate
br i1 %exitcond.not, label %for.end15, label %for.cond1.preheader, !llvm.loop !13
for.end15: ; preds = %for.cond1.preheader, %for.cond1.for.end_crit_edge.us, %entry
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(){
while(1){
int h,w;
int i,j;
scanf("%d %d",&h,&w);
if(h==0 && w==0) break;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if(i==0 || i==h-1 || j==0 || j==w-1){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100824/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100824/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp45 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp146 = icmp eq i32 %1, 0
%or.cond47 = select i1 %cmp45, i1 %cmp146, i1 false
br i1 %or.cond47, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %cleanup
%2 = phi i32 [ %9, %cleanup ], [ %0, %entry ]
%cmp241 = icmp sgt i32 %2, 0
br i1 %cmp241, label %for.cond3.preheader, label %cleanup
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.042 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp438 = icmp sgt i32 %3, 0
br i1 %cmp438, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.042, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.039.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar34.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.039.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.039 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp7 = icmp eq i32 %i.042, %sub
%cmp9 = icmp eq i32 %j.039, 0
%or.cond25 = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %j.039, %sub11
%or.cond35 = select i1 %or.cond25, i1 true, i1 %cmp12
%. = select i1 %or.cond35, i32 35, i32 46
%putchar34 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.039, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar32 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.042, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %cleanup, !llvm.loop !11
cleanup: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int a,b,i,j;
while(1) {
scanf("%d%d",&a,&b);
if(a==0&&b==0){break;}
for(i=1;i<=a;i++) {
for(j=1;j<=b;j++) {
if(i>1&&i<a&&j<b&&j>1)printf(".");
else printf("#"); }
printf("\n"); }
printf("\n"); }
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100868/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100868/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; 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
%call39 = 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
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %b, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp2.not36 = icmp slt i32 %2, 1
br i1 %cmp2.not36, label %for.end20, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp4.not33 = icmp slt i32 %3, 1
br i1 %cmp4.not33, label %for.end, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp ugt i32 %i.037, 1
br i1 %cmp6, label %for.body5, label %for.body5.us
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 1, %for.body5.lr.ph ]
%putchar30.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %b, align 4, !tbaa !5
%cmp4.not.us.not = icmp slt i32 %j.034.us, %4
br i1 %cmp4.not.us.not, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.inc
%5 = phi i32 [ %7, %for.inc ], [ %3, %for.body5.lr.ph ]
%j.034 = phi i32 [ %inc, %for.inc ], [ 1, %for.body5.lr.ph ]
%6 = load i32, ptr %a, align 4
%cmp8 = icmp slt i32 %i.037, %6
br i1 %cmp8, label %land.lhs.true9, label %if.else
land.lhs.true9: ; preds = %for.body5
%cmp10 = icmp slt i32 %j.034, %5
%cmp12 = icmp ugt i32 %j.034, 1
%or.cond22 = and i1 %cmp12, %cmp10
br i1 %or.cond22, label %for.inc, label %if.else
if.else: ; preds = %land.lhs.true9, %for.body5
br label %for.inc
for.inc: ; preds = %land.lhs.true9, %if.else
%.sink = phi i32 [ 35, %if.else ], [ 46, %land.lhs.true9 ]
%putchar31 = call i32 @putchar(i32 %.sink)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %b, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %j.034, %7
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5.us, %for.inc, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add i32 %i.037, 1
%8 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.not = icmp sgt i32 %inc19, %8
br i1 %cmp2.not, label %for.end20, label %for.cond3.preheader, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %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 %for.cond.preheader
while.end: ; preds = %for.end20, %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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main()
{
int h,w;
int i,j;
scanf("%d",&h);
scanf("%d",&w);
while(!((h==0) && (w==0))){
for(i=0;i<w;i++){
printf("#");
}
printf("\n");
for(i=0;i<h-2;i++){
printf("#");
for(j=0;j<w-2;j++){
printf(".");
}
printf("#\n");
}
for(i=0;i<w;i++){
printf("#");
}
printf("\n\n");
scanf("%d",&h);
scanf("%d",&w);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100918/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100918/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp53 = icmp ne i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp254 = icmp ne i32 %1, 0
%.not55 = select i1 %cmp53, i1 true, i1 %cmp254
br i1 %.not55, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %for.end28
%2 = phi i32 [ %11, %for.end28 ], [ %1, %entry ]
%cmp343 = icmp sgt i32 %2, 0
br i1 %cmp343, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%i.044 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%putchar42 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %i.044, 1
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %3
br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp749 = icmp sgt i32 %4, 2
br i1 %cmp749, label %for.body8, label %for.cond22.preheader
for.cond22.preheader: ; preds = %for.end17, %for.end
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp2351 = icmp sgt i32 %5, 0
br i1 %cmp2351, label %for.body24, label %for.end28
for.body8: ; preds = %for.end, %for.end17
%i.150 = phi i32 [ %inc20, %for.end17 ], [ 0, %for.end ]
%putchar39 = call i32 @putchar(i32 35)
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp1246 = icmp sgt i32 %6, 2
br i1 %cmp1246, label %for.body13, label %for.end17
for.body13: ; preds = %for.body8, %for.body13
%j.047 = phi i32 [ %inc16, %for.body13 ], [ 0, %for.body8 ]
%putchar41 = call i32 @putchar(i32 46)
%inc16 = add nuw nsw i32 %j.047, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%sub11 = add nsw i32 %7, -2
%cmp12 = icmp slt i32 %inc16, %sub11
br i1 %cmp12, label %for.body13, label %for.end17, !llvm.loop !11
for.end17: ; preds = %for.body13, %for.body8
%puts40 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc20 = add nuw nsw i32 %i.150, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %8, -2
%cmp7 = icmp slt i32 %inc20, %sub
br i1 %cmp7, label %for.body8, label %for.cond22.preheader, !llvm.loop !12
for.body24: ; preds = %for.cond22.preheader, %for.body24
%i.252 = phi i32 [ %inc27, %for.body24 ], [ 0, %for.cond22.preheader ]
%putchar38 = call i32 @putchar(i32 35)
%inc27 = add nuw nsw i32 %i.252, 1
%9 = load i32, ptr %w, align 4, !tbaa !5
%cmp23 = icmp slt i32 %inc27, %9
br i1 %cmp23, label %for.body24, label %for.end28, !llvm.loop !13
for.end28: ; preds = %for.body24, %for.cond22.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%call30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%10 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp ne i32 %10, 0
%11 = load i32, ptr %w, align 4
%cmp2 = icmp ne i32 %11, 0
%.not = select i1 %cmp, i1 true, i1 %cmp2
br i1 %.not, label %for.cond.preheader, label %while.end, !llvm.loop !14
while.end: ; preds = %for.end28, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(void)
{
int i,j;
int H,W;
while(1){
scanf("%d %d",&H,&W);
if(H == 0 && W == 0)break;
else
for(i=1;i<=H;i++){
for(j=1;j<=W;j++){
if(i == 1||j == 1||i == H||j == W){
printf("#");
}
else {
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100969/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100969/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %if.end20
%2 = phi i32 [ %9, %if.end20 ], [ %0, %entry ]
%cmp2.not36 = icmp slt i32 %2, 1
br i1 %cmp2.not36, label %if.end20, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc18, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not34 = icmp slt i32 %3, 1
br i1 %cmp4.not34, label %for.end, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.037, 1
br i1 %cmp6, label %for.body5.us, label %for.inc.peel
for.inc.peel: ; preds = %for.body5.lr.ph
%putchar31.peel = call i32 @putchar(i32 35)
%.pre = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.not.peel = icmp sgt i32 %.pre, 1
br i1 %cmp4.not.not.peel, label %for.body5, label %for.end
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.035.us = phi i32 [ %inc.us, %for.body5.us ], [ 1, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.035.us, 1
%4 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.us.not = icmp slt i32 %j.035.us, %4
br i1 %cmp4.not.us.not, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.inc.peel, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %.pre, %for.inc.peel ]
%j.035 = phi i32 [ %inc, %for.body5 ], [ 2, %for.inc.peel ]
%6 = load i32, ptr %H, align 4
%cmp9 = icmp eq i32 %i.037, %6
%cmp11 = icmp eq i32 %j.035, %5
%or.cond33 = or i1 %cmp11, %cmp9
%. = select i1 %or.cond33, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.035, 1
%7 = load i32, ptr %W, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %j.035, %7
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body5, %for.body5.us, %for.inc.peel, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc18 = add i32 %i.037, 1
%8 = load i32, ptr %H, align 4
%cmp2.not = icmp sgt i32 %inc18, %8
br i1 %cmp2.not, label %if.end20, label %for.cond3.preheader, !llvm.loop !13
if.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
%9 = load i32, ptr %H, align 4
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %W, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %if.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(){
int h,w;
int i,j;
while(1){
scanf("%d %d",&h,&w);
if(h==0 && w==0) break;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if(i==0 || i==h-1 || j==0 || j==w-1) printf("#");
else{printf(".");}
}
printf("\n");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101010/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101010/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp40 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp141 = icmp eq i32 %1, 0
%or.cond42 = select i1 %cmp40, i1 %cmp141, i1 false
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end20
%2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ]
%cmp236 = icmp sgt i32 %2, 0
br i1 %cmp236, label %for.cond3.preheader, label %for.end20
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.037 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5.lr.ph, label %for.end
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.037, 0
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ]
%putchar31.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.034.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %inc.us, %4
br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.034 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ]
%6 = load i32, ptr %h, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp7 = icmp eq i32 %i.037, %sub
%cmp9 = icmp eq i32 %j.034, 0
%or.cond22 = or i1 %cmp9, %cmp7
%sub11 = add nsw i32 %5, -1
%cmp12 = icmp eq i32 %j.034, %sub11
%or.cond32 = select i1 %or.cond22, i1 true, i1 %cmp12
%. = select i1 %or.cond32, i32 35, i32 46
%putchar31 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.034, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar29 = call i32 @putchar(i32 10)
%inc19 = add nuw nsw i32 %i.037, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc19, %8
br i1 %cmp2, label %for.cond3.preheader, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int H;
int W;
int iCount;
int iCount1;
int iCount2;
int iPutNum = 0;
int iH[1000];
int iW[1000];
//Hの入力
scanf("%d", &H);
//Wの入力
scanf("%d", &W);
while (H != 0 || W != 0)
{
iH[iPutNum] = H;
iW[iPutNum] = W;
//Hの入力
scanf("%d", &H);
//Wの入力
scanf("%d", &W);
iPutNum++;
}
//長方形を書く部分
for (iCount = 0; iCount < iPutNum; iCount++)
{
//縦のループ
for (iCount1 = 0; iCount1 < iH[iCount]; iCount1++)
{
//フレーム部分
if (iCount1 == 0 || iCount1 == iH[iCount]-1)
{
//横のループ
for (iCount2 = 0; iCount2 < iW[iCount]; iCount2++)
{
printf("#");
}
printf("\n");
}
//フレームの中身
else
{
//横のループ
for (iCount2 = 0; iCount2 < iW[iCount]; iCount2++)
{
if (iCount2 == 0 || iCount2 == iW[iCount] - 1)
{
printf("#");
}
else
{
printf(".");
}
}
printf("\n");
}
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101054/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101054/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%H = alloca i32, align 4
%W = alloca i32, align 4
%iH = alloca [1000 x i32], align 16
%iW = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %iH) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %iW) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp76 = icmp ne i32 %0, 0
%1 = load i32, ptr %W, align 4
%cmp277 = icmp ne i32 %1, 0
%2 = select i1 %cmp76, i1 true, i1 %cmp277
br i1 %2, label %while.body, label %for.end51
for.cond.preheader: ; preds = %while.body
%3 = and i64 %indvars.iv.next, 4294967295
%cmp785.not = icmp eq i64 %3, 0
br i1 %cmp785.not, label %for.end51, label %for.cond8.preheader.preheader
for.cond8.preheader.preheader: ; preds = %for.cond.preheader
%wide.trip.count = and i64 %indvars.iv.next, 4294967295
br label %for.cond8.preheader
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%4 = phi i32 [ %7, %while.body ], [ %1, %entry ]
%5 = phi i32 [ %6, %while.body ], [ %0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %iH, i64 0, i64 %indvars.iv
store i32 %5, ptr %arrayidx, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds [1000 x i32], ptr %iW, i64 0, i64 %indvars.iv
store i32 %4, ptr %arrayidx4, align 4, !tbaa !5
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H)
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%6 = load i32, ptr %H, align 4, !tbaa !5
%cmp = icmp ne i32 %6, 0
%7 = load i32, ptr %W, align 4
%cmp2 = icmp ne i32 %7, 0
%8 = select i1 %cmp, i1 true, i1 %cmp2
br i1 %8, label %while.body, label %for.cond.preheader, !llvm.loop !9
for.cond8.preheader: ; preds = %for.cond8.preheader.preheader, %for.end47
%indvars.iv91 = phi i64 [ 0, %for.cond8.preheader.preheader ], [ %indvars.iv.next92, %for.end47 ]
%arrayidx10 = getelementptr inbounds [1000 x i32], ptr %iH, i64 0, i64 %indvars.iv91
%9 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp1183 = icmp sgt i32 %9, 0
br i1 %cmp1183, label %for.body12.lr.ph, label %for.end47
for.body12.lr.ph: ; preds = %for.cond8.preheader
%sub = add nsw i32 %9, -1
%arrayidx27 = getelementptr inbounds [1000 x i32], ptr %iW, i64 0, i64 %indvars.iv91
%10 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp2081 = icmp sgt i32 %10, 0
%sub34 = add nsw i32 %10, -1
%exitcond.peel.not = icmp eq i32 %10, 1
br label %for.body12
for.body12: ; preds = %for.body12.lr.ph, %for.inc45
%iCount1.084 = phi i32 [ 0, %for.body12.lr.ph ], [ %inc46, %for.inc45 ]
%cmp13 = icmp eq i32 %iCount1.084, 0
%cmp16 = icmp eq i32 %iCount1.084, %sub
%or.cond = select i1 %cmp13, i1 true, i1 %cmp16
br i1 %or.cond, label %for.cond17.preheader, label %for.cond25.preheader
for.cond25.preheader: ; preds = %for.body12
br i1 %cmp2081, label %for.inc40.peel, label %for.inc45
for.inc40.peel: ; preds = %for.cond25.preheader
%putchar72.peel = call i32 @putchar(i32 35)
br i1 %exitcond.peel.not, label %for.inc45, label %for.body29
for.cond17.preheader: ; preds = %for.body12
br i1 %cmp2081, label %for.body21, label %for.inc45
for.body21: ; preds = %for.cond17.preheader, %for.body21
%iCount2.082 = phi i32 [ %inc23, %for.body21 ], [ 0, %for.cond17.preheader ]
%putchar74 = call i32 @putchar(i32 35)
%inc23 = add nuw nsw i32 %iCount2.082, 1
%exitcond89.not = icmp eq i32 %inc23, %10
br i1 %exitcond89.not, label %for.inc45, label %for.body21, !llvm.loop !11
for.body29: ; preds = %for.inc40.peel, %for.body29
%iCount2.180 = phi i32 [ %inc41, %for.body29 ], [ 1, %for.inc40.peel ]
%cmp35 = icmp eq i32 %iCount2.180, %sub34
%. = select i1 %cmp35, i32 35, i32 46
%putchar72 = call i32 @putchar(i32 %.)
%inc41 = add nuw nsw i32 %iCount2.180, 1
%exitcond.not = icmp eq i32 %inc41, %10
br i1 %exitcond.not, label %for.inc45, label %for.body29, !llvm.loop !12
for.inc45: ; preds = %for.body29, %for.body21, %for.cond25.preheader, %for.inc40.peel, %for.cond17.preheader
%putchar73 = call i32 @putchar(i32 10)
%inc46 = add nuw nsw i32 %iCount1.084, 1
%exitcond90.not = icmp eq i32 %inc46, %9
br i1 %exitcond90.not, label %for.end47, label %for.body12, !llvm.loop !14
for.end47: ; preds = %for.inc45, %for.cond8.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%exitcond94.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count
br i1 %exitcond94.not, label %for.end51, label %for.cond8.preheader, !llvm.loop !15
for.end51: ; preds = %for.end47, %entry, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %iW) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %iH) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
void printFrame(int h, int w) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (i == 0 || i == h - 1 || j == 0 || j == w - 1) {
printf("#");
} else {
printf(".");
}
}
printf("\n");
}
printf("\n");
}
int main() {
int h, w;
while (1) {
scanf("%d %d", &h, &w);
if (h == 0 && w == 0) break;
printFrame(h, w);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101184/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101184/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.3 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printFrame(i32 noundef %h, i32 noundef %w) local_unnamed_addr #0 {
entry:
%cmp40 = icmp sgt i32 %h, 0
br i1 %cmp40, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup
for.cond1.preheader.lr.ph: ; preds = %entry
%cmp230 = icmp sgt i32 %w, 0
%sub = add nsw i32 %h, -1
%sub10 = add nsw i32 %w, -1
br i1 %cmp230, label %for.cond1.preheader.us.preheader, label %for.cond1.preheader
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph
%exitcond54.peel.not = icmp eq i32 %w, 1
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us
%i.041.us = phi i32 [ %inc15.us, %for.cond1.for.cond.cleanup3_crit_edge.us ], [ 0, %for.cond1.preheader.us.preheader ]
%cmp5.us = icmp eq i32 %i.041.us, 0
br i1 %cmp5.us, label %for.body4.us.us, label %for.body4.lr.ph.split.us48
for.body4.us42: ; preds = %for.inc.us.peel, %for.body4.us42
%j.031.us43 = phi i32 [ %inc.us45, %for.body4.us42 ], [ 1, %for.inc.us.peel ]
%cmp11.us = icmp eq i32 %j.031.us43, %sub10
%. = select i1 %cmp11.us, i32 35, i32 46
%putchar28.us44 = tail call i32 @putchar(i32 %.)
%inc.us45 = add nuw nsw i32 %j.031.us43, 1
%exitcond54.not = icmp eq i32 %inc.us45, %w
br i1 %exitcond54.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us42, !llvm.loop !5
for.body4.lr.ph.split.us48: ; preds = %for.cond1.preheader.us
%cmp6.us = icmp eq i32 %i.041.us, %sub
%cmp6.fr.us = freeze i1 %cmp6.us
br i1 %cmp6.fr.us, label %for.body4.us33.us, label %for.inc.us.peel
for.inc.us.peel: ; preds = %for.body4.lr.ph.split.us48
%putchar28.us44.peel = tail call i32 @putchar(i32 35)
br i1 %exitcond54.peel.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us42
for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us42, %for.body4.us33.us, %for.body4.us.us, %for.inc.us.peel
%putchar26.us = tail call i32 @putchar(i32 10)
%inc15.us = add nuw nsw i32 %i.041.us, 1
%exitcond58.not = icmp eq i32 %inc15.us, %h
br i1 %exitcond58.not, label %for.cond.cleanup, label %for.cond1.preheader.us, !llvm.loop !8
for.body4.us.us: ; preds = %for.cond1.preheader.us, %for.body4.us.us
%j.031.us.us = phi i32 [ %inc.us.us, %for.body4.us.us ], [ 0, %for.cond1.preheader.us ]
%putchar28.us.us = tail call i32 @putchar(i32 35)
%inc.us.us = add nuw nsw i32 %j.031.us.us, 1
%exitcond57.not = icmp eq i32 %inc.us.us, %w
br i1 %exitcond57.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us.us, !llvm.loop !9
for.body4.us33.us: ; preds = %for.body4.lr.ph.split.us48, %for.body4.us33.us
%j.031.us34.us = phi i32 [ %inc.us38.us, %for.body4.us33.us ], [ 0, %for.body4.lr.ph.split.us48 ]
%putchar28.us36.us = tail call i32 @putchar(i32 35)
%inc.us38.us = add nuw nsw i32 %j.031.us34.us, 1
%exitcond56.not = icmp eq i32 %inc.us38.us, %w
br i1 %exitcond56.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us33.us, !llvm.loop !9
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.preheader
%i.041 = phi i32 [ %inc15, %for.cond1.preheader ], [ 0, %for.cond1.preheader.lr.ph ]
%putchar26 = tail call i32 @putchar(i32 10)
%inc15 = add nuw nsw i32 %i.041, 1
%exitcond.not = icmp eq i32 %inc15, %h
br i1 %exitcond.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !8
for.cond.cleanup: ; preds = %for.cond1.preheader, %for.cond1.for.cond.cleanup3_crit_edge.us, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !10
%cmp3 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp14 = icmp eq i32 %1, 0
%or.cond5 = select i1 %cmp3, i1 %cmp14, i1 false
br i1 %or.cond5, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%2 = phi i32 [ %5, %if.end ], [ %1, %entry ]
%3 = phi i32 [ %4, %if.end ], [ %0, %entry ]
call void @printFrame(i32 noundef %3, i32 noundef %2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %h, ptr noundef nonnull %w)
%4 = load i32, ptr %h, align 4, !tbaa !10
%cmp = icmp eq i32 %4, 0
%5 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %5, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6, !7}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.peeled.count", i32 1}
!8 = distinct !{!8, !6}
!9 = distinct !{!9, !6}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int h,w,i,j;
for(;;)
{
scanf("%d %d",&h,&w);
if(h==0 && w==0)
break;
for(i=0;i<h;i++)
{
if(i==0||i==h-1)
{
for(j=0;j<w;j++)
{
printf("#");
}
}
else
{
printf("#");
for(j=0;j<w-2;j++)
{
printf(".");
}
printf("#");
}
printf("\n");
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101241/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101241/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp48 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp149 = icmp eq i32 %1, 0
%or.cond50 = select i1 %cmp48, i1 %cmp149, i1 false
br i1 %or.cond50, label %for.end27, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end25
%2 = phi i32 [ %9, %for.end25 ], [ %0, %entry ]
%cmp345 = icmp sgt i32 %2, 0
br i1 %cmp345, label %for.body, label %for.end25
for.body: ; preds = %for.cond2.preheader, %if.end21
%3 = phi i32 [ %8, %if.end21 ], [ %2, %for.cond2.preheader ]
%i.046 = phi i32 [ %inc24, %if.end21 ], [ 0, %for.cond2.preheader ]
%cmp4 = icmp eq i32 %i.046, 0
%sub = add nsw i32 %3, -1
%cmp5 = icmp eq i32 %i.046, %sub
%or.cond39 = select i1 %cmp4, i1 true, i1 %cmp5
br i1 %or.cond39, label %for.cond7.preheader, label %if.else
for.cond7.preheader: ; preds = %for.body
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp843 = icmp sgt i32 %4, 0
br i1 %cmp843, label %for.body9, label %if.end21
for.body9: ; preds = %for.cond7.preheader, %for.body9
%j.044 = phi i32 [ %inc, %for.body9 ], [ 0, %for.cond7.preheader ]
%putchar38 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %j.044, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc, %5
br i1 %cmp8, label %for.body9, label %if.end21, !llvm.loop !9
if.else: ; preds = %for.body
%putchar34 = call i32 @putchar(i32 35)
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp1441 = icmp sgt i32 %6, 2
br i1 %cmp1441, label %for.body15, label %for.end19
for.body15: ; preds = %if.else, %for.body15
%j.142 = phi i32 [ %inc18, %for.body15 ], [ 0, %if.else ]
%putchar36 = call i32 @putchar(i32 46)
%inc18 = add nuw nsw i32 %j.142, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%sub13 = add nsw i32 %7, -2
%cmp14 = icmp slt i32 %inc18, %sub13
br i1 %cmp14, label %for.body15, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.body15, %if.else
%putchar35 = call i32 @putchar(i32 35)
br label %if.end21
if.end21: ; preds = %for.body9, %for.cond7.preheader, %for.end19
%putchar37 = call i32 @putchar(i32 10)
%inc24 = add nuw nsw i32 %i.046, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc24, %8
br i1 %cmp3, label %for.body, label %for.end25, !llvm.loop !12
for.end25: ; preds = %if.end21, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %for.end27, label %for.cond2.preheader
for.end27: ; preds = %for.end25, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void){
int h,w,i;
while(1){
scanf("%d %d",&h,&w);
if(h==0 && w == 0){
return 0;
}
for(i=0;i<w;i++){
printf("#");
}
printf("\n");
h--;
while(h>1){
i=w;
while(i>0){
if(i==w || i==1){
printf("#");
}
else{
printf(".");
}
i--;
}
printf("\n");
h--;
}
for(i=0;i<w;i++){
printf("#");
}
printf("\n");
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101285/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101285/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp55 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp156 = icmp eq i32 %1, 0
%or.cond57 = select i1 %cmp55, i1 %cmp156, i1 false
br i1 %or.cond57, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end27
%2 = phi i32 [ %9, %for.end27 ], [ %1, %entry ]
%cmp245 = icmp sgt i32 %2, 0
br i1 %cmp245, label %for.body, label %for.end
if.then: ; preds = %for.end27, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
for.body: ; preds = %for.cond.preheader, %for.body
%i.046 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%putchar44 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %i.046, 1
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc, %3
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%storemerge.in49 = load i32, ptr %h, align 4, !tbaa !5
%storemerge50 = add nsw i32 %storemerge.in49, -1
store i32 %storemerge50, ptr %h, align 4, !tbaa !5
%cmp651 = icmp sgt i32 %storemerge.in49, 2
br i1 %cmp651, label %while.body7, label %for.cond21.preheader
for.cond21.preheader: ; preds = %while.end, %for.end
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp2252 = icmp sgt i32 %4, 0
br i1 %cmp2252, label %for.body23, label %for.end27
while.body7: ; preds = %for.end, %while.end
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp947 = icmp sgt i32 %5, 0
br i1 %cmp947, label %while.body10, label %while.end
while.body10: ; preds = %while.body7, %while.body10
%i.148 = phi i32 [ %dec17, %while.body10 ], [ %5, %while.body7 ]
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp11 = icmp eq i32 %i.148, %6
%cmp12 = icmp eq i32 %i.148, 1
%or.cond30 = or i1 %cmp12, %cmp11
%. = select i1 %or.cond30, i32 35, i32 46
%putchar42 = call i32 @putchar(i32 %.)
%dec17 = add nsw i32 %i.148, -1
%cmp9 = icmp sgt i32 %i.148, 1
br i1 %cmp9, label %while.body10, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body10, %while.body7
%putchar41 = call i32 @putchar(i32 10)
%storemerge.in = load i32, ptr %h, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, -1
store i32 %storemerge, ptr %h, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %storemerge.in, 2
br i1 %cmp6, label %while.body7, label %for.cond21.preheader, !llvm.loop !12
for.body23: ; preds = %for.cond21.preheader, %for.body23
%i.253 = phi i32 [ %inc26, %for.body23 ], [ 0, %for.cond21.preheader ]
%putchar40 = call i32 @putchar(i32 35)
%inc26 = add nuw nsw i32 %i.253, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp22 = icmp slt i32 %inc26, %7
br i1 %cmp22, label %for.body23, label %for.end27, !llvm.loop !13
for.end27: ; preds = %for.body23, %for.cond21.preheader
%putchar38 = call i32 @putchar(i32 10)
%putchar39 = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %8, 0
%9 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %9, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.then, label %for.cond.preheader
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void){
int h,w,i,j;
while(1){
scanf("%d %d",&h,&w);
if( h==0 && w==0)
break;
for(i=1; i<=h; i++){
for(j=1; j<=w; j++){
if(i==1 || i==h || j==1 || j==w)
printf("#");
else
printf(".");
}printf("\n");
}printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101371/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101371/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp39 = icmp eq i32 %0, 0
%1 = load i32, ptr %w, align 4
%cmp140 = icmp eq i32 %1, 0
%or.cond41 = select i1 %cmp39, i1 %cmp140, i1 false
br i1 %or.cond41, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end19
%2 = phi i32 [ %9, %for.end19 ], [ %0, %entry ]
%cmp2.not35 = icmp slt i32 %2, 1
br i1 %cmp2.not35, label %for.end19, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond.preheader, %for.end
%i.036 = phi i32 [ %inc18, %for.end ], [ 1, %for.cond.preheader ]
%3 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not32 = icmp slt i32 %3, 1
br i1 %cmp4.not32, label %for.end, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.cond3.preheader
%cmp6 = icmp eq i32 %i.036, 1
br i1 %cmp6, label %for.body5.us, label %for.body5
for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us
%j.033.us = phi i32 [ %inc.us, %for.body5.us ], [ 1, %for.body5.lr.ph ]
%putchar30.us = call i32 @putchar(i32 35)
%inc.us = add nuw nsw i32 %j.033.us, 1
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not.us.not = icmp slt i32 %j.033.us, %4
br i1 %cmp4.not.us.not, label %for.body5.us, label %for.end, !llvm.loop !9
for.body5: ; preds = %for.body5.lr.ph, %for.body5
%5 = phi i32 [ %7, %for.body5 ], [ %3, %for.body5.lr.ph ]
%j.033 = phi i32 [ %inc, %for.body5 ], [ 1, %for.body5.lr.ph ]
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp7 = icmp eq i32 %i.036, %6
%cmp9 = icmp eq i32 %j.033, 1
%or.cond21 = or i1 %cmp9, %cmp7
%cmp11 = icmp eq i32 %j.033, %5
%or.cond31 = or i1 %cmp11, %or.cond21
%. = select i1 %or.cond31, i32 35, i32 46
%putchar30 = call i32 @putchar(i32 %.)
%inc = add nuw nsw i32 %j.033, 1
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp4.not.not = icmp slt i32 %j.033, %7
br i1 %cmp4.not.not, label %for.body5, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader
%putchar28 = call i32 @putchar(i32 10)
%inc18 = add nuw nsw i32 %i.036, 1
%8 = load i32, ptr %h, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %i.036, %8
br i1 %cmp2.not.not, label %for.cond3.preheader, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.end, %for.cond.preheader
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%9 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp eq i32 %9, 0
%10 = load i32, ptr %w, align 4
%cmp1 = icmp eq i32 %10, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end19, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#define LIMIT 10000
#define N_MAX 100
int main(void)
{
int n, a, b, c, x, y[N_MAX], frame, i;
while(scanf("%d %d %d %d %d", &n, &a, &b, &c, &x), n + a + b + c + x)
{
for(i = 0; i < n; i++)
scanf("%d", y + i);
frame = i = 0;
while(1)
{
if(x == y[i]) i++;
if(i == n || frame == LIMIT) break;
frame++, x = (x * a + b) % c;
}
printf("%d\n", i == n ? frame : -1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101458/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101458/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %y) #3
%call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%add38 = add nsw i32 %1, %0
%2 = load i32, ptr %b, align 4, !tbaa !5
%add139 = add nsw i32 %add38, %2
%3 = load i32, ptr %c, align 4, !tbaa !5
%add240 = add nsw i32 %add139, %3
%4 = load i32, ptr %x, align 4, !tbaa !5
%add341 = sub i32 0, %4
%tobool.not42 = icmp eq i32 %add240, %add341
br i1 %tobool.not42, label %while.end17, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %13
%x.promoted47 = phi i32 [ %19, %13 ], [ %4, %entry ]
%5 = phi i32 [ %15, %13 ], [ %0, %entry ]
%cmp26 = icmp sgt i32 %5, 0
br i1 %cmp26, label %for.body, label %while.cond5.preheader
while.cond5.preheader.loopexit: ; preds = %for.body
%x.promoted.pre = load i32, ptr %x, align 4, !tbaa !5
br label %while.cond5.preheader
while.cond5.preheader: ; preds = %while.cond5.preheader.loopexit, %for.cond.preheader
%x.promoted = phi i32 [ %x.promoted47, %for.cond.preheader ], [ %x.promoted.pre, %while.cond5.preheader.loopexit ]
%.lcssa = phi i32 [ %5, %for.cond.preheader ], [ %10, %while.cond5.preheader.loopexit ]
%6 = load i32, ptr %y, align 16, !tbaa !5
%cmp729 = icmp eq i32 %x.promoted, %6
%inc830 = zext i1 %cmp729 to i32
%cmp931 = icmp eq i32 %.lcssa, %inc830
br i1 %cmp931, label %while.end.thread, label %if.end12.lr.ph
if.end12.lr.ph: ; preds = %while.cond5.preheader
%7 = load i32, ptr %a, align 4, !tbaa !5
%8 = load i32, ptr %b, align 4, !tbaa !5
%9 = load i32, ptr %c, align 4, !tbaa !5
br label %if.end12
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%add.ptr = getelementptr inbounds i32, ptr %y, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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 %while.cond5.preheader.loopexit, !llvm.loop !9
if.end12: ; preds = %if.end12.lr.ph, %if.end12
%spec.select34 = phi i32 [ %inc830, %if.end12.lr.ph ], [ %spec.select, %if.end12 ]
%frame.033 = phi i32 [ 0, %if.end12.lr.ph ], [ %inc13, %if.end12 ]
%rem2832 = phi i32 [ %x.promoted, %if.end12.lr.ph ], [ %rem, %if.end12 ]
%inc13 = add nuw nsw i32 %frame.033, 1
%mul = mul nsw i32 %7, %rem2832
%add14 = add nsw i32 %mul, %8
%rem = srem i32 %add14, %9
%idxprom = zext i32 %spec.select34 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %idxprom
%12 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp7 = icmp eq i32 %rem, %12
%inc8 = zext i1 %cmp7 to i32
%spec.select = add nuw nsw i32 %spec.select34, %inc8
%cmp9 = icmp eq i32 %spec.select, %.lcssa
%cond.fr = freeze i1 %cmp9
%cmp10 = icmp eq i32 %inc13, 10000
%or.cond = select i1 %cond.fr, i1 true, i1 %cmp10
br i1 %or.cond, label %while.end, label %if.end12
while.end: ; preds = %if.end12
store i32 %rem, ptr %x, align 4, !tbaa !5
br i1 %cond.fr, label %while.end.thread, label %13
while.end.thread: ; preds = %while.cond5.preheader, %while.end
%frame.0.lcssa51 = phi i32 [ %inc13, %while.end ], [ 0, %while.cond5.preheader ]
br label %13
13: ; preds = %while.end, %while.end.thread
%14 = phi i32 [ %frame.0.lcssa51, %while.end.thread ], [ -1, %while.end ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x)
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %16, %15
%17 = load i32, ptr %b, align 4, !tbaa !5
%add1 = add nsw i32 %add, %17
%18 = load i32, ptr %c, align 4, !tbaa !5
%add2 = add nsw i32 %add1, %18
%19 = load i32, ptr %x, align 4, !tbaa !5
%add3 = sub i32 0, %19
%tobool.not = icmp eq i32 %add2, %add3
br i1 %tobool.not, label %while.end17, label %for.cond.preheader, !llvm.loop !11
while.end17: ; preds = %13, %entry
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
int cmpnum(const void * n1, const void * n2) {
if (*(long *)n1 > *(long *)n2)
{
return 1;
}
else if (*(long *)n1 < *(long *)n2)
{
return -1;
}
else
{
return 0;
}
}
int main(void) {
long n,k;
scanf("%ld %ld", &n, &k);
long a[n],f[n];
for (long i = 0; i < n; i++) {
scanf("%ld", &a[i]);
}
for (long i = 0; i < n; i++) {
scanf("%ld", &f[i]);
}
qsort(a, n, sizeof(long), cmpnum);
qsort(f, n, sizeof(long), cmpnum);
long mul[n];
long max = 0;
long cost = 0;
for (long i = 0; i < n; i++) {
mul[i] = a[i]*f[n-1-i];
if (mul[i] > max) {
max = mul[i];
}
cost += a[i];
}
if (cost <= k) {
printf("0\n");
return 0;
}
long start = 0;
long end = max;
long center;
while (start+1 != end) {
center = (start+end)/2;
cost = 0;
for (long i = 0; i < n; i++) {
if (mul[i] <= center) {
continue;
}
cost += (mul[i]-center+f[n-1-i]-1)/f[n-1-i];
}
if (cost > k) {
start = center;
} else {
end = center;
}
}
printf("%ld\n", end);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101522/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101522/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmpnum(ptr nocapture noundef readonly %n1, ptr nocapture noundef readonly %n2) #0 {
entry:
%0 = load i64, ptr %n1, align 8, !tbaa !5
%1 = load i64, ptr %n2, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%vla1 = alloca i64, i64 %2, align 16
%cmp98 = icmp sgt i64 %2, 0
br i1 %cmp98, label %for.body, label %for.cond.cleanup6
for.cond4.preheader: ; preds = %for.body
%cmp5100 = icmp sgt i64 %3, 0
br i1 %cmp5100, label %for.body7, label %for.cond.cleanup6
for.body: ; preds = %entry, %for.body
%i.099 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.099
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.099, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond.cleanup6: ; preds = %for.body7, %entry, %for.cond4.preheader
%.lcssa = phi i64 [ %3, %for.cond4.preheader ], [ %2, %entry ], [ %24, %for.body7 ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.lcssa, i64 noundef 8, ptr noundef nonnull @cmpnum) #8
%4 = load i64, ptr %n, align 8, !tbaa !5
call void @qsort(ptr noundef nonnull %vla1, i64 noundef %4, i64 noundef 8, ptr noundef nonnull @cmpnum) #8
%5 = load i64, ptr %n, align 8, !tbaa !5
%vla13 = alloca i64, i64 %5, align 16
%cmp16102 = icmp sgt i64 %5, 0
br i1 %cmp16102, label %for.body18.lr.ph, label %for.cond.cleanup17.thread
for.body18.lr.ph: ; preds = %for.cond.cleanup6
%6 = getelementptr i64, ptr %vla1, i64 %5
%min.iters.check = icmp ult i64 %5, 4
br i1 %min.iters.check, label %for.body18.preheader, label %vector.ph
vector.ph: ; preds = %for.body18.lr.ph
%n.vec = and i64 %5, -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 ], [ %19, %vector.body ]
%vec.phi157 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
%vec.phi158 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%vec.phi159 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %18, %vector.body ]
%7 = getelementptr inbounds i64, ptr %vla, i64 %index
%wide.load = load <2 x i64>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i64, ptr %7, i64 2
%wide.load160 = load <2 x i64>, ptr %8, align 16, !tbaa !5
%9 = xor i64 %index, -1
%10 = getelementptr i64, ptr %6, i64 %9
%11 = getelementptr i64, ptr %10, i64 -1
%wide.load161 = load <2 x i64>, ptr %11, align 8, !tbaa !5
%reverse = shufflevector <2 x i64> %wide.load161, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
%12 = getelementptr i64, ptr %10, i64 -3
%wide.load162 = load <2 x i64>, ptr %12, align 8, !tbaa !5
%reverse163 = shufflevector <2 x i64> %wide.load162, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
%13 = mul nsw <2 x i64> %reverse, %wide.load
%14 = mul nsw <2 x i64> %reverse163, %wide.load160
%15 = getelementptr inbounds i64, ptr %vla13, i64 %index
store <2 x i64> %13, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i64, ptr %15, i64 2
store <2 x i64> %14, ptr %16, align 16, !tbaa !5
%17 = call <2 x i64> @llvm.smax.v2i64(<2 x i64> %13, <2 x i64> %vec.phi158)
%18 = call <2 x i64> @llvm.smax.v2i64(<2 x i64> %14, <2 x i64> %vec.phi159)
%19 = add <2 x i64> %wide.load, %vec.phi
%20 = add <2 x i64> %wide.load160, %vec.phi157
%index.next = add nuw i64 %index, 4
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.minmax = call <2 x i64> @llvm.smax.v2i64(<2 x i64> %17, <2 x i64> %18)
%22 = call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%bin.rdx = add <2 x i64> %20, %19
%23 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond.cleanup17, label %for.body18.preheader
for.body18.preheader: ; preds = %for.body18.lr.ph, %middle.block
%i14.0105.ph = phi i64 [ 0, %for.body18.lr.ph ], [ %n.vec, %middle.block ]
%cost.0104.ph = phi i64 [ 0, %for.body18.lr.ph ], [ %23, %middle.block ]
%max.0103.ph = phi i64 [ 0, %for.body18.lr.ph ], [ %22, %middle.block ]
br label %for.body18
for.body7: ; preds = %for.cond4.preheader, %for.body7
%i3.0101 = phi i64 [ %inc11, %for.body7 ], [ 0, %for.cond4.preheader ]
%arrayidx8 = getelementptr inbounds i64, ptr %vla1, i64 %i3.0101
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8)
%inc11 = add nuw nsw i64 %i3.0101, 1
%24 = load i64, ptr %n, align 8, !tbaa !5
%cmp5 = icmp slt i64 %inc11, %24
br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !llvm.loop !14
for.cond.cleanup17: ; preds = %for.body18, %middle.block
%spec.select.lcssa = phi i64 [ %22, %middle.block ], [ %spec.select, %for.body18 ]
%add.lcssa = phi i64 [ %23, %middle.block ], [ %add, %for.body18 ]
%25 = load i64, ptr %k, align 8, !tbaa !5
%.fr = freeze i64 %25
%cmp30.not = icmp sgt i64 %add.lcssa, %.fr
br i1 %cmp30.not, label %while.cond.preheader, label %if.then31
for.cond.cleanup17.thread: ; preds = %for.cond.cleanup6
%26 = load i64, ptr %k, align 8, !tbaa !5
%.fr134 = freeze i64 %26
%cmp30.not135 = icmp slt i64 %.fr134, 0
br i1 %cmp30.not135, label %while.end, label %if.then31
while.cond.preheader: ; preds = %for.cond.cleanup17
%cmp35.not112 = icmp eq i64 %spec.select.lcssa, 1
br i1 %cmp35.not112, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %while.cond.preheader
%27 = getelementptr i64, ptr %vla1, i64 %5
br i1 %cmp16102, label %while.body.us, label %while.body.lr.ph.split
while.body.us: ; preds = %while.body.lr.ph, %for.cond38.for.cond.cleanup40_crit_edge.us
%end.0114.us = phi i64 [ %end.0.div.us, %for.cond38.for.cond.cleanup40_crit_edge.us ], [ %spec.select.lcssa, %while.body.lr.ph ]
%start.0113.us = phi i64 [ %div.start.0.us, %for.cond38.for.cond.cleanup40_crit_edge.us ], [ 0, %while.body.lr.ph ]
%add36.us = add nsw i64 %end.0114.us, %start.0113.us
%div.us = sdiv i64 %add36.us, 2
%sub47.us = xor i64 %div.us, -1
br label %for.body41.us
for.body41.us: ; preds = %while.body.us, %for.inc58.us
%i37.0110.us = phi i64 [ 0, %while.body.us ], [ %inc59.us, %for.inc58.us ]
%cost.1109.us = phi i64 [ 0, %while.body.us ], [ %cost.2.us, %for.inc58.us ]
%arrayidx42.us = getelementptr inbounds i64, ptr %vla13, i64 %i37.0110.us
%28 = load i64, ptr %arrayidx42.us, align 8, !tbaa !5
%cmp43.not.us = icmp sgt i64 %28, %div.us
br i1 %cmp43.not.us, label %if.end45.us, label %for.inc58.us
if.end45.us: ; preds = %for.body41.us
%29 = xor i64 %i37.0110.us, -1
%arrayidx50.us = getelementptr i64, ptr %27, i64 %29
%30 = load i64, ptr %arrayidx50.us, align 8, !tbaa !5
%add51.us = add i64 %28, %sub47.us
%sub52.us = add i64 %add51.us, %30
%div56.us = sdiv i64 %sub52.us, %30
%add57.us = add nsw i64 %div56.us, %cost.1109.us
br label %for.inc58.us
for.inc58.us: ; preds = %if.end45.us, %for.body41.us
%cost.2.us = phi i64 [ %cost.1109.us, %for.body41.us ], [ %add57.us, %if.end45.us ]
%inc59.us = add nuw nsw i64 %i37.0110.us, 1
%exitcond129.not = icmp eq i64 %inc59.us, %5
br i1 %exitcond129.not, label %for.cond38.for.cond.cleanup40_crit_edge.us, label %for.body41.us, !llvm.loop !15
for.cond38.for.cond.cleanup40_crit_edge.us: ; preds = %for.inc58.us
%cmp61.us = icmp sgt i64 %cost.2.us, %.fr
%div.start.0.us = select i1 %cmp61.us, i64 %div.us, i64 %start.0113.us
%end.0.div.us = select i1 %cmp61.us, i64 %end.0114.us, i64 %div.us
%add34.us = add nsw i64 %div.start.0.us, 1
%cmp35.not.us = icmp eq i64 %add34.us, %end.0.div.us
br i1 %cmp35.not.us, label %while.end, label %while.body.us, !llvm.loop !16
while.body.lr.ph.split: ; preds = %while.body.lr.ph
%cmp61 = icmp slt i64 %.fr, 0
br i1 %cmp61, label %while.end, label %while.body
for.body18: ; preds = %for.body18.preheader, %for.body18
%i14.0105 = phi i64 [ %inc28, %for.body18 ], [ %i14.0105.ph, %for.body18.preheader ]
%cost.0104 = phi i64 [ %add, %for.body18 ], [ %cost.0104.ph, %for.body18.preheader ]
%max.0103 = phi i64 [ %spec.select, %for.body18 ], [ %max.0103.ph, %for.body18.preheader ]
%arrayidx19 = getelementptr inbounds i64, ptr %vla, i64 %i14.0105
%31 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%32 = xor i64 %i14.0105, -1
%arrayidx21 = getelementptr i64, ptr %6, i64 %32
%33 = load i64, ptr %arrayidx21, align 8, !tbaa !5
%mul = mul nsw i64 %33, %31
%arrayidx22 = getelementptr inbounds i64, ptr %vla13, i64 %i14.0105
store i64 %mul, ptr %arrayidx22, align 8, !tbaa !5
%spec.select = call i64 @llvm.smax.i64(i64 %mul, i64 %max.0103)
%add = add nsw i64 %31, %cost.0104
%inc28 = add nuw nsw i64 %i14.0105, 1
%exitcond.not = icmp eq i64 %inc28, %5
br i1 %exitcond.not, label %for.cond.cleanup17, label %for.body18, !llvm.loop !17
if.then31: ; preds = %for.cond.cleanup17.thread, %for.cond.cleanup17
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
while.body: ; preds = %while.body.lr.ph.split, %while.body
%end.0114 = phi i64 [ %div130, %while.body ], [ %spec.select.lcssa, %while.body.lr.ph.split ]
%div130 = lshr i64 %end.0114, 1
%34 = and i64 %end.0114, -2
%cmp35.not = icmp eq i64 %34, 2
br i1 %cmp35.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %for.cond38.for.cond.cleanup40_crit_edge.us, %for.cond.cleanup17.thread, %while.body.lr.ph.split, %while.cond.preheader
%end.0.lcssa = phi i64 [ 1, %while.cond.preheader ], [ %spec.select.lcssa, %while.body.lr.ph.split ], [ 0, %for.cond.cleanup17.thread ], [ %end.0.div.us, %for.cond38.for.cond.cleanup40_crit_edge.us ], [ %div130, %while.body ]
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %end.0.lcssa)
br label %cleanup
cleanup: ; preds = %while.end, %if.then31
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #8
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !13, !12}
|
#include<stdio.h>
#include<stdlib.h>
int even(int n) {
return (n % 2 == 0) ? 1 : 0;
}
int main() {
int i;
long long int n, u_val[100000], v_val[100000], w_val[100000];
scanf("%lld", &n);
for(i = 0; i < n - 1; i++) {
scanf("%lld %lld %lld", &u_val[i], &v_val[i], &w_val[i]);
u_val[i]--;
v_val[i]--;
}
long long int *ans;
ans = (long long int*)malloc(sizeof(long long int) * n);
for(i = 0; i < n; i++) ans[i] = -1;
int node1 = u_val[0];
int node2 = v_val[0];
int dist = w_val[0];
ans[node1] = 0;
if(even(dist)) ans[node2] = ans[node1];
else ans[node2] = 1 - ans[node1];
int count = 0;
while(1) {
for(i = 1; i < n; i++) {
node1 = u_val[i];
node2 = v_val[i];
dist = w_val[i];
if(ans[node1] != -1 && ans[node2] == -1) {
if(even(dist)) ans[node2] = ans[node1];
else ans[node2] = 1 - ans[node1];
} else if(ans[node1] == -1 && ans[node2] != -1) {
if(even(dist)) ans[node1] = ans[node2];
else ans[node1] = 1 - ans[node2];
}
}
for(i = 0; i < n; i++) {
if(ans[i] == -1) count++;
}
if(count == 0) {
break;
}
count = 0;
}
for(i = 0; i < n; i++) printf("%lld\n", ans[i]);
free(ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101573/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101573/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [15 x i8] c"%lld %lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @even(i32 noundef %n) local_unnamed_addr #0 {
entry:
%0 = and i32 %n, 1
%cond = xor i32 %0, 1
ret i32 %cond
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
%u_val = alloca [100000 x i64], align 16
%v_val = alloca [100000 x i64], align 16
%w_val = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %u_val) #8
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %v_val) #8
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %w_val) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp204 = icmp sgt i64 %0, 1
br i1 %cmp204, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr %u_val, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [100000 x i64], ptr %v_val, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [100000 x i64], ptr %w_val, i64 0, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx5)
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%dec = add nsw i64 %1, -1
store i64 %dec, ptr %arrayidx, align 8, !tbaa !5
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !5
%dec11 = add nsw i64 %2, -1
store i64 %dec11, ptr %arrayidx3, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%sub = add nsw i64 %3, -1
%cmp = icmp sgt i64 %sub, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%4 = phi i64 [ %0, %entry ], [ %3, %for.body ]
%mul = shl i64 %4, 3
%call12 = call noalias ptr @malloc(i64 noundef %mul) #9
%cmp15207 = icmp sgt i64 %4, 0
br i1 %cmp15207, label %for.body17.preheader, label %for.end22
for.body17.preheader: ; preds = %for.end
call void @llvm.memset.p0.i64(ptr align 8 %call12, i8 -1, i64 %mul, i1 false), !tbaa !5
br label %for.end22
for.end22: ; preds = %for.body17.preheader, %for.end
%5 = load i64, ptr %u_val, align 16, !tbaa !5
%6 = load i64, ptr %v_val, align 16, !tbaa !5
%7 = load i64, ptr %w_val, align 16, !tbaa !5
%sext = shl i64 %5, 32
%idxprom29 = ashr exact i64 %sext, 32
%arrayidx30 = getelementptr inbounds i64, ptr %call12, i64 %idxprom29
store i64 0, ptr %arrayidx30, align 8, !tbaa !5
%8 = and i64 %7, 1
%sext197 = shl i64 %6, 32
%idxprom34 = ashr exact i64 %sext197, 32
%arrayidx35 = getelementptr inbounds i64, ptr %call12, i64 %idxprom34
store i64 %8, ptr %arrayidx35, align 8, !tbaa !5
%cmp43210 = icmp sgt i64 %4, 1
br i1 %cmp43210, label %for.body45.us.preheader, label %if.end.split
for.body45.us.preheader: ; preds = %for.end22
%min.iters.check = icmp ult i64 %4, 4
%n.vec = and i64 %4, -4
%cmp.n = icmp eq i64 %4, %n.vec
br label %for.body45.us
for.end122.us: ; preds = %for.body112.us, %middle.block
%spec.select.us.lcssa = phi i32 [ %26, %middle.block ], [ %spec.select.us, %for.body112.us ]
%cmp123.us = icmp eq i32 %spec.select.us.lcssa, 0
br i1 %cmp123.us, label %for.cond127.preheader, label %for.body45.us.backedge
for.body112.us: ; preds = %for.body112.us.preheader267, %for.body112.us
%indvars.iv252 = phi i64 [ %indvars.iv.next253, %for.body112.us ], [ %indvars.iv252.ph, %for.body112.us.preheader267 ]
%count.1215.us = phi i32 [ %spec.select.us, %for.body112.us ], [ %count.1215.us.ph, %for.body112.us.preheader267 ]
%arrayidx114.us = getelementptr inbounds i64, ptr %call12, i64 %indvars.iv252
%9 = load i64, ptr %arrayidx114.us, align 8, !tbaa !5
%cmp115.us = icmp eq i64 %9, -1
%inc118.us = zext i1 %cmp115.us to i32
%spec.select.us = add nuw nsw i32 %count.1215.us, %inc118.us
%indvars.iv.next253 = add nuw nsw i64 %indvars.iv252, 1
%exitcond255.not = icmp eq i64 %indvars.iv.next253, %4
br i1 %exitcond255.not, label %for.end122.us, label %for.body112.us, !llvm.loop !11
for.body45.us: ; preds = %for.body45.us.backedge, %for.body45.us.preheader
%indvars.iv248 = phi i64 [ 1, %for.body45.us.preheader ], [ %indvars.iv248.be, %for.body45.us.backedge ]
%arrayidx47.us = getelementptr inbounds [100000 x i64], ptr %u_val, i64 0, i64 %indvars.iv248
%10 = load i64, ptr %arrayidx47.us, align 8, !tbaa !5
%arrayidx50.us = getelementptr inbounds [100000 x i64], ptr %v_val, i64 0, i64 %indvars.iv248
%11 = load i64, ptr %arrayidx50.us, align 8, !tbaa !5
%arrayidx53.us = getelementptr inbounds [100000 x i64], ptr %w_val, i64 0, i64 %indvars.iv248
%12 = load i64, ptr %arrayidx53.us, align 8, !tbaa !5
%conv54.us = trunc i64 %12 to i32
%sext198.us = shl i64 %10, 32
%idxprom55.us = ashr exact i64 %sext198.us, 32
%arrayidx56.us = getelementptr inbounds i64, ptr %call12, i64 %idxprom55.us
%13 = load i64, ptr %arrayidx56.us, align 8, !tbaa !5
%cmp57.not.us = icmp eq i64 %13, -1
%sext200.us = shl i64 %11, 32
%idxprom84.us = ashr exact i64 %sext200.us, 32
%arrayidx85.us = getelementptr inbounds i64, ptr %call12, i64 %idxprom84.us
%14 = load i64, ptr %arrayidx85.us, align 8, !tbaa !5
%cmp86.not.us = icmp eq i64 %14, -1
br i1 %cmp57.not.us, label %land.lhs.true83.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.body45.us
br i1 %cmp86.not.us, label %if.then63.us, label %for.inc105.us
if.then63.us: ; preds = %land.lhs.true.us
%15 = and i32 %conv54.us, 1
%tobool65.not.not.us = icmp eq i32 %15, 0
br i1 %tobool65.not.not.us, label %if.then66.us, label %if.else71.us
if.else71.us: ; preds = %if.then63.us
%sub74.us = sub nsw i64 1, %13
store i64 %sub74.us, ptr %arrayidx85.us, align 8, !tbaa !5
br label %for.inc105.us
if.then66.us: ; preds = %if.then63.us
store i64 %13, ptr %arrayidx85.us, align 8, !tbaa !5
br label %for.inc105.us
land.lhs.true83.us: ; preds = %for.body45.us
br i1 %cmp86.not.us, label %for.inc105.us, label %if.then88.us
if.then88.us: ; preds = %land.lhs.true83.us
%16 = and i32 %conv54.us, 1
%tobool90.not.not.us = icmp eq i32 %16, 0
br i1 %tobool90.not.not.us, label %if.then91.us, label %if.else96.us
if.else96.us: ; preds = %if.then88.us
%sub99.us = sub nsw i64 1, %14
store i64 %sub99.us, ptr %arrayidx56.us, align 8, !tbaa !5
br label %for.inc105.us
if.then91.us: ; preds = %if.then88.us
store i64 %14, ptr %arrayidx56.us, align 8, !tbaa !5
br label %for.inc105.us
for.inc105.us: ; preds = %if.then91.us, %if.else96.us, %land.lhs.true83.us, %if.then66.us, %if.else71.us, %land.lhs.true.us
%indvars.iv.next249 = add nuw nsw i64 %indvars.iv248, 1
%exitcond251.not = icmp eq i64 %indvars.iv.next249, %4
br i1 %exitcond251.not, label %for.cond41.for.cond108.preheader_crit_edge.us, label %for.body45.us.backedge
for.body45.us.backedge: ; preds = %for.inc105.us, %for.end122.us
%indvars.iv248.be = phi i64 [ %indvars.iv.next249, %for.inc105.us ], [ 1, %for.end122.us ]
br label %for.body45.us, !llvm.loop !14
for.cond41.for.cond108.preheader_crit_edge.us: ; preds = %for.inc105.us
br i1 %cmp15207, label %for.body112.us.preheader, label %for.end137
for.body112.us.preheader: ; preds = %for.cond41.for.cond108.preheader_crit_edge.us
br i1 %min.iters.check, label %for.body112.us.preheader267, label %vector.body
vector.body: ; preds = %for.body112.us.preheader, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body112.us.preheader ]
%vec.phi = phi <2 x i32> [ %23, %vector.body ], [ zeroinitializer, %for.body112.us.preheader ]
%vec.phi265 = phi <2 x i32> [ %24, %vector.body ], [ zeroinitializer, %for.body112.us.preheader ]
%17 = getelementptr inbounds i64, ptr %call12, i64 %index
%wide.load = load <2 x i64>, ptr %17, align 8, !tbaa !5
%18 = getelementptr inbounds i64, ptr %17, i64 2
%wide.load266 = load <2 x i64>, ptr %18, align 8, !tbaa !5
%19 = icmp eq <2 x i64> %wide.load, <i64 -1, i64 -1>
%20 = icmp eq <2 x i64> %wide.load266, <i64 -1, i64 -1>
%21 = zext <2 x i1> %19 to <2 x i32>
%22 = zext <2 x i1> %20 to <2 x i32>
%23 = add <2 x i32> %vec.phi, %21
%24 = add <2 x i32> %vec.phi265, %22
%index.next = add nuw i64 %index, 4
%25 = icmp eq i64 %index.next, %n.vec
br i1 %25, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i32> %24, %23
%26 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %bin.rdx)
br i1 %cmp.n, label %for.end122.us, label %for.body112.us.preheader267
for.body112.us.preheader267: ; preds = %for.body112.us.preheader, %middle.block
%indvars.iv252.ph = phi i64 [ 0, %for.body112.us.preheader ], [ %n.vec, %middle.block ]
%count.1215.us.ph = phi i32 [ 0, %for.body112.us.preheader ], [ %26, %middle.block ]
br label %for.body112.us
if.end.split: ; preds = %for.end22
br i1 %cmp15207, label %for.cond108.for.end122_crit_edge.us234.preheader, label %for.end137
for.cond108.for.end122_crit_edge.us234.preheader: ; preds = %if.end.split
%27 = load i64, ptr %call12, align 8, !tbaa !5
%cmp115.us227.not = icmp eq i64 %27, -1
br label %for.cond108.for.end122_crit_edge.us234
for.cond108.for.end122_crit_edge.us234: ; preds = %for.cond108.for.end122_crit_edge.us234.preheader, %for.cond108.for.end122_crit_edge.us234
br i1 %cmp115.us227.not, label %for.cond108.for.end122_crit_edge.us234, label %for.cond127.preheader
for.cond127.preheader: ; preds = %for.cond108.for.end122_crit_edge.us234, %for.end122.us
br i1 %cmp15207, label %for.body131, label %for.end137
for.body131: ; preds = %for.cond127.preheader, %for.body131
%indvars.iv256 = phi i64 [ %indvars.iv.next257, %for.body131 ], [ 0, %for.cond127.preheader ]
%arrayidx133 = getelementptr inbounds i64, ptr %call12, i64 %indvars.iv256
%28 = load i64, ptr %arrayidx133, align 8, !tbaa !5
%call134 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %28)
%indvars.iv.next257 = add nuw nsw i64 %indvars.iv256, 1
%29 = load i64, ptr %n, align 8, !tbaa !5
%cmp129 = icmp sgt i64 %29, %indvars.iv.next257
br i1 %cmp129, label %for.body131, label %for.end137, !llvm.loop !16
for.end137: ; preds = %for.cond41.for.cond108.preheader_crit_edge.us, %for.body131, %if.end.split, %for.cond127.preheader
call void @free(ptr noundef nonnull %call12) #8
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %w_val) #8
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %v_val) #8
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %u_val) #8
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>) #7
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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10}
|
//Ver.20180717
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
void shuffledget(int x[],int n){
srand(time(0));
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
int main(void){
long long i,j,n,m,k,a[524288],b,c,h,w,r=0,l,t;
long long dp[64][2]={0};
double d;
char s[524288];
scanf("%lld%lld",&n,&k);
//l=strlen(s);
dp[0][0]=1;
for(i=0;i<n;i++){
scanf("%lld",&a[i]);
if(a[i]%2){
dp[i+1][0]=dp[i][1]+dp[i][0];
dp[i+1][1]=dp[i][0]+dp[i][1];
}
else{
dp[i+1][0]=dp[i][0]+dp[i][0];
dp[i+1][1]=dp[i][1]+dp[i][1];
}
}
printf("%lld\n",dp[n][k]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101616/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101616/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@.str.1 = private unnamed_addr constant [9 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 i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !16
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !17
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !17
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !19
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !22
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !23
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !24
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
ret i32 %call
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #7 {
entry:
%b = alloca [524288 x i32], align 16
%call = tail call i64 @time(ptr noundef null) #15
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #15
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #15
%cmp44 = icmp sgt i32 %n, 0
br i1 %cmp44, label %for.body.preheader, label %for.end29
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !25
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !25
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !33
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block
br i1 %cmp44, label %for.body5.preheader, label %for.end29
for.body5.preheader: ; preds = %for.cond2.preheader
%3 = zext i32 %n to i64
br label %for.body5
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !25
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !34
for.cond18.preheader: ; preds = %for.body5
br i1 %cmp44, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.cond18.preheader
%wide.trip.count58 = zext i32 %n to i64
br label %for.body21
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv51 = phi i64 [ %3, %for.body5.preheader ], [ %indvars.iv.next52, %for.body5 ]
%call6 = tail call i32 @rand() #15
%5 = trunc i64 %indvars.iv51 to i32
%rem = srem i32 %call6, %5
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom7 = and i64 %indvars.iv.next52, 4294967295
%arrayidx8 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !25
%idxprom9 = sext i32 %rem to i64
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom9
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !25
store i32 %7, ptr %arrayidx8, align 4, !tbaa !25
store i32 %6, ptr %arrayidx10, align 4, !tbaa !25
%cmp3 = icmp ugt i64 %indvars.iv51, 1
br i1 %cmp3, label %for.body5, label %for.cond18.preheader, !llvm.loop !35
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv54 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next55, %for.body21 ]
%arrayidx23 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !25
%idxprom24 = sext i32 %8 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %x, i64 %idxprom24
%call26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx25)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count58
br i1 %exitcond59.not, label %for.end29, label %for.body21, !llvm.loop !36
for.end29: ; preds = %for.body21, %entry, %for.cond2.preheader, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #15
ret void
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #10 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !25
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !37
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !38
%1 = load i32, ptr %b, align 4, !tbaa !38
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #11 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
%a = alloca [524288 x i64], align 16
%dp = alloca [64 x [2 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #15
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #15
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %a) #15
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %dp) #15
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %dp, i8 0, i64 1024, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k)
store i64 1, ptr %dp, align 16, !tbaa !29
%0 = load i64, ptr %n, align 8, !tbaa !29
%cmp54 = icmp sgt i64 %0, 0
br i1 %cmp54, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.055 = phi i64 [ %add9.sink, %for.inc ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.055
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx2)
%1 = load i64, ptr %arrayidx2, align 8, !tbaa !29
%2 = and i64 %1, 1
%tobool.not = icmp eq i64 %2, 0
%arrayidx20 = getelementptr inbounds [64 x [2 x i64]], ptr %dp, i64 0, i64 %i.055
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %for.body
%arrayidx6 = getelementptr inbounds [64 x [2 x i64]], ptr %dp, i64 0, i64 %i.055, i64 1
%3 = load i64, ptr %arrayidx6, align 8, !tbaa !29
%4 = load i64, ptr %arrayidx20, align 16, !tbaa !29
%add = add nsw i64 %4, %3
%add9 = add nuw nsw i64 %i.055, 1
%arrayidx10 = getelementptr inbounds [64 x [2 x i64]], ptr %dp, i64 0, i64 %add9
store i64 %add, ptr %arrayidx10, align 16, !tbaa !29
br label %for.inc
if.else: ; preds = %for.body
%5 = load i64, ptr %arrayidx20, align 16, !tbaa !29
%add24 = shl nsw i64 %5, 1
%add25 = add nuw nsw i64 %i.055, 1
%arrayidx26 = getelementptr inbounds [64 x [2 x i64]], ptr %dp, i64 0, i64 %add25
store i64 %add24, ptr %arrayidx26, align 16, !tbaa !29
%arrayidx29 = getelementptr inbounds [64 x [2 x i64]], ptr %dp, i64 0, i64 %i.055, i64 1
%6 = load i64, ptr %arrayidx29, align 8, !tbaa !29
%add32 = shl nsw i64 %6, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%add9.sink = phi i64 [ %add9, %if.then ], [ %add25, %if.else ]
%add.sink = phi i64 [ %add, %if.then ], [ %add32, %if.else ]
%arrayidx19 = getelementptr inbounds [64 x [2 x i64]], ptr %dp, i64 0, i64 %add9.sink, i64 1
store i64 %add.sink, ptr %arrayidx19, align 8, !tbaa !29
%7 = load i64, ptr %n, align 8, !tbaa !29
%cmp = icmp slt i64 %add9.sink, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !40
for.end: ; preds = %for.inc, %entry
%.lcssa = phi i64 [ %0, %entry ], [ %7, %for.inc ]
%8 = load i64, ptr %k, align 8, !tbaa !29
%arrayidx37 = getelementptr inbounds [64 x [2 x i64]], ptr %dp, i64 0, i64 %.lcssa, i64 %8
%9 = load i64, ptr %arrayidx37, align 8, !tbaa !29
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %9)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %dp) #15
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %a) #15
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #15
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #15
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #12
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #13
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nounwind willreturn memory(read) }
attributes #15 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C/C++ TBAA"}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !27, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !27, i64 0}
!33 = distinct !{!33, !6, !9, !10}
!34 = distinct !{!34, !6, !10, !9}
!35 = distinct !{!35, !6}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = !{!39, !26, i64 0}
!39 = !{!"", !26, i64 0, !26, i64 4}
!40 = distinct !{!40, !6}
|
#include <stdio.h>
#define N 200000
#define H_ 18 /* H_ = ceil(log2(N)) */
#define N_ (1 << H_)
long long sum[N_ * 2]; int mn[N_ * 2], sz[N_ * 2], lz[N_], h_, n_;
void put(int i, int x) {
sum[i] = (long long) sz[i] * x;
mn[i] = x;
if (i < n_)
lz[i] = x;
}
void pus(int i) {
if (lz[i]) {
put(i << 1 | 0, lz[i]), put(i << 1 | 1, lz[i]);
lz[i] = 0;
}
}
void pul(int i) {
if (!lz[i]) {
int l = i << 1 | 0, r = i << 1 | 1;
sum[i] = sum[l] + sum[r];
mn[i] = mn[r];
}
}
void push(int i) {
int h;
for (h = h_; h > 0; h--)
pus(i >> h);
}
void pull(int i) {
while (i > 1)
pul(i >>= 1);
}
void build(int *aa, int n) {
int i;
h_ = 0;
while (1 << h_ < n)
h_++;
n_ = 1 << h_;
for (i = 0; i < n; i++) {
sum[n_ + i] = mn[n_ + i] = aa[i];
sz[n_ + i] = 1;
}
for (i = n_ - 1; i > 0; i--) {
pul(i);
sz[i] = sz[i << 1 | 0] + sz[i << 1 | 1];
}
}
void update(int r, int x) {
int l, l_, r_;
l = 1;
while (l < n_) {
pus(l);
l = mn[l << 1 | 0] >= x ? l << 1 | 1 : l << 1 | 0;
}
l -= n_;
if (l > r)
return;
l_ = l += n_, r_ = r += n_;
push(l_), push(r_);
for ( ; l <= r; l >>= 1, r >>= 1) {
if ((l & 1) == 1)
put(l++, x);
if ((r & 1) == 0)
put(r--, x);
}
pull(l_), pull(r_);
}
int x;
int query_(int i) {
if (x >= sum[i]) {
x -= sum[i];
return sz[i];
}
if (x < mn[i])
return 0;
pus(i);
return query_(i << 1 | 0) + query_(i << 1 | 1);
}
int query(int l) {
int r = n_ * 2 - 1, cnt;
push(l += n_);
cnt = 0;
for ( ; l <= r; l >>= 1, r >>= 1)
if ((l & 1) == 1)
cnt += query_(l++);
return cnt;
}
int main() {
static int aa[N];
int n, q, i;
scanf("%d%d", &n, &q);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
build(aa, n);
while (q--) {
int t;
scanf("%d%d%d", &t, &i, &x), i--;
if (t == 1)
update(i, x);
else
printf("%d\n", query(i));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10166/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10166/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@sz = dso_local local_unnamed_addr global [524288 x i32] zeroinitializer, align 16
@sum = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16
@mn = dso_local local_unnamed_addr global [524288 x i32] zeroinitializer, align 16
@n_ = dso_local local_unnamed_addr global i32 0, align 4
@lz = dso_local local_unnamed_addr global [262144 x i32] zeroinitializer, align 16
@h_ = dso_local local_unnamed_addr global i32 0, align 4
@x = dso_local global i32 0, align 4
@main.aa = internal global [200000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @put(i32 noundef %i, i32 noundef %x) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%conv1 = sext i32 %x to i64
%mul = mul nsw i64 %conv, %conv1
%arrayidx3 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom
store i64 %mul, ptr %arrayidx3, align 8, !tbaa !9
%arrayidx5 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx5, align 4, !tbaa !5
%1 = load i32, ptr @n_, align 4, !tbaa !5
%cmp = icmp sgt i32 %1, %i
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%arrayidx8 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom
store i32 %x, ptr %arrayidx8, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @pus(i32 noundef %i) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %entry
%shl = shl i32 %i, 1
%idxprom.i = sext i32 %shl to i64
%arrayidx.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i
%1 = load i32, ptr %arrayidx.i, align 8, !tbaa !5
%conv.i = sext i32 %1 to i64
%conv1.i = sext i32 %0 to i64
%mul.i = mul nsw i64 %conv.i, %conv1.i
%arrayidx3.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i
store i64 %mul.i, ptr %arrayidx3.i, align 16, !tbaa !9
%arrayidx5.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i
store i32 %0, ptr %arrayidx5.i, align 8, !tbaa !5
%2 = load i32, ptr @n_, align 4, !tbaa !5
%cmp.i = icmp sgt i32 %2, %shl
br i1 %cmp.i, label %if.then.i, label %put.exit
if.then.i: ; preds = %if.then
%arrayidx8.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i
store i32 %0, ptr %arrayidx8.i, align 8, !tbaa !5
%.pre = load i32, ptr %arrayidx, align 4, !tbaa !5
%.pre25 = sext i32 %.pre to i64
br label %put.exit
put.exit: ; preds = %if.then, %if.then.i
%conv1.i17.pre-phi = phi i64 [ %conv1.i, %if.then ], [ %.pre25, %if.then.i ]
%3 = phi i32 [ %0, %if.then ], [ %.pre, %if.then.i ]
%or4 = or i32 %shl, 1
%idxprom.i14 = sext i32 %or4 to i64
%arrayidx.i15 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i14
%4 = load i32, ptr %arrayidx.i15, align 4, !tbaa !5
%conv.i16 = sext i32 %4 to i64
%mul.i18 = mul nsw i64 %conv1.i17.pre-phi, %conv.i16
%arrayidx3.i19 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i14
store i64 %mul.i18, ptr %arrayidx3.i19, align 8, !tbaa !9
%arrayidx5.i20 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i14
store i32 %3, ptr %arrayidx5.i20, align 4, !tbaa !5
%cmp.i21 = icmp sgt i32 %2, %or4
br i1 %cmp.i21, label %if.then.i22, label %put.exit24
if.then.i22: ; preds = %put.exit
%arrayidx8.i23 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i14
store i32 %3, ptr %arrayidx8.i23, align 4, !tbaa !5
br label %put.exit24
put.exit24: ; preds = %put.exit, %if.then.i22
store i32 0, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %put.exit24, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @pul(i32 noundef %i) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %if.then, label %if.end
if.then: ; preds = %entry
%shl = shl i32 %i, 1
%or2 = or i32 %shl, 1
%idxprom3 = sext i32 %shl to i64
%arrayidx4 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom3
%1 = load i64, ptr %arrayidx4, align 16, !tbaa !9
%idxprom5 = sext i32 %or2 to i64
%arrayidx6 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom5
%2 = load i64, ptr %arrayidx6, align 8, !tbaa !9
%add = add nsw i64 %2, %1
%arrayidx8 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom
store i64 %add, ptr %arrayidx8, align 8, !tbaa !9
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom5
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom
store i32 %3, ptr %arrayidx12, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %i) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @h_, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %0, 0
br i1 %cmp3, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr @n_, align 4
br label %for.body
for.body: ; preds = %for.body.lr.ph, %pus.exit
%h.04 = phi i32 [ %0, %for.body.lr.ph ], [ %dec, %pus.exit ]
%shr = ashr i32 %i, %h.04
%idxprom.i = sext i32 %shr to i64
%arrayidx.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%tobool.not.i = icmp eq i32 %2, 0
br i1 %tobool.not.i, label %pus.exit, label %if.then.i
if.then.i: ; preds = %for.body
%shl.i = shl nsw i32 %shr, 1
%idxprom.i.i = sext i32 %shl.i to i64
%arrayidx.i.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i.i
%3 = load i32, ptr %arrayidx.i.i, align 8, !tbaa !5
%conv.i.i = sext i32 %3 to i64
%conv1.i.i = sext i32 %2 to i64
%mul.i.i = mul nsw i64 %conv.i.i, %conv1.i.i
%arrayidx3.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i.i
store i64 %mul.i.i, ptr %arrayidx3.i.i, align 16, !tbaa !9
%arrayidx5.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i.i
store i32 %2, ptr %arrayidx5.i.i, align 8, !tbaa !5
%cmp.i.i = icmp sgt i32 %1, %shl.i
br i1 %cmp.i.i, label %if.then.i.i, label %put.exit.i
if.then.i.i: ; preds = %if.then.i
%arrayidx8.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i
store i32 %2, ptr %arrayidx8.i.i, align 8, !tbaa !5
%.pre.i = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%.pre25.i = sext i32 %.pre.i to i64
br label %put.exit.i
put.exit.i: ; preds = %if.then.i.i, %if.then.i
%conv1.i17.pre-phi.i = phi i64 [ %conv1.i.i, %if.then.i ], [ %.pre25.i, %if.then.i.i ]
%4 = phi i32 [ %2, %if.then.i ], [ %.pre.i, %if.then.i.i ]
%or4.i = or i32 %shl.i, 1
%idxprom.i14.i = sext i32 %or4.i to i64
%arrayidx.i15.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i14.i
%5 = load i32, ptr %arrayidx.i15.i, align 4, !tbaa !5
%conv.i16.i = sext i32 %5 to i64
%mul.i18.i = mul nsw i64 %conv1.i17.pre-phi.i, %conv.i16.i
%arrayidx3.i19.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i14.i
store i64 %mul.i18.i, ptr %arrayidx3.i19.i, align 8, !tbaa !9
%arrayidx5.i20.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i14.i
store i32 %4, ptr %arrayidx5.i20.i, align 4, !tbaa !5
%cmp.i21.i = icmp sgt i32 %1, %or4.i
br i1 %cmp.i21.i, label %if.then.i22.i, label %put.exit24.i
if.then.i22.i: ; preds = %put.exit.i
%arrayidx8.i23.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i14.i
store i32 %4, ptr %arrayidx8.i23.i, align 4, !tbaa !5
br label %put.exit24.i
put.exit24.i: ; preds = %if.then.i22.i, %put.exit.i
store i32 0, ptr %arrayidx.i, align 4, !tbaa !5
br label %pus.exit
pus.exit: ; preds = %for.body, %put.exit24.i
%dec = add nsw i32 %h.04, -1
%cmp = icmp sgt i32 %h.04, 1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %pus.exit, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @pull(i32 noundef %i) local_unnamed_addr #2 {
entry:
%cmp2 = icmp sgt i32 %i, 1
br i1 %cmp2, label %while.body, label %while.end
while.body: ; preds = %entry, %pul.exit
%i.addr.03 = phi i32 [ %shr, %pul.exit ], [ %i, %entry ]
%shr = lshr i32 %i.addr.03, 1
%idxprom.i = zext i32 %shr to i64
%arrayidx.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i
%0 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%tobool.not.i = icmp eq i32 %0, 0
br i1 %tobool.not.i, label %if.then.i, label %pul.exit
if.then.i: ; preds = %while.body
%shl.i = and i32 %i.addr.03, 2147483646
%or2.i = or i32 %i.addr.03, 1
%idxprom3.i = zext i32 %shl.i to i64
%arrayidx4.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom3.i
%1 = load i64, ptr %arrayidx4.i, align 16, !tbaa !9
%idxprom5.i = zext i32 %or2.i to i64
%arrayidx6.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom5.i
%2 = load i64, ptr %arrayidx6.i, align 8, !tbaa !9
%add.i = add nsw i64 %2, %1
%arrayidx8.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i
store i64 %add.i, ptr %arrayidx8.i, align 8, !tbaa !9
%arrayidx10.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom5.i
%3 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%arrayidx12.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i
store i32 %3, ptr %arrayidx12.i, align 4, !tbaa !5
br label %pul.exit
pul.exit: ; preds = %while.body, %if.then.i
%cmp = icmp ugt i32 %i.addr.03, 3
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !13
while.end: ; preds = %pul.exit, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @build(ptr nocapture noundef readonly %aa, i32 noundef %n) local_unnamed_addr #3 {
entry:
%aa53 = ptrtoint ptr %aa to i64
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%storemerge = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%shl = shl nuw i32 1, %storemerge
%cmp = icmp slt i32 %shl, %n
%inc = add nuw nsw i32 %storemerge, 1
br i1 %cmp, label %while.cond, label %while.end, !llvm.loop !14
while.end: ; preds = %while.cond
store i32 %storemerge, ptr @h_, align 4, !tbaa !5
store i32 %shl, ptr @n_, align 4, !tbaa !5
%cmp240 = icmp sgt i32 %n, 0
br i1 %cmp240, label %for.body.preheader, label %for.cond12.preheader
for.body.preheader: ; preds = %while.end
%0 = sext i32 %shl to i64
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 14
br i1 %min.iters.check, label %for.body.preheader57, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, ptrtoint (ptr @sz to i64)
%3 = add i64 %1, ptrtoint (ptr @mn to i64)
%4 = sub i64 %3, %aa53
%diff.check = icmp ult i64 %4, 16
%conflict.rdx = or i1 %diff.check, icmp ult (i64 add (i64 ptrtoint (ptr @sz to i64), i64 sub (i64 0, i64 ptrtoint (ptr @mn to i64))), i64 16)
%5 = sub i64 %2, %aa53
%diff.check54 = icmp ult i64 %5, 16
%conflict.rdx55 = or i1 %conflict.rdx, %diff.check54
br i1 %conflict.rdx55, label %for.body.preheader57, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%6 = getelementptr inbounds i32, ptr %aa, i64 %index
%wide.load = load <2 x i32>, ptr %6, align 4, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 2
%wide.load56 = load <2 x i32>, ptr %7, align 4, !tbaa !5
%8 = add nuw nsw i64 %index, %0
%9 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %8
store <2 x i32> %wide.load, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 2
store <2 x i32> %wide.load56, ptr %10, align 4, !tbaa !5
%11 = sext <2 x i32> %wide.load to <2 x i64>
%12 = sext <2 x i32> %wide.load56 to <2 x i64>
%13 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %8
store <2 x i64> %11, ptr %13, align 8, !tbaa !9
%14 = getelementptr inbounds i64, ptr %13, i64 2
store <2 x i64> %12, ptr %14, align 8, !tbaa !9
%15 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %8
store <2 x i32> <i32 1, i32 1>, ptr %15, align 4, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 2
store <2 x i32> <i32 1, i32 1>, ptr %16, align 4, !tbaa !5
%index.next = add nuw i64 %index, 4
%17 = icmp eq i64 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond12.preheader, label %for.body.preheader57
for.body.preheader57: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %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.preheader57
%arrayidx.prol = getelementptr inbounds i32, ptr %aa, i64 %indvars.iv.ph
%18 = load i32, ptr %arrayidx.prol, align 4, !tbaa !5
%19 = add nuw nsw i64 %indvars.iv.ph, %0
%arrayidx4.prol = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %19
store i32 %18, ptr %arrayidx4.prol, align 4, !tbaa !5
%conv.prol = sext i32 %18 to i64
%arrayidx7.prol = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %19
store i64 %conv.prol, ptr %arrayidx7.prol, align 8, !tbaa !9
%arrayidx10.prol = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %19
store i32 1, ptr %arrayidx10.prol, align 4, !tbaa !5
%indvars.iv.next.prol = or i64 %indvars.iv.ph, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader57
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader57 ], [ %indvars.iv.next.prol, %for.body.prol ]
%20 = sub nsw i64 0, %wide.trip.count
%21 = xor i64 %indvars.iv.ph, %20
%22 = icmp eq i64 %21, -1
br i1 %22, label %for.cond12.preheader, label %for.body
for.cond12.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %while.end
%cmp1342 = icmp sgt i32 %shl, 1
br i1 %cmp1342, label %for.body15.preheader, label %for.end27
for.body15.preheader: ; preds = %for.cond12.preheader
%23 = zext i32 %shl to i64
br label %for.body15
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 %aa, i64 %indvars.iv
%24 = load i32, ptr %arrayidx, align 4, !tbaa !5
%25 = add nuw nsw i64 %indvars.iv, %0
%arrayidx4 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %25
store i32 %24, ptr %arrayidx4, align 4, !tbaa !5
%conv = sext i32 %24 to i64
%arrayidx7 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %25
store i64 %conv, ptr %arrayidx7, align 8, !tbaa !9
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %25
store i32 1, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %aa, i64 %indvars.iv.next
%26 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%27 = add nuw nsw i64 %indvars.iv.next, %0
%arrayidx4.1 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %27
store i32 %26, ptr %arrayidx4.1, align 4, !tbaa !5
%conv.1 = sext i32 %26 to i64
%arrayidx7.1 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %27
store i64 %conv.1, ptr %arrayidx7.1, align 8, !tbaa !9
%arrayidx10.1 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %27
store i32 1, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.cond12.preheader, label %for.body, !llvm.loop !18
for.body15: ; preds = %for.body15.preheader, %pul.exit
%indvars.iv46 = phi i64 [ %23, %for.body15.preheader ], [ %indvars.iv.next47, %pul.exit ]
%indvars.iv.next47 = add nsw i64 %indvars.iv46, -1
%arrayidx.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %indvars.iv.next47
%28 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%tobool.not.i = icmp eq i32 %28, 0
%29 = trunc i64 %indvars.iv.next47 to i32
%shl.i = shl nuw i32 %29, 1
br i1 %tobool.not.i, label %if.then.i, label %for.body15.pul.exit_crit_edge
for.body15.pul.exit_crit_edge: ; preds = %for.body15
%.pre50 = sext i32 %shl.i to i64
%.pre51 = or i32 %shl.i, 1
%.pre52 = sext i32 %.pre51 to i64
br label %pul.exit
if.then.i: ; preds = %for.body15
%or2.i = or i32 %shl.i, 1
%idxprom3.i = sext i32 %shl.i to i64
%arrayidx4.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom3.i
%30 = load i64, ptr %arrayidx4.i, align 16, !tbaa !9
%idxprom5.i = sext i32 %or2.i to i64
%arrayidx6.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom5.i
%31 = load i64, ptr %arrayidx6.i, align 8, !tbaa !9
%add.i = add nsw i64 %31, %30
%arrayidx8.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %indvars.iv.next47
store i64 %add.i, ptr %arrayidx8.i, align 8, !tbaa !9
%arrayidx10.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom5.i
%32 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%arrayidx12.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %indvars.iv.next47
store i32 %32, ptr %arrayidx12.i, align 4, !tbaa !5
br label %pul.exit
pul.exit: ; preds = %for.body15.pul.exit_crit_edge, %if.then.i
%idxprom21.pre-phi = phi i64 [ %.pre52, %for.body15.pul.exit_crit_edge ], [ %idxprom5.i, %if.then.i ]
%idxprom17.pre-phi = phi i64 [ %.pre50, %for.body15.pul.exit_crit_edge ], [ %idxprom3.i, %if.then.i ]
%arrayidx18 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom17.pre-phi
%33 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%arrayidx22 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom21.pre-phi
%34 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%add23 = add nsw i32 %34, %33
%arrayidx25 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %indvars.iv.next47
store i32 %add23, ptr %arrayidx25, align 4, !tbaa !5
%cmp13 = icmp ugt i64 %indvars.iv46, 2
br i1 %cmp13, label %for.body15, label %for.end27, !llvm.loop !19
for.end27: ; preds = %pul.exit, %for.cond12.preheader
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @update(i32 noundef %r, i32 noundef %x) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n_, align 4
%cmp125 = icmp sgt i32 %0, 1
br i1 %cmp125, label %while.body, label %while.end
while.body: ; preds = %entry, %pus.exit
%l.0126 = phi i32 [ %cond, %pus.exit ], [ 1, %entry ]
%idxprom.i = sext i32 %l.0126 to i64
%arrayidx.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%tobool.not.i = icmp eq i32 %1, 0
%.pre = shl i32 %l.0126, 1
%.pre131 = sext i32 %.pre to i64
br i1 %tobool.not.i, label %pus.exit, label %if.then.i
if.then.i: ; preds = %while.body
%arrayidx.i.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %.pre131
%2 = load i32, ptr %arrayidx.i.i, align 8, !tbaa !5
%conv.i.i = sext i32 %2 to i64
%conv1.i.i = sext i32 %1 to i64
%mul.i.i = mul nsw i64 %conv.i.i, %conv1.i.i
%arrayidx3.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %.pre131
store i64 %mul.i.i, ptr %arrayidx3.i.i, align 16, !tbaa !9
%arrayidx5.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %.pre131
store i32 %1, ptr %arrayidx5.i.i, align 8, !tbaa !5
%cmp.i.i = icmp sgt i32 %0, %.pre
br i1 %cmp.i.i, label %if.then.i.i, label %put.exit.i
if.then.i.i: ; preds = %if.then.i
%arrayidx8.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %.pre131
store i32 %1, ptr %arrayidx8.i.i, align 8, !tbaa !5
%.pre.i = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%.pre25.i = sext i32 %.pre.i to i64
br label %put.exit.i
put.exit.i: ; preds = %if.then.i.i, %if.then.i
%conv1.i17.pre-phi.i = phi i64 [ %conv1.i.i, %if.then.i ], [ %.pre25.i, %if.then.i.i ]
%3 = phi i32 [ %1, %if.then.i ], [ %.pre.i, %if.then.i.i ]
%or4.i = or i32 %.pre, 1
%idxprom.i14.i = sext i32 %or4.i to i64
%arrayidx.i15.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i14.i
%4 = load i32, ptr %arrayidx.i15.i, align 4, !tbaa !5
%conv.i16.i = sext i32 %4 to i64
%mul.i18.i = mul nsw i64 %conv1.i17.pre-phi.i, %conv.i16.i
%arrayidx3.i19.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i14.i
store i64 %mul.i18.i, ptr %arrayidx3.i19.i, align 8, !tbaa !9
%arrayidx5.i20.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i14.i
store i32 %3, ptr %arrayidx5.i20.i, align 4, !tbaa !5
%cmp.i21.i = icmp sgt i32 %0, %or4.i
br i1 %cmp.i21.i, label %if.then.i22.i, label %put.exit24.i
if.then.i22.i: ; preds = %put.exit.i
%arrayidx8.i23.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i14.i
store i32 %3, ptr %arrayidx8.i23.i, align 4, !tbaa !5
br label %put.exit24.i
put.exit24.i: ; preds = %if.then.i22.i, %put.exit.i
store i32 0, ptr %arrayidx.i, align 4, !tbaa !5
br label %pus.exit
pus.exit: ; preds = %while.body, %put.exit24.i
%arrayidx = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %.pre131
%5 = load i32, ptr %arrayidx, align 8, !tbaa !5
%cmp1.not = icmp sge i32 %5, %x
%or3 = zext i1 %cmp1.not to i32
%cond = or i32 %.pre, %or3
%cmp = icmp slt i32 %cond, %0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !20
while.end: ; preds = %pus.exit, %entry
%l.0.lcssa = phi i32 [ 1, %entry ], [ %cond, %pus.exit ]
%sub = sub nsw i32 %l.0.lcssa, %0
%cmp6 = icmp sgt i32 %sub, %r
br i1 %cmp6, label %cleanup, label %if.end
if.end: ; preds = %while.end
%add7 = add nsw i32 %0, %r
%6 = load i32, ptr @h_, align 4, !tbaa !5
%cmp3.i = icmp sgt i32 %6, 0
br i1 %cmp3.i, label %for.body.i, label %push.exit80
for.body.i: ; preds = %if.end, %pus.exit.i
%h.04.i = phi i32 [ %dec.i, %pus.exit.i ], [ %6, %if.end ]
%shr.i = ashr i32 %l.0.lcssa, %h.04.i
%idxprom.i.i39 = sext i32 %shr.i to i64
%arrayidx.i.i40 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i39
%7 = load i32, ptr %arrayidx.i.i40, align 4, !tbaa !5
%tobool.not.i.i = icmp eq i32 %7, 0
br i1 %tobool.not.i.i, label %pus.exit.i, label %if.then.i.i41
if.then.i.i41: ; preds = %for.body.i
%shl.i.i = shl nsw i32 %shr.i, 1
%idxprom.i.i.i = sext i32 %shl.i.i to i64
%arrayidx.i.i.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i.i.i
%8 = load i32, ptr %arrayidx.i.i.i, align 8, !tbaa !5
%conv.i.i.i = sext i32 %8 to i64
%conv1.i.i.i = sext i32 %7 to i64
%mul.i.i.i = mul nsw i64 %conv.i.i.i, %conv1.i.i.i
%arrayidx3.i.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i.i.i
store i64 %mul.i.i.i, ptr %arrayidx3.i.i.i, align 16, !tbaa !9
%arrayidx5.i.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i.i.i
store i32 %7, ptr %arrayidx5.i.i.i, align 8, !tbaa !5
%cmp.i.i.i = icmp sgt i32 %0, %shl.i.i
br i1 %cmp.i.i.i, label %if.then.i.i.i, label %put.exit.i.i
if.then.i.i.i: ; preds = %if.then.i.i41
%arrayidx8.i.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i.i
store i32 %7, ptr %arrayidx8.i.i.i, align 8, !tbaa !5
%.pre.i.i = load i32, ptr %arrayidx.i.i40, align 4, !tbaa !5
%.pre25.i.i = sext i32 %.pre.i.i to i64
br label %put.exit.i.i
put.exit.i.i: ; preds = %if.then.i.i.i, %if.then.i.i41
%conv1.i17.pre-phi.i.i = phi i64 [ %conv1.i.i.i, %if.then.i.i41 ], [ %.pre25.i.i, %if.then.i.i.i ]
%9 = phi i32 [ %7, %if.then.i.i41 ], [ %.pre.i.i, %if.then.i.i.i ]
%or4.i.i = or i32 %shl.i.i, 1
%idxprom.i14.i.i = sext i32 %or4.i.i to i64
%arrayidx.i15.i.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i14.i.i
%10 = load i32, ptr %arrayidx.i15.i.i, align 4, !tbaa !5
%conv.i16.i.i = sext i32 %10 to i64
%mul.i18.i.i = mul nsw i64 %conv1.i17.pre-phi.i.i, %conv.i16.i.i
%arrayidx3.i19.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i14.i.i
store i64 %mul.i18.i.i, ptr %arrayidx3.i19.i.i, align 8, !tbaa !9
%arrayidx5.i20.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i14.i.i
store i32 %9, ptr %arrayidx5.i20.i.i, align 4, !tbaa !5
%cmp.i21.i.i = icmp sgt i32 %0, %or4.i.i
br i1 %cmp.i21.i.i, label %if.then.i22.i.i, label %put.exit24.i.i
if.then.i22.i.i: ; preds = %put.exit.i.i
%arrayidx8.i23.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i14.i.i
store i32 %9, ptr %arrayidx8.i23.i.i, align 4, !tbaa !5
br label %put.exit24.i.i
put.exit24.i.i: ; preds = %if.then.i22.i.i, %put.exit.i.i
store i32 0, ptr %arrayidx.i.i40, align 4, !tbaa !5
br label %pus.exit.i
pus.exit.i: ; preds = %put.exit24.i.i, %for.body.i
%dec.i = add nsw i32 %h.04.i, -1
%cmp.i = icmp sgt i32 %h.04.i, 1
br i1 %cmp.i, label %for.body.i, label %for.body.i44, !llvm.loop !11
for.body.i44: ; preds = %pus.exit.i, %pus.exit.i71
%h.04.i45 = phi i32 [ %dec.i72, %pus.exit.i71 ], [ %6, %pus.exit.i ]
%shr.i46 = ashr i32 %add7, %h.04.i45
%idxprom.i.i47 = sext i32 %shr.i46 to i64
%arrayidx.i.i48 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i47
%11 = load i32, ptr %arrayidx.i.i48, align 4, !tbaa !5
%tobool.not.i.i49 = icmp eq i32 %11, 0
br i1 %tobool.not.i.i49, label %pus.exit.i71, label %if.then.i.i50
if.then.i.i50: ; preds = %for.body.i44
%shl.i.i51 = shl nsw i32 %shr.i46, 1
%idxprom.i.i.i52 = sext i32 %shl.i.i51 to i64
%arrayidx.i.i.i53 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i.i.i52
%12 = load i32, ptr %arrayidx.i.i.i53, align 8, !tbaa !5
%conv.i.i.i54 = sext i32 %12 to i64
%conv1.i.i.i55 = sext i32 %11 to i64
%mul.i.i.i56 = mul nsw i64 %conv.i.i.i54, %conv1.i.i.i55
%arrayidx3.i.i.i57 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i.i.i52
store i64 %mul.i.i.i56, ptr %arrayidx3.i.i.i57, align 16, !tbaa !9
%arrayidx5.i.i.i58 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i.i.i52
store i32 %11, ptr %arrayidx5.i.i.i58, align 8, !tbaa !5
%cmp.i.i.i59 = icmp sgt i32 %0, %shl.i.i51
br i1 %cmp.i.i.i59, label %if.then.i.i.i76, label %put.exit.i.i60
if.then.i.i.i76: ; preds = %if.then.i.i50
%arrayidx8.i.i.i77 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i.i52
store i32 %11, ptr %arrayidx8.i.i.i77, align 8, !tbaa !5
%.pre.i.i78 = load i32, ptr %arrayidx.i.i48, align 4, !tbaa !5
%.pre25.i.i79 = sext i32 %.pre.i.i78 to i64
br label %put.exit.i.i60
put.exit.i.i60: ; preds = %if.then.i.i.i76, %if.then.i.i50
%conv1.i17.pre-phi.i.i61 = phi i64 [ %conv1.i.i.i55, %if.then.i.i50 ], [ %.pre25.i.i79, %if.then.i.i.i76 ]
%13 = phi i32 [ %11, %if.then.i.i50 ], [ %.pre.i.i78, %if.then.i.i.i76 ]
%or4.i.i62 = or i32 %shl.i.i51, 1
%idxprom.i14.i.i63 = sext i32 %or4.i.i62 to i64
%arrayidx.i15.i.i64 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i14.i.i63
%14 = load i32, ptr %arrayidx.i15.i.i64, align 4, !tbaa !5
%conv.i16.i.i65 = sext i32 %14 to i64
%mul.i18.i.i66 = mul nsw i64 %conv1.i17.pre-phi.i.i61, %conv.i16.i.i65
%arrayidx3.i19.i.i67 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i14.i.i63
store i64 %mul.i18.i.i66, ptr %arrayidx3.i19.i.i67, align 8, !tbaa !9
%arrayidx5.i20.i.i68 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i14.i.i63
store i32 %13, ptr %arrayidx5.i20.i.i68, align 4, !tbaa !5
%cmp.i21.i.i69 = icmp sgt i32 %0, %or4.i.i62
br i1 %cmp.i21.i.i69, label %if.then.i22.i.i74, label %put.exit24.i.i70
if.then.i22.i.i74: ; preds = %put.exit.i.i60
%arrayidx8.i23.i.i75 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i14.i.i63
store i32 %13, ptr %arrayidx8.i23.i.i75, align 4, !tbaa !5
br label %put.exit24.i.i70
put.exit24.i.i70: ; preds = %if.then.i22.i.i74, %put.exit.i.i60
store i32 0, ptr %arrayidx.i.i48, align 4, !tbaa !5
br label %pus.exit.i71
pus.exit.i71: ; preds = %put.exit24.i.i70, %for.body.i44
%dec.i72 = add nsw i32 %h.04.i45, -1
%cmp.i73 = icmp sgt i32 %h.04.i45, 1
br i1 %cmp.i73, label %for.body.i44, label %push.exit80, !llvm.loop !11
push.exit80: ; preds = %pus.exit.i71, %if.end
%cmp8.not128 = icmp sgt i32 %l.0.lcssa, %add7
br i1 %cmp8.not128, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %push.exit80
%conv1.i = sext i32 %x to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%r.addr.0130 = phi i32 [ %add7, %for.body.lr.ph ], [ %shr16, %for.inc ]
%l.1129 = phi i32 [ %l.0.lcssa, %for.body.lr.ph ], [ %shr, %for.inc ]
%and = and i32 %l.1129, 1
%cmp9.not = icmp eq i32 %and, 0
br i1 %cmp9.not, label %if.end11, label %if.then10
if.then10: ; preds = %for.body
%inc = add nsw i32 %l.1129, 1
%idxprom.i81 = sext i32 %l.1129 to i64
%arrayidx.i82 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i81
%15 = load i32, ptr %arrayidx.i82, align 4, !tbaa !5
%conv.i = sext i32 %15 to i64
%mul.i = mul nsw i64 %conv.i, %conv1.i
%arrayidx3.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i81
store i64 %mul.i, ptr %arrayidx3.i, align 8, !tbaa !9
%arrayidx5.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i81
store i32 %x, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp.i83 = icmp sgt i32 %0, %l.1129
br i1 %cmp.i83, label %if.then.i84, label %if.end11
if.then.i84: ; preds = %if.then10
%arrayidx8.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i81
store i32 %x, ptr %arrayidx8.i, align 4, !tbaa !5
br label %if.end11
if.end11: ; preds = %if.then.i84, %if.then10, %for.body
%l.2 = phi i32 [ %l.1129, %for.body ], [ %inc, %if.then10 ], [ %inc, %if.then.i84 ]
%and12 = and i32 %r.addr.0130, 1
%cmp13 = icmp eq i32 %and12, 0
br i1 %cmp13, label %if.then14, label %for.inc
if.then14: ; preds = %if.end11
%dec = add nsw i32 %r.addr.0130, -1
%idxprom.i85 = sext i32 %r.addr.0130 to i64
%arrayidx.i86 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i85
%16 = load i32, ptr %arrayidx.i86, align 4, !tbaa !5
%conv.i87 = sext i32 %16 to i64
%mul.i89 = mul nsw i64 %conv.i87, %conv1.i
%arrayidx3.i90 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i85
store i64 %mul.i89, ptr %arrayidx3.i90, align 8, !tbaa !9
%arrayidx5.i91 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i85
store i32 %x, ptr %arrayidx5.i91, align 4, !tbaa !5
%cmp.i92 = icmp sgt i32 %0, %r.addr.0130
br i1 %cmp.i92, label %if.then.i93, label %for.inc
if.then.i93: ; preds = %if.then14
%arrayidx8.i94 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i85
store i32 %x, ptr %arrayidx8.i94, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then.i93, %if.then14, %if.end11
%r.addr.1 = phi i32 [ %r.addr.0130, %if.end11 ], [ %dec, %if.then14 ], [ %dec, %if.then.i93 ]
%shr = ashr i32 %l.2, 1
%shr16 = ashr i32 %r.addr.1, 1
%cmp8.not = icmp sgt i32 %shr, %shr16
br i1 %cmp8.not, label %for.end, label %for.body, !llvm.loop !21
for.end: ; preds = %for.inc, %push.exit80
%cmp2.i = icmp sgt i32 %l.0.lcssa, 1
br i1 %cmp2.i, label %while.body.i, label %pull.exit
while.body.i: ; preds = %for.end, %pul.exit.i
%i.addr.03.i = phi i32 [ %shr.i96, %pul.exit.i ], [ %l.0.lcssa, %for.end ]
%shr.i96 = lshr i32 %i.addr.03.i, 1
%idxprom.i.i97 = zext i32 %shr.i96 to i64
%arrayidx.i.i98 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i97
%17 = load i32, ptr %arrayidx.i.i98, align 4, !tbaa !5
%tobool.not.i.i99 = icmp eq i32 %17, 0
br i1 %tobool.not.i.i99, label %if.then.i.i101, label %pul.exit.i
if.then.i.i101: ; preds = %while.body.i
%shl.i.i102 = and i32 %i.addr.03.i, 2147483646
%or2.i.i = or i32 %i.addr.03.i, 1
%idxprom3.i.i = zext i32 %shl.i.i102 to i64
%arrayidx4.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom3.i.i
%18 = load i64, ptr %arrayidx4.i.i, align 16, !tbaa !9
%idxprom5.i.i = zext i32 %or2.i.i to i64
%arrayidx6.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom5.i.i
%19 = load i64, ptr %arrayidx6.i.i, align 8, !tbaa !9
%add.i.i = add nsw i64 %19, %18
%arrayidx8.i.i103 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i.i97
store i64 %add.i.i, ptr %arrayidx8.i.i103, align 8, !tbaa !9
%arrayidx10.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom5.i.i
%20 = load i32, ptr %arrayidx10.i.i, align 4, !tbaa !5
%arrayidx12.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i.i97
store i32 %20, ptr %arrayidx12.i.i, align 4, !tbaa !5
br label %pul.exit.i
pul.exit.i: ; preds = %if.then.i.i101, %while.body.i
%cmp.i100 = icmp ugt i32 %i.addr.03.i, 3
br i1 %cmp.i100, label %while.body.i, label %pull.exit, !llvm.loop !13
pull.exit: ; preds = %pul.exit.i, %for.end
%cmp2.i104 = icmp sgt i32 %add7, 1
br i1 %cmp2.i104, label %while.body.i105, label %cleanup
while.body.i105: ; preds = %pull.exit, %pul.exit.i111
%i.addr.03.i106 = phi i32 [ %shr.i107, %pul.exit.i111 ], [ %add7, %pull.exit ]
%shr.i107 = lshr i32 %i.addr.03.i106, 1
%idxprom.i.i108 = zext i32 %shr.i107 to i64
%arrayidx.i.i109 = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i108
%21 = load i32, ptr %arrayidx.i.i109, align 4, !tbaa !5
%tobool.not.i.i110 = icmp eq i32 %21, 0
br i1 %tobool.not.i.i110, label %if.then.i.i113, label %pul.exit.i111
if.then.i.i113: ; preds = %while.body.i105
%shl.i.i114 = and i32 %i.addr.03.i106, 2147483646
%or2.i.i115 = or i32 %i.addr.03.i106, 1
%idxprom3.i.i116 = zext i32 %shl.i.i114 to i64
%arrayidx4.i.i117 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom3.i.i116
%22 = load i64, ptr %arrayidx4.i.i117, align 16, !tbaa !9
%idxprom5.i.i118 = zext i32 %or2.i.i115 to i64
%arrayidx6.i.i119 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom5.i.i118
%23 = load i64, ptr %arrayidx6.i.i119, align 8, !tbaa !9
%add.i.i120 = add nsw i64 %23, %22
%arrayidx8.i.i121 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i.i108
store i64 %add.i.i120, ptr %arrayidx8.i.i121, align 8, !tbaa !9
%arrayidx10.i.i122 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom5.i.i118
%24 = load i32, ptr %arrayidx10.i.i122, align 4, !tbaa !5
%arrayidx12.i.i123 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i.i108
store i32 %24, ptr %arrayidx12.i.i123, align 4, !tbaa !5
br label %pul.exit.i111
pul.exit.i111: ; preds = %if.then.i.i113, %while.body.i105
%cmp.i112 = icmp ugt i32 %i.addr.03.i106, 3
br i1 %cmp.i112, label %while.body.i105, label %cleanup, !llvm.loop !13
cleanup: ; preds = %pul.exit.i111, %pull.exit, %while.end
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @query_(i32 noundef %i) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @x, align 4, !tbaa !5
%conv29 = sext i32 %0 to i64
%idxprom30 = sext i32 %i to i64
%arrayidx31 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom30
%1 = load i64, ptr %arrayidx31, align 8, !tbaa !9
%cmp.not32 = icmp sgt i64 %1, %conv29
br i1 %cmp.not32, label %if.end, label %if.then
if.then: ; preds = %pus.exit, %entry
%accumulator.tr.lcssa = phi i32 [ 0, %entry ], [ %add, %pus.exit ]
%.lcssa25 = phi i32 [ %0, %entry ], [ %11, %pus.exit ]
%idxprom.lcssa = phi i64 [ %idxprom30, %entry ], [ %idxprom.pre-phi, %pus.exit ]
%.lcssa = phi i64 [ %1, %entry ], [ %12, %pus.exit ]
%2 = trunc i64 %.lcssa to i32
%conv5 = sub i32 %.lcssa25, %2
store i32 %conv5, ptr @x, align 4, !tbaa !5
%arrayidx7 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.lcssa
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
br label %return
if.end: ; preds = %entry, %pus.exit
%idxprom35 = phi i64 [ %idxprom.pre-phi, %pus.exit ], [ %idxprom30, %entry ]
%4 = phi i32 [ %11, %pus.exit ], [ %0, %entry ]
%i.tr34 = phi i32 [ %or15.pre-phi, %pus.exit ], [ %i, %entry ]
%accumulator.tr33 = phi i32 [ %add, %pus.exit ], [ 0, %entry ]
%arrayidx9 = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom35
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp slt i32 %4, %5
br i1 %cmp10, label %return, label %if.end13
if.end13: ; preds = %if.end
%arrayidx.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom35
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%tobool.not.i = icmp eq i32 %6, 0
%.pre = shl i32 %i.tr34, 1
br i1 %tobool.not.i, label %if.end13.pus.exit_crit_edge, label %if.then.i
if.end13.pus.exit_crit_edge: ; preds = %if.end13
%.pre43 = or i32 %.pre, 1
%.pre44 = sext i32 %.pre43 to i64
br label %pus.exit
if.then.i: ; preds = %if.end13
%idxprom.i.i = sext i32 %.pre to i64
%arrayidx.i.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i.i
%7 = load i32, ptr %arrayidx.i.i, align 8, !tbaa !5
%conv.i.i = sext i32 %7 to i64
%conv1.i.i = sext i32 %6 to i64
%mul.i.i = mul nsw i64 %conv.i.i, %conv1.i.i
%arrayidx3.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i.i
store i64 %mul.i.i, ptr %arrayidx3.i.i, align 16, !tbaa !9
%arrayidx5.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i.i
store i32 %6, ptr %arrayidx5.i.i, align 8, !tbaa !5
%8 = load i32, ptr @n_, align 4, !tbaa !5
%cmp.i.i = icmp sgt i32 %8, %.pre
br i1 %cmp.i.i, label %if.then.i.i, label %put.exit.i
if.then.i.i: ; preds = %if.then.i
%arrayidx8.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i
store i32 %6, ptr %arrayidx8.i.i, align 8, !tbaa !5
%.pre.i = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%.pre25.i = sext i32 %.pre.i to i64
br label %put.exit.i
put.exit.i: ; preds = %if.then.i.i, %if.then.i
%conv1.i17.pre-phi.i = phi i64 [ %conv1.i.i, %if.then.i ], [ %.pre25.i, %if.then.i.i ]
%9 = phi i32 [ %6, %if.then.i ], [ %.pre.i, %if.then.i.i ]
%or4.i = or i32 %.pre, 1
%idxprom.i14.i = sext i32 %or4.i to i64
%arrayidx.i15.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i14.i
%10 = load i32, ptr %arrayidx.i15.i, align 4, !tbaa !5
%conv.i16.i = sext i32 %10 to i64
%mul.i18.i = mul nsw i64 %conv1.i17.pre-phi.i, %conv.i16.i
%arrayidx3.i19.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i14.i
store i64 %mul.i18.i, ptr %arrayidx3.i19.i, align 8, !tbaa !9
%arrayidx5.i20.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i14.i
store i32 %9, ptr %arrayidx5.i20.i, align 4, !tbaa !5
%cmp.i21.i = icmp sgt i32 %8, %or4.i
br i1 %cmp.i21.i, label %if.then.i22.i, label %put.exit24.i
if.then.i22.i: ; preds = %put.exit.i
%arrayidx8.i23.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i14.i
store i32 %9, ptr %arrayidx8.i23.i, align 4, !tbaa !5
br label %put.exit24.i
put.exit24.i: ; preds = %if.then.i22.i, %put.exit.i
store i32 0, ptr %arrayidx.i, align 4, !tbaa !5
br label %pus.exit
pus.exit: ; preds = %if.end13.pus.exit_crit_edge, %put.exit24.i
%idxprom.pre-phi = phi i64 [ %.pre44, %if.end13.pus.exit_crit_edge ], [ %idxprom.i14.i, %put.exit24.i ]
%or15.pre-phi = phi i32 [ %.pre43, %if.end13.pus.exit_crit_edge ], [ %or4.i, %put.exit24.i ]
%call = tail call i32 @query_(i32 noundef %.pre)
%add = add nsw i32 %call, %accumulator.tr33
%11 = load i32, ptr @x, align 4, !tbaa !5
%conv = sext i32 %11 to i64
%arrayidx = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.pre-phi
%12 = load i64, ptr %arrayidx, align 8, !tbaa !9
%cmp.not = icmp sgt i64 %12, %conv
br i1 %cmp.not, label %if.end, label %if.then
return: ; preds = %if.end, %if.then
%accumulator.tr28 = phi i32 [ %accumulator.tr.lcssa, %if.then ], [ %accumulator.tr33, %if.end ]
%retval.0 = phi i32 [ %3, %if.then ], [ 0, %if.end ]
%accumulator.ret.tr = add nsw i32 %retval.0, %accumulator.tr28
ret i32 %accumulator.ret.tr
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @query(i32 noundef %l) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @n_, align 4
%mul = shl nsw i32 %0, 1
%sub = add nsw i32 %mul, -1
%add = add nsw i32 %0, %l
%1 = load i32, ptr @h_, align 4, !tbaa !5
%cmp3.i = icmp sgt i32 %1, 0
br i1 %cmp3.i, label %for.body.i, label %push.exit
for.body.i: ; preds = %entry, %pus.exit.i
%h.04.i = phi i32 [ %dec.i, %pus.exit.i ], [ %1, %entry ]
%shr.i = ashr i32 %add, %h.04.i
%idxprom.i.i = sext i32 %shr.i to i64
%arrayidx.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i
%2 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%tobool.not.i.i = icmp eq i32 %2, 0
br i1 %tobool.not.i.i, label %pus.exit.i, label %if.then.i.i
if.then.i.i: ; preds = %for.body.i
%shl.i.i = shl nsw i32 %shr.i, 1
%idxprom.i.i.i = sext i32 %shl.i.i to i64
%arrayidx.i.i.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i.i.i
%3 = load i32, ptr %arrayidx.i.i.i, align 8, !tbaa !5
%conv.i.i.i = sext i32 %3 to i64
%conv1.i.i.i = sext i32 %2 to i64
%mul.i.i.i = mul nsw i64 %conv.i.i.i, %conv1.i.i.i
%arrayidx3.i.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i.i.i
store i64 %mul.i.i.i, ptr %arrayidx3.i.i.i, align 16, !tbaa !9
%arrayidx5.i.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i.i.i
store i32 %2, ptr %arrayidx5.i.i.i, align 8, !tbaa !5
%cmp.i.i.i = icmp sgt i32 %0, %shl.i.i
br i1 %cmp.i.i.i, label %if.then.i.i.i, label %put.exit.i.i
if.then.i.i.i: ; preds = %if.then.i.i
%arrayidx8.i.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i.i.i
store i32 %2, ptr %arrayidx8.i.i.i, align 8, !tbaa !5
%.pre.i.i = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%.pre25.i.i = sext i32 %.pre.i.i to i64
br label %put.exit.i.i
put.exit.i.i: ; preds = %if.then.i.i.i, %if.then.i.i
%conv1.i17.pre-phi.i.i = phi i64 [ %conv1.i.i.i, %if.then.i.i ], [ %.pre25.i.i, %if.then.i.i.i ]
%4 = phi i32 [ %2, %if.then.i.i ], [ %.pre.i.i, %if.then.i.i.i ]
%or4.i.i = or i32 %shl.i.i, 1
%idxprom.i14.i.i = sext i32 %or4.i.i to i64
%arrayidx.i15.i.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom.i14.i.i
%5 = load i32, ptr %arrayidx.i15.i.i, align 4, !tbaa !5
%conv.i16.i.i = sext i32 %5 to i64
%mul.i18.i.i = mul nsw i64 %conv1.i17.pre-phi.i.i, %conv.i16.i.i
%arrayidx3.i19.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom.i14.i.i
store i64 %mul.i18.i.i, ptr %arrayidx3.i19.i.i, align 8, !tbaa !9
%arrayidx5.i20.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom.i14.i.i
store i32 %4, ptr %arrayidx5.i20.i.i, align 4, !tbaa !5
%cmp.i21.i.i = icmp sgt i32 %0, %or4.i.i
br i1 %cmp.i21.i.i, label %if.then.i22.i.i, label %put.exit24.i.i
if.then.i22.i.i: ; preds = %put.exit.i.i
%arrayidx8.i23.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %idxprom.i14.i.i
store i32 %4, ptr %arrayidx8.i23.i.i, align 4, !tbaa !5
br label %put.exit24.i.i
put.exit24.i.i: ; preds = %if.then.i22.i.i, %put.exit.i.i
store i32 0, ptr %arrayidx.i.i, align 4, !tbaa !5
br label %pus.exit.i
pus.exit.i: ; preds = %put.exit24.i.i, %for.body.i
%dec.i = add nsw i32 %h.04.i, -1
%cmp.i = icmp sgt i32 %h.04.i, 1
br i1 %cmp.i, label %for.body.i, label %push.exit, !llvm.loop !11
push.exit: ; preds = %pus.exit.i, %entry
%cmp.not10.not = icmp slt i32 %add, %mul
br i1 %cmp.not10.not, label %for.body, label %for.end
for.body: ; preds = %push.exit, %for.inc
%cnt.013 = phi i32 [ %cnt.1, %for.inc ], [ 0, %push.exit ]
%r.012 = phi i32 [ %shr3, %for.inc ], [ %sub, %push.exit ]
%l.addr.011 = phi i32 [ %shr, %for.inc ], [ %add, %push.exit ]
%and = and i32 %l.addr.011, 1
%cmp1.not = icmp eq i32 %and, 0
br i1 %cmp1.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%inc = add nsw i32 %l.addr.011, 1
%call = tail call i32 @query_(i32 noundef %l.addr.011)
%add2 = add nsw i32 %call, %cnt.013
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%l.addr.1 = phi i32 [ %inc, %if.then ], [ %l.addr.011, %for.body ]
%cnt.1 = phi i32 [ %add2, %if.then ], [ %cnt.013, %for.body ]
%shr = ashr i32 %l.addr.1, 1
%shr3 = ashr i32 %r.012, 1
%cmp.not = icmp sgt i32 %shr, %shr3
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !22
for.end: ; preds = %for.inc, %push.exit
%cnt.0.lcssa = phi i32 [ 0, %push.exit ], [ %cnt.1, %for.inc ]
ret i32 %cnt.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%i = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
store i32 0, ptr %i, align 4, !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %while.cond.i.preheader
while.cond.i.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
br label %while.cond.i
for.body: ; preds = %entry, %for.body
%1 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%idxprom = zext i32 %1 to i64
%arrayidx = getelementptr inbounds [200000 x i32], ptr @main.aa, i64 0, i64 %idxprom
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i32 %1, 1
store i32 %inc, ptr %i, align 4, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %while.cond.i.preheader, !llvm.loop !23
while.cond.i: ; preds = %while.cond.i.preheader, %while.cond.i
%storemerge.i = phi i32 [ %inc.i, %while.cond.i ], [ 0, %while.cond.i.preheader ]
%shl.i = shl nuw i32 1, %storemerge.i
%cmp.i = icmp slt i32 %shl.i, %.lcssa
%inc.i = add nuw nsw i32 %storemerge.i, 1
br i1 %cmp.i, label %while.cond.i, label %while.end.i, !llvm.loop !14
while.end.i: ; preds = %while.cond.i
store i32 %storemerge.i, ptr @h_, align 4, !tbaa !5
store i32 %shl.i, ptr @n_, align 4, !tbaa !5
%cmp240.i = icmp sgt i32 %.lcssa, 0
br i1 %cmp240.i, label %for.body.preheader.i, label %for.cond12.preheader.i
for.body.preheader.i: ; preds = %while.end.i
%3 = sext i32 %shl.i to i64
%wide.trip.count.i = zext i32 %.lcssa to i64
%4 = shl nsw i64 %3, 2
%scevgep = getelementptr i8, ptr @mn, i64 %4
%5 = shl nuw nsw i64 %wide.trip.count.i, 2
call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep, ptr nonnull align 16 @main.aa, i64 %5, i1 false), !tbaa !5
%min.iters.check = icmp ult i32 %.lcssa, 4
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i
%n.vec = and i64 %wide.trip.count.i, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%6 = getelementptr inbounds i32, ptr @main.aa, i64 %index
%wide.load = load <2 x i32>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 2
%wide.load15 = load <2 x i32>, ptr %7, align 8, !tbaa !5
%8 = add nuw nsw i64 %index, %3
%9 = sext <2 x i32> %wide.load to <2 x i64>
%10 = sext <2 x i32> %wide.load15 to <2 x i64>
%11 = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %8
store <2 x i64> %9, ptr %11, align 8, !tbaa !9
%12 = getelementptr inbounds i64, ptr %11, i64 2
store <2 x i64> %10, ptr %12, align 8, !tbaa !9
%13 = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %8
store <2 x i32> <i32 1, i32 1>, ptr %13, align 4, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 2
store <2 x i32> <i32 1, i32 1>, ptr %14, align 4, !tbaa !5
%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 !24
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond12.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
br label %for.body.i
for.cond12.preheader.i: ; preds = %for.body.i, %middle.block, %while.end.i
%cmp1342.i = icmp sgt i32 %shl.i, 1
br i1 %cmp1342.i, label %for.body15.preheader.i, label %build.exit
for.body15.preheader.i: ; preds = %for.cond12.preheader.i
%16 = zext i32 %shl.i to i64
br label %for.body15.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds i32, ptr @main.aa, i64 %indvars.iv.i
%17 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%18 = add nuw nsw i64 %indvars.iv.i, %3
%conv.i = sext i32 %17 to i64
%arrayidx7.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %18
store i64 %conv.i, ptr %arrayidx7.i, align 8, !tbaa !9
%arrayidx10.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %18
store i32 1, ptr %arrayidx10.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond12.preheader.i, label %for.body.i, !llvm.loop !25
for.body15.i: ; preds = %pul.exit.i, %for.body15.preheader.i
%indvars.iv46.i = phi i64 [ %16, %for.body15.preheader.i ], [ %indvars.iv.next47.i, %pul.exit.i ]
%indvars.iv.next47.i = add nsw i64 %indvars.iv46.i, -1
%arrayidx.i.i = getelementptr inbounds [262144 x i32], ptr @lz, i64 0, i64 %indvars.iv.next47.i
%19 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%tobool.not.i.i = icmp eq i32 %19, 0
%20 = trunc i64 %indvars.iv.next47.i to i32
%shl.i.i = shl nuw i32 %20, 1
br i1 %tobool.not.i.i, label %if.then.i.i, label %for.body15.pul.exit_crit_edge.i
for.body15.pul.exit_crit_edge.i: ; preds = %for.body15.i
%.pre50.i = sext i32 %shl.i.i to i64
%.pre51.i = or i32 %shl.i.i, 1
%.pre52.i = sext i32 %.pre51.i to i64
br label %pul.exit.i
if.then.i.i: ; preds = %for.body15.i
%or2.i.i = or i32 %shl.i.i, 1
%idxprom3.i.i = sext i32 %shl.i.i to i64
%arrayidx4.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom3.i.i
%21 = load i64, ptr %arrayidx4.i.i, align 16, !tbaa !9
%idxprom5.i.i = sext i32 %or2.i.i to i64
%arrayidx6.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %idxprom5.i.i
%22 = load i64, ptr %arrayidx6.i.i, align 8, !tbaa !9
%add.i.i = add nsw i64 %22, %21
%arrayidx8.i.i = getelementptr inbounds [524288 x i64], ptr @sum, i64 0, i64 %indvars.iv.next47.i
store i64 %add.i.i, ptr %arrayidx8.i.i, align 8, !tbaa !9
%arrayidx10.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %idxprom5.i.i
%23 = load i32, ptr %arrayidx10.i.i, align 4, !tbaa !5
%arrayidx12.i.i = getelementptr inbounds [524288 x i32], ptr @mn, i64 0, i64 %indvars.iv.next47.i
store i32 %23, ptr %arrayidx12.i.i, align 4, !tbaa !5
br label %pul.exit.i
pul.exit.i: ; preds = %if.then.i.i, %for.body15.pul.exit_crit_edge.i
%idxprom21.pre-phi.i = phi i64 [ %.pre52.i, %for.body15.pul.exit_crit_edge.i ], [ %idxprom5.i.i, %if.then.i.i ]
%idxprom17.pre-phi.i = phi i64 [ %.pre50.i, %for.body15.pul.exit_crit_edge.i ], [ %idxprom3.i.i, %if.then.i.i ]
%arrayidx18.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom17.pre-phi.i
%24 = load i32, ptr %arrayidx18.i, align 4, !tbaa !5
%arrayidx22.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %idxprom21.pre-phi.i
%25 = load i32, ptr %arrayidx22.i, align 4, !tbaa !5
%add23.i = add nsw i32 %25, %24
%arrayidx25.i = getelementptr inbounds [524288 x i32], ptr @sz, i64 0, i64 %indvars.iv.next47.i
store i32 %add23.i, ptr %arrayidx25.i, align 4, !tbaa !5
%cmp13.i = icmp ugt i64 %indvars.iv46.i, 2
br i1 %cmp13.i, label %for.body15.i, label %build.exit, !llvm.loop !19
build.exit: ; preds = %pul.exit.i, %for.cond12.preheader.i
%26 = load i32, ptr %q, align 4, !tbaa !5
%dec10 = add nsw i32 %26, -1
store i32 %dec10, ptr %q, align 4, !tbaa !5
%tobool.not11 = icmp eq i32 %26, 0
br i1 %tobool.not11, label %while.end, label %while.body
while.body: ; preds = %build.exit, %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #9
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t, ptr noundef nonnull %i, ptr noundef nonnull @x)
%27 = load i32, ptr %i, align 4, !tbaa !5
%dec3 = add nsw i32 %27, -1
store i32 %dec3, ptr %i, align 4, !tbaa !5
%28 = load i32, ptr %t, align 4, !tbaa !5
%cmp4 = icmp eq i32 %28, 1
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %while.body
%29 = load i32, ptr @x, align 4, !tbaa !5
call void @update(i32 noundef %dec3, i32 noundef %29)
br label %if.end
if.else: ; preds = %while.body
%call5 = call i32 @query(i32 noundef %dec3)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %call5)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #9
%30 = load i32, ptr %q, align 4, !tbaa !5
%dec = add nsw i32 %30, -1
store i32 %dec, ptr %q, align 4, !tbaa !5
%tobool.not = icmp eq i32 %30, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !26
while.end: ; preds = %if.end, %build.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8
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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !12, !16}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12, !16, !17}
!25 = distinct !{!25, !12, !17, !16}
!26 = distinct !{!26, !12}
|
#include <stdio.h>
#include<stdlib.h>
int main()
{
int t,n,k,i,m,p;
long long int ans;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&n,&k);
m=n*k;
int* arr=(int*) malloc(m*sizeof(int));
for(i=0;i<m;i++)
{
scanf("%d",&arr[i]);
}
if(n%2==0)
p=n/2;
else
p=n/2+1;
p--;
p=n-p;
ans=0;
for(i=m;k>0;k--)
{
m=m-p;
ans+=arr[m];
}
printf("%lld\n",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%k = 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 %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec38 = add nsw i32 %0, -1
store i32 %dec38, ptr %t, align 4, !tbaa !5
%tobool.not39 = icmp eq i32 %0, 0
br i1 %tobool.not39, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end21
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %k, align 4, !tbaa !5
%mul = mul nsw i32 %2, %1
%conv = sext i32 %mul to i64
%mul2 = shl nsw i64 %conv, 2
%call3 = call noalias ptr @malloc(i64 noundef %mul2) #5
%cmp33 = icmp sgt i32 %mul, 0
br i1 %cmp33, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %while.body
%wide.trip.count = zext i32 %mul to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %call3, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %while.body
%3 = phi i32 [ %.pre, %for.end.loopexit ], [ %1, %while.body ]
%.pr = load i32, ptr %k, align 4, !tbaa !5
%cmp1135 = icmp sgt i32 %.pr, 0
br i1 %cmp1135, label %for.body13.lr.ph, label %for.end21
for.body13.lr.ph: ; preds = %for.end
%div.neg.neg = sdiv i32 %3, 2
%4 = and i32 %3, 1
%p.0.neg.neg40 = add nsw i32 %div.neg.neg, %4
%dec9.neg.neg = xor i32 %3, -1
%sub.neg = add i32 %p.0.neg.neg40, %dec9.neg.neg
%xtraiter = and i32 %.pr, 3
%5 = icmp ult i32 %.pr, 4
br i1 %5, label %for.cond10.for.end21_crit_edge.unr-lcssa, label %for.body13.lr.ph.new
for.body13.lr.ph.new: ; preds = %for.body13.lr.ph
%unroll_iter = and i32 %.pr, -4
br label %for.body13
for.body13: ; preds = %for.body13, %for.body13.lr.ph.new
%ans.037 = phi i64 [ 0, %for.body13.lr.ph.new ], [ %add18.3, %for.body13 ]
%m.036 = phi i32 [ %mul, %for.body13.lr.ph.new ], [ %sub14.3, %for.body13 ]
%niter = phi i32 [ 0, %for.body13.lr.ph.new ], [ %niter.next.3, %for.body13 ]
%sub14 = add i32 %sub.neg, %m.036
%idxprom15 = sext i32 %sub14 to i64
%arrayidx16 = getelementptr inbounds i32, ptr %call3, i64 %idxprom15
%6 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%conv17 = sext i32 %6 to i64
%add18 = add nsw i64 %ans.037, %conv17
%sub14.1 = add i32 %sub.neg, %sub14
%idxprom15.1 = sext i32 %sub14.1 to i64
%arrayidx16.1 = getelementptr inbounds i32, ptr %call3, i64 %idxprom15.1
%7 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
%conv17.1 = sext i32 %7 to i64
%add18.1 = add nsw i64 %add18, %conv17.1
%sub14.2 = add i32 %sub.neg, %sub14.1
%idxprom15.2 = sext i32 %sub14.2 to i64
%arrayidx16.2 = getelementptr inbounds i32, ptr %call3, i64 %idxprom15.2
%8 = load i32, ptr %arrayidx16.2, align 4, !tbaa !5
%conv17.2 = sext i32 %8 to i64
%add18.2 = add nsw i64 %add18.1, %conv17.2
%sub14.3 = add i32 %sub.neg, %sub14.2
%idxprom15.3 = sext i32 %sub14.3 to i64
%arrayidx16.3 = getelementptr inbounds i32, ptr %call3, i64 %idxprom15.3
%9 = load i32, ptr %arrayidx16.3, align 4, !tbaa !5
%conv17.3 = sext i32 %9 to i64
%add18.3 = add nsw i64 %add18.2, %conv17.3
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3.not = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3.not, label %for.cond10.for.end21_crit_edge.unr-lcssa, label %for.body13, !llvm.loop !11
for.cond10.for.end21_crit_edge.unr-lcssa: ; preds = %for.body13, %for.body13.lr.ph
%add18.lcssa.ph = phi i64 [ undef, %for.body13.lr.ph ], [ %add18.3, %for.body13 ]
%ans.037.unr = phi i64 [ 0, %for.body13.lr.ph ], [ %add18.3, %for.body13 ]
%m.036.unr = phi i32 [ %mul, %for.body13.lr.ph ], [ %sub14.3, %for.body13 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond10.for.end21_crit_edge, label %for.body13.epil
for.body13.epil: ; preds = %for.cond10.for.end21_crit_edge.unr-lcssa, %for.body13.epil
%ans.037.epil = phi i64 [ %add18.epil, %for.body13.epil ], [ %ans.037.unr, %for.cond10.for.end21_crit_edge.unr-lcssa ]
%m.036.epil = phi i32 [ %sub14.epil, %for.body13.epil ], [ %m.036.unr, %for.cond10.for.end21_crit_edge.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body13.epil ], [ 0, %for.cond10.for.end21_crit_edge.unr-lcssa ]
%sub14.epil = add i32 %sub.neg, %m.036.epil
%idxprom15.epil = sext i32 %sub14.epil to i64
%arrayidx16.epil = getelementptr inbounds i32, ptr %call3, i64 %idxprom15.epil
%10 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
%conv17.epil = sext i32 %10 to i64
%add18.epil = add nsw i64 %ans.037.epil, %conv17.epil
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond10.for.end21_crit_edge, label %for.body13.epil, !llvm.loop !12
for.cond10.for.end21_crit_edge: ; preds = %for.body13.epil, %for.cond10.for.end21_crit_edge.unr-lcssa
%add18.lcssa = phi i64 [ %add18.lcssa.ph, %for.cond10.for.end21_crit_edge.unr-lcssa ], [ %add18.epil, %for.body13.epil ]
store i32 0, ptr %k, align 4, !tbaa !5
br label %for.end21
for.end21: ; preds = %for.cond10.for.end21_crit_edge, %for.end
%ans.0.lcssa = phi i64 [ %add18.lcssa, %for.cond10.for.end21_crit_edge ], [ 0, %for.end ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
%11 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %11, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %11, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %for.end21, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nounwind }
attributes #5 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,N;
int* arr;
int sum=0;
scanf("%d",&N);
arr = (int*)malloc(sizeof(int));
for(i=0;i<N;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<N;i++)
{
for(j=i+1;j<N;j++)
{
sum += arr[i]*arr[j];
}
}
printf("%d",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101753/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101753/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call1 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #6
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.end19
for.cond3.preheader: ; preds = %for.body
%cmp438 = icmp sgt i32 %2, 0
br i1 %cmp438, label %for.body5.preheader, label %for.end19
for.body5.preheader: ; preds = %for.cond3.preheader
%1 = zext i32 %2 to i64
%wide.trip.count52 = zext i32 %2 to i64
br label %for.body5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %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.body8, %middle.block, %for.body5
%sum.1.lcssa = phi i32 [ %sum.040, %for.body5 ], [ %16, %middle.block ], [ %add13, %for.body8 ]
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond53.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count52
br i1 %exitcond53.not, label %for.end19, label %for.body5, !llvm.loop !11
for.body5: ; preds = %for.body5.preheader, %for.cond3.loopexit
%indvars.iv49 = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next50, %for.cond3.loopexit ]
%indvars.iv44 = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next45, %for.cond3.loopexit ]
%sum.040 = phi i32 [ 0, %for.body5.preheader ], [ %sum.1.lcssa, %for.cond3.loopexit ]
%4 = xor i64 %indvars.iv49, -1
%5 = add nsw i64 %4, %wide.trip.count52
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%cmp734 = icmp ult i64 %indvars.iv.next50, %1
br i1 %cmp734, label %for.body8.lr.ph, label %for.cond3.loopexit
for.body8.lr.ph: ; preds = %for.body5
%arrayidx10 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv49
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body8.preheader, label %vector.ph
vector.ph: ; preds = %for.body8.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv44, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.040, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%8 = getelementptr i32, ptr %call1, i64 %indvars.iv44
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> [ %7, %vector.ph ], [ %13, %vector.body ]
%vec.phi56 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%9 = getelementptr i32, ptr %8, i64 %index
%wide.load = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load57 = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%12 = mul nsw <4 x i32> %wide.load57, %broadcast.splat
%13 = add <4 x i32> %11, %vec.phi
%14 = add <4 x i32> %12, %vec.phi56
%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 !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond3.loopexit, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body8.lr.ph, %middle.block
%indvars.iv46.ph = phi i64 [ %indvars.iv44, %for.body8.lr.ph ], [ %ind.end, %middle.block ]
%sum.136.ph = phi i32 [ %sum.040, %for.body8.lr.ph ], [ %16, %middle.block ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader, %for.body8
%indvars.iv46 = phi i64 [ %indvars.iv.next47, %for.body8 ], [ %indvars.iv46.ph, %for.body8.preheader ]
%sum.136 = phi i32 [ %add13, %for.body8 ], [ %sum.136.ph, %for.body8.preheader ]
%arrayidx12 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv46
%17 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%mul = mul nsw i32 %17, %6
%add13 = add nsw i32 %mul, %sum.136
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count52
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body8, !llvm.loop !15
for.end19: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %sum.1.lcssa, %for.cond3.loopexit ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
//B-TAKOYAKI FESTIVAL 2019
#include <stdio.h>
int main(void){
int n, i, j;
int d[100]={0};
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &d[i]);
}
int sum= 0;
for(i=0; i<n; i++){
for(j=i+1; j<n; j++){
sum += d[i]*d[j];
}
}
printf("%d\n", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101803/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101803/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%d = 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 %d) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %d, 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
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp335 = icmp sgt i32 %2, 0
br i1 %cmp335, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
%wide.trip.count49 = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %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.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.body7, %middle.block, %for.body4
%sum.1.lcssa = phi i32 [ %sum.037, %for.body4 ], [ %15, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end18, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv46 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next47, %for.cond2.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next42, %for.cond2.loopexit ]
%sum.037 = phi i32 [ 0, %for.body4.preheader ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%4 = xor i64 %indvars.iv46, -1
%5 = add nsw i64 %4, %wide.trip.count49
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp631 = icmp ult i64 %indvars.iv.next47, %1
br i1 %cmp631, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv46
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.037, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv41, %index
%8 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load54 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi53
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%sum.133.ph = phi i32 [ %sum.037, %for.body7.lr.ph ], [ %15, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader ]
%sum.133 = phi i32 [ %add12, %for.body7 ], [ %sum.133.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv43
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add12 = add nsw i32 %mul, %sum.133
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count49
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdio.h>
#include <math.h>
int main()
{
int N,x,y,sum=0;
int D[50];
scanf("%d",&N);
for (x=0;x<N;x++)
{
scanf("%d",&D[x]);
}
for (x=0;x<N-1;x++)
{
for (y=x+1;y<N;y++)
{
sum+=D[x]*D[y];
}
}
printf("%d",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101847/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101847/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%D = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %D) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp335 = icmp sgt i32 %2, 1
br i1 %cmp335, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %2, -1
%1 = zext i32 %2 to i64
%wide.trip.count49 = zext i32 %sub to i64
%wide.trip.count = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %D, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %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.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.body7, %middle.block, %for.body4
%sum.1.lcssa = phi i32 [ %sum.037, %for.body4 ], [ %15, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end18, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv46 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next47, %for.cond2.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next42, %for.cond2.loopexit ]
%sum.037 = phi i32 [ 0, %for.body4.preheader ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%4 = xor i64 %indvars.iv46, -1
%5 = add nsw i64 %4, %wide.trip.count
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp631 = icmp ult i64 %indvars.iv.next47, %1
br i1 %cmp631, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds [50 x i32], ptr %D, i64 0, i64 %indvars.iv46
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.037, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv41, %index
%8 = getelementptr inbounds [50 x i32], ptr %D, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load54 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi53
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%sum.133.ph = phi i32 [ %sum.037, %for.body7.lr.ph ], [ %15, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader ]
%sum.133 = phi i32 [ %add12, %for.body7 ], [ %sum.133.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds [50 x i32], ptr %D, i64 0, i64 %indvars.iv43
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add12 = add nsw i32 %mul, %sum.133
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %D) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdio.h>
int main() {
int N = 0;
int d[50] = {};
int sum = 0;
scanf("%d", &N);
for (int i = 0; i < N; ++i) {
scanf("%d" , d+i);
}
for (int i = 0; i < N-1; ++i) {
for (int j = i + 1; j < N; ++j) {
sum += d[i] * d[j];
}
}
printf("%d", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101890/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101890/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%d = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
store i32 0, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %d) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %d, i8 0, i64 200, 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
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp435 = icmp sgt i32 %2, 1
br i1 %cmp435, 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.count49 = 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 ]
%add.ptr = getelementptr inbounds i32, ptr %d, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.body10, %middle.block, %for.body6
%sum.1.lcssa = phi i32 [ %sum.036, %for.body6 ], [ %15, %middle.block ], [ %add13, %for.body10 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %sum.1.lcssa, %for.cond3.loopexit ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
for.body6: ; preds = %for.body6.preheader, %for.cond3.loopexit
%indvars.iv46 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next47, %for.cond3.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next42, %for.cond3.loopexit ]
%sum.036 = phi i32 [ 0, %for.body6.preheader ], [ %sum.1.lcssa, %for.cond3.loopexit ]
%4 = xor i64 %indvars.iv46, -1
%5 = add nsw i64 %4, %wide.trip.count
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp831 = icmp ult i64 %indvars.iv.next47, %1
br i1 %cmp831, label %for.body10.lr.ph, label %for.cond3.loopexit
for.body10.lr.ph: ; preds = %for.body6
%arrayidx = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv46
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.body10.lr.ph
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.036, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %6, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %7, %vector.ph ], [ %12, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = add i64 %indvars.iv41, %index
%8 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load54 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%11 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%12 = add <4 x i32> %10, %vec.phi
%13 = add <4 x i32> %11, %vec.phi53
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond3.loopexit, label %for.body10.preheader
for.body10.preheader: ; preds = %for.body10.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body10.lr.ph ], [ %ind.end, %middle.block ]
%sum.132.ph = phi i32 [ %sum.036, %for.body10.lr.ph ], [ %15, %middle.block ]
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body10 ], [ %indvars.iv43.ph, %for.body10.preheader ]
%sum.132 = phi i32 [ %add13, %for.body10 ], [ %sum.132.ph, %for.body10.preheader ]
%arrayidx12 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv43
%16 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%mul = mul nsw i32 %16, %6
%add13 = add nsw i32 %mul, %sum.132
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body10, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdio.h>
int main(void){
// Your code here!
int N, d[50];
long sum = 0;
scanf("%d", &N);
for(int i = 0; i < N; i++)
{
scanf("%d", &d[i]);
}
for(int i = 0; i < N; i++)
{
for(int j = 0; j < N; j++)
{
if(i != j)
{
sum += d[i]*d[j];
}
}
}
printf("%ld\n", sum/2);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101933/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101933/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%d = alloca [50 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp438 = icmp sgt i32 %8, 0
br i1 %cmp438, label %for.cond7.preheader.us.preheader, label %for.cond.cleanup5
for.cond7.preheader.us.preheader: ; preds = %for.cond3.preheader
%wide.trip.count50 = zext i32 %8 to i64
%xtraiter = and i64 %wide.trip.count50, 1
%1 = icmp eq i32 %8, 1
%unroll_iter = and i64 %wide.trip.count50, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond7.preheader.us
for.cond7.preheader.us: ; preds = %for.cond7.preheader.us.preheader, %for.cond7.for.cond.cleanup9_crit_edge.us
%indvars.iv47 = phi i64 [ 0, %for.cond7.preheader.us.preheader ], [ %indvars.iv.next48, %for.cond7.for.cond.cleanup9_crit_edge.us ]
%sum.039.us = phi i64 [ 0, %for.cond7.preheader.us.preheader ], [ %sum.2.us.lcssa, %for.cond7.for.cond.cleanup9_crit_edge.us ]
%arrayidx13.us = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv47
br i1 %1, label %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa, label %for.body10.us
for.body10.us: ; preds = %for.cond7.preheader.us, %for.inc16.us.1
%indvars.iv44 = phi i64 [ %indvars.iv.next45.1, %for.inc16.us.1 ], [ 0, %for.cond7.preheader.us ]
%sum.135.us = phi i64 [ %sum.2.us.1, %for.inc16.us.1 ], [ %sum.039.us, %for.cond7.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc16.us.1 ], [ 0, %for.cond7.preheader.us ]
%cmp11.not.us = icmp eq i64 %indvars.iv47, %indvars.iv44
br i1 %cmp11.not.us, label %for.inc16.us, label %if.then.us
if.then.us: ; preds = %for.body10.us
%2 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%arrayidx15.us = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv44
%3 = load i32, ptr %arrayidx15.us, align 8, !tbaa !5
%mul.us = mul nsw i32 %3, %2
%conv.us = sext i32 %mul.us to i64
%add.us = add nsw i64 %sum.135.us, %conv.us
br label %for.inc16.us
for.inc16.us: ; preds = %if.then.us, %for.body10.us
%sum.2.us = phi i64 [ %add.us, %if.then.us ], [ %sum.135.us, %for.body10.us ]
%indvars.iv.next45 = or i64 %indvars.iv44, 1
%cmp11.not.us.1 = icmp eq i64 %indvars.iv47, %indvars.iv.next45
br i1 %cmp11.not.us.1, label %for.inc16.us.1, label %if.then.us.1
if.then.us.1: ; preds = %for.inc16.us
%4 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%arrayidx15.us.1 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv.next45
%5 = load i32, ptr %arrayidx15.us.1, align 4, !tbaa !5
%mul.us.1 = mul nsw i32 %5, %4
%conv.us.1 = sext i32 %mul.us.1 to i64
%add.us.1 = add nsw i64 %sum.2.us, %conv.us.1
br label %for.inc16.us.1
for.inc16.us.1: ; preds = %if.then.us.1, %for.inc16.us
%sum.2.us.1 = phi i64 [ %add.us.1, %if.then.us.1 ], [ %sum.2.us, %for.inc16.us ]
%indvars.iv.next45.1 = add nuw nsw i64 %indvars.iv44, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa, label %for.body10.us, !llvm.loop !9
for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa: ; preds = %for.inc16.us.1, %for.cond7.preheader.us
%sum.2.us.lcssa.ph = phi i64 [ undef, %for.cond7.preheader.us ], [ %sum.2.us.1, %for.inc16.us.1 ]
%indvars.iv44.unr = phi i64 [ 0, %for.cond7.preheader.us ], [ %indvars.iv.next45.1, %for.inc16.us.1 ]
%sum.135.us.unr = phi i64 [ %sum.039.us, %for.cond7.preheader.us ], [ %sum.2.us.1, %for.inc16.us.1 ]
br i1 %lcmp.mod.not, label %for.cond7.for.cond.cleanup9_crit_edge.us, label %for.body10.us.epil
for.body10.us.epil: ; preds = %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa
%cmp11.not.us.epil = icmp eq i64 %indvars.iv47, %indvars.iv44.unr
br i1 %cmp11.not.us.epil, label %for.cond7.for.cond.cleanup9_crit_edge.us, label %if.then.us.epil
if.then.us.epil: ; preds = %for.body10.us.epil
%6 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%arrayidx15.us.epil = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv44.unr
%7 = load i32, ptr %arrayidx15.us.epil, align 4, !tbaa !5
%mul.us.epil = mul nsw i32 %7, %6
%conv.us.epil = sext i32 %mul.us.epil to i64
%add.us.epil = add nsw i64 %sum.135.us.unr, %conv.us.epil
br label %for.cond7.for.cond.cleanup9_crit_edge.us
for.cond7.for.cond.cleanup9_crit_edge.us: ; preds = %for.body10.us.epil, %if.then.us.epil, %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa
%sum.2.us.lcssa = phi i64 [ %sum.2.us.lcssa.ph, %for.cond7.for.cond.cleanup9_crit_edge.us.unr-lcssa ], [ %add.us.epil, %if.then.us.epil ], [ %sum.135.us.unr, %for.body10.us.epil ]
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%exitcond51.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count50
br i1 %exitcond51.not, label %for.cond.cleanup5.loopexit, label %for.cond7.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %N, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !12
for.cond.cleanup5.loopexit: ; preds = %for.cond7.for.cond.cleanup9_crit_edge.us
%10 = sdiv i64 %sum.2.us.lcssa, 2
br label %for.cond.cleanup5
for.cond.cleanup5: ; preds = %entry, %for.cond.cleanup5.loopexit, %for.cond3.preheader
%sum.0.lcssa = phi i64 [ 0, %for.cond3.preheader ], [ %10, %for.cond.cleanup5.loopexit ], [ 0, %entry ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %d) #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, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(int argc, const char * argv[]) {
int i,j,N, heal=0;
scanf("%d",&N);
int yum[N];
for(i=0;i<N;i++){
scanf("%d",&yum[i]);
}
for(i=0;i<N-1;i++){
for(j=i+1;j<N;j++){
heal += yum[i]*yum[j];
}
}
printf("%d\n",heal);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101977/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101977/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %3, 0
br i1 %cmp29, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp335 = icmp sgt i32 %5, 1
br i1 %cmp335, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %5, -1
%4 = zext i32 %5 to i64
%wide.trip.count49 = zext i32 %sub to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.body7, %middle.block, %for.body4
%heal.1.lcssa = phi i32 [ %heal.036, %for.body4 ], [ %19, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end18, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv46 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next47, %for.cond2.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next42, %for.cond2.loopexit ]
%heal.036 = phi i32 [ 0, %for.body4.preheader ], [ %heal.1.lcssa, %for.cond2.loopexit ]
%7 = xor i64 %indvars.iv46, -1
%8 = add nsw i64 %7, %wide.trip.count
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp631 = icmp ult i64 %indvars.iv.next47, %4
br i1 %cmp631, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv46
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %8, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %8, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %heal.036, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %9, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%11 = getelementptr i32, ptr %vla, i64 %indvars.iv41
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> [ %10, %vector.ph ], [ %16, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%12 = getelementptr i32, ptr %11, i64 %index
%wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load54 = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%15 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%16 = add <4 x i32> %14, %vec.phi
%17 = add <4 x i32> %15, %vec.phi53
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %8, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%heal.133.ph = phi i32 [ %heal.036, %for.body7.lr.ph ], [ %19, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader ]
%heal.133 = phi i32 [ %add12, %for.body7 ], [ %heal.133.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv43
%20 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %20, %9
%add12 = add nsw i32 %mul, %heal.133
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%heal.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %heal.1.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %heal.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
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 nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include"stdio.h"
int main(void){
int N,sum=0;
scanf("%d",&N);
int i,j, d[N];
for(i=0; i<N;i++){
scanf("%d",&d[i]);
}
for( i=0;i<N;i++){
for( j=i+1;j<N; j++){
sum+=d[i]*d[j];
}
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102019/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102019/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %3, 0
br i1 %cmp29, label %for.body, label %for.end18
for.cond2.preheader: ; preds = %for.body
%cmp335 = icmp sgt i32 %5, 0
br i1 %cmp335, label %for.body4.preheader, label %for.end18
for.body4.preheader: ; preds = %for.cond2.preheader
%4 = zext i32 %5 to i64
%wide.trip.count49 = zext i32 %5 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2.loopexit: ; preds = %for.body7, %middle.block, %for.body4
%sum.1.lcssa = phi i32 [ %sum.037, %for.body4 ], [ %19, %middle.block ], [ %add12, %for.body7 ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end18, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit
%indvars.iv46 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next47, %for.cond2.loopexit ]
%indvars.iv41 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next42, %for.cond2.loopexit ]
%sum.037 = phi i32 [ 0, %for.body4.preheader ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%7 = xor i64 %indvars.iv46, -1
%8 = add nsw i64 %7, %wide.trip.count49
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp631 = icmp ult i64 %indvars.iv.next47, %4
br i1 %cmp631, label %for.body7.lr.ph, label %for.cond2.loopexit
for.body7.lr.ph: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv46
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %8, 8
br i1 %min.iters.check, label %for.body7.preheader, label %vector.ph
vector.ph: ; preds = %for.body7.lr.ph
%n.vec = and i64 %8, -8
%ind.end = add i64 %indvars.iv41, %n.vec
%10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.037, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %9, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%11 = getelementptr i32, ptr %vla, i64 %indvars.iv41
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> [ %10, %vector.ph ], [ %16, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%12 = getelementptr i32, ptr %11, i64 %index
%wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load54 = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = mul nsw <4 x i32> %wide.load, %broadcast.splat
%15 = mul nsw <4 x i32> %wide.load54, %broadcast.splat
%16 = add <4 x i32> %14, %vec.phi
%17 = add <4 x i32> %15, %vec.phi53
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %8, %n.vec
br i1 %cmp.n, label %for.cond2.loopexit, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph, %middle.block
%indvars.iv43.ph = phi i64 [ %indvars.iv41, %for.body7.lr.ph ], [ %ind.end, %middle.block ]
%sum.133.ph = phi i32 [ %sum.037, %for.body7.lr.ph ], [ %19, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader ]
%sum.133 = phi i32 [ %add12, %for.body7 ], [ %sum.133.ph, %for.body7.preheader ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv43
%20 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%mul = mul nsw i32 %20, %9
%add12 = add nsw i32 %mul, %sum.133
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count49
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15
for.end18: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %sum.1.lcssa, %for.cond2.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
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 nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>
#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define SWAP(type, a, b) { const type tmp = a; a = b; b = tmp; }
int compare_sz_asc(const void* a, const void* b) {
return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}
int compare_sz_desc(const void* a, const void* b) {
return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}
int compare_i64_asc(const void* a, const void* b) {
return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}
int compare_i64_desc(const void* a, const void* b) {
return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}
int compare_u64_asc(const void* a, const void* b) {
return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1;
}
int compare_u64_desc(const void* a, const void* b) {
return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}
int compare_c_asc(const void* a, const void* b) {
return *((char*)a) < *((char*)b) ? -1 : 1;
}
int compare_c_desc(const void* a, const void* b) {
return *((char*)a) > * ((char*)b) ? -1 : 1;
}
int compare_dp_asc(const void* a, const void* b) {
return *((double*)a) < *((double*)b) ? -1 : 1;
}
static uint64_t modinvU64(const uint64_t a, const uint64_t m) {
int64_t aa = (int64_t)a;
const int64_t mm = (int64_t)m;
int64_t b = mm;
int64_t u = 1;
int64_t v = 0;
while (b != 0) {
const int64_t t = aa / b;
aa -= t * b;
SWAP(uint64_t, aa, b);
u -= t * v;
SWAP(uint64_t, u, v);
}
u %= mm;
if (u < 0) {
u += m;
}
return (uint64_t)u;
}
static size_t powSz(const size_t base, const size_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powSz(base * base, exp / 2);
}
else {
return base * powSz(base, exp - 1);
}
}
static uint64_t powU64(const uint64_t base, const uint64_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powU64(base * base, exp / 2);
}
else {
return base * powU64(base, exp - 1);
}
}
static uint64_t powU64WMod(const uint64_t base, const uint64_t exp, const uint64_t m) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base % m;
}
if (exp % 2 == 0) {
return powU64WMod(base * base % m, exp / 2, m);
}
else {
return base * powU64WMod(base, exp - 1, m) % m;
}
}
static size_t comb(const size_t n, const size_t r) {
size_t result = 1;
for (size_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64(const uint64_t n, const uint64_t r) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64WMod(const uint64_t n, const uint64_t r, const uint64_t m) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result = result * (n - i) % m;
result = result * modinvU64(i + 1, m) % m;
}
return result;
}
static uint64_t permU64WMod(const uint64_t n, const uint64_t m) {
uint64_t result = 1;
for (uint64_t v = 2; v <= n; v++) {
result *= v;
result %= m;
}
return result;
}
static size_t gcdZu(size_t m, size_t n) {
size_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static uint64_t gcdU64(uint64_t m, uint64_t n)
{
uint64_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
typedef struct {
uint64_t val;
}BHeap_Val;
#define BHEAP_VAL_TYPE BHeap_Val
#define BHEAP_INVALID_NODE ((size_t)100000000)
typedef struct {
BHEAP_VAL_TYPE val;
} BHeap_Node;
struct _BHeap_Ctx {
size_t size;
int (*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node);
void(*notifyNodeChange)(const struct _BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList);
BHeap_Node* node;
};
typedef struct _BHeap_Ctx BHeap_Ctx;
static void bHeap_Init(BHeap_Ctx* const ctx, int(*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node), void(*notifyNodeChange)(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList), BHeap_Node* const nodes) {
ctx->size = 0;
ctx->compare = compare;
ctx->notifyNodeChange = notifyNodeChange;
ctx->node = nodes;
}
static void bHeap_Swap(BHeap_Ctx* const ctx, const size_t node0, const size_t node1) {
const BHEAP_VAL_TYPE tmp = ctx->node[node0].val;
ctx->node[node0].val = ctx->node[node1].val;
ctx->node[node1].val = tmp;
if (ctx->notifyNodeChange != NULL) {
const size_t nodeList[2] = { node0,node1 };
ctx->notifyNodeChange(ctx, 2, nodeList);
}
}
static void bHeap_UpHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) {
if (nodeIdx == 0) {
return;
}
const size_t parentIdx = (nodeIdx + 1) / 2 - 1;
const int compareResult = ctx->compare(&(ctx->node[parentIdx].val), &(ctx->node[nodeIdx].val));
if (0 < compareResult) {
bHeap_Swap(ctx, nodeIdx, parentIdx);
if (parentIdx != 0) {
bHeap_UpHeap(ctx, parentIdx);
}
}
}
static void bHeap_DownHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) {
if (ctx->size - 1 <= nodeIdx) {
return;
}
const size_t leftIdx = 2 * (nodeIdx + 1) - 1;
if (leftIdx < ctx->size) {
const int leftResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[leftIdx].val));
size_t swapTarget = leftResult < 0 ? BHEAP_INVALID_NODE : leftIdx;
const size_t rightIdx = leftIdx + 1;
if (rightIdx < ctx->size) {
const int rightResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[rightIdx].val));
if (swapTarget == BHEAP_INVALID_NODE) {
if (0 < rightResult) {
swapTarget = rightIdx;
}
}
else {
if (0 < rightResult) {
const int rightLeftResult = ctx->compare(&(ctx->node[leftIdx].val), &(ctx->node[rightIdx].val));
if (0 < rightLeftResult) {
swapTarget = rightIdx;
}
}
}
}
if (swapTarget != BHEAP_INVALID_NODE) {
bHeap_Swap(ctx, nodeIdx, swapTarget);
bHeap_DownHeap(ctx, swapTarget);
}
}
}
static void bHeap_Add(BHeap_Ctx* const ctx, const BHEAP_VAL_TYPE val) {
ctx->node[ctx->size].val = val;
ctx->size++;
if (ctx->notifyNodeChange != NULL) {
const size_t node = ctx->size - 1;
ctx->notifyNodeChange(ctx, 1, &node);
}
bHeap_UpHeap(ctx, ctx->size - 1);
}
static void bHeap_RemoveTop(BHeap_Ctx* const ctx) {
if (ctx->size == 0) {
return;
}
if (ctx->size == 1) {
ctx->size--;
return;
}
ctx->node[0].val = ctx->node[ctx->size - 1].val;
if (ctx->notifyNodeChange != NULL) {
const size_t node = 0;
ctx->notifyNodeChange(ctx, 1, &node);
}
ctx->size--;
bHeap_DownHeap(ctx, 0);
}
static void bHeap_RemoveNode(BHeap_Ctx* const ctx, const size_t node) {
if (node == ctx->size - 1) {
ctx->size--;
}
else {
ctx->node[node].val = ctx->node[ctx->size - 1].val;
ctx->size--;
if (ctx->notifyNodeChange != NULL) {
ctx->notifyNodeChange(ctx, 1, &node);
}
bHeap_DownHeap(ctx, node);
bHeap_UpHeap(ctx, node);
}
}
static BHEAP_VAL_TYPE* bHeap_GetTopVal(const BHeap_Ctx* const ctx) {
return ctx->size == 0 ? NULL : &(ctx->node[0].val);
}
typedef struct {
uint64_t cnt;
size_t* child;
size_t numChild;
size_t maxNumChild;
} Tree_Node;
#define TREE_INIT_ALLOC (128)
static Tree_Node tree_Node[200000];
static void tree_Init(const uint64_t N) {
for (uint64_t i = 0; i < N; i++) {
tree_Node[i].cnt = 0;
tree_Node[i].numChild = 0;
tree_Node[i].child = malloc(sizeof(size_t) * TREE_INIT_ALLOC);
tree_Node[i].maxNumChild = TREE_INIT_ALLOC;
}
}
static void tree_AddChild(const size_t parent, const size_t child) {
if (tree_Node[parent].maxNumChild <= tree_Node[parent].numChild) {
tree_Node[parent].child = realloc(tree_Node[parent].child, sizeof(size_t) * tree_Node[parent].maxNumChild * 2);
tree_Node[parent].maxNumChild *= 2;
}
tree_Node[parent].child[tree_Node[parent].numChild] = child;
tree_Node[parent].numChild++;
}
static BHeap_Node BN_Asc[200000];
static BHeap_Node BN_Desc[200000];
static int _bHeap_Compare_Asc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
return parent->val <= node->val ? -1 : 1;
}
static int _bHeap_Compare_Desc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
return parent->val >= node->val ? -1 : 1;
}
static size_t PBHeap_Asc_Idx[200000];
static size_t PBHeap_Desc_Idx[200000];
static void _bHeap_NotifyNodeChange_Asc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) {
for (size_t i = 0; i < nodeListSize; i++) {
PBHeap_Asc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i];
}
}
static void _bHeap_NotifyNodeChange_Desc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) {
for (size_t i = 0; i < nodeListSize; i++) {
PBHeap_Desc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i];
}
}
#define MOD_VAL (UINT64_C(1000000007))
#define UF_ROOT ((size_t)10000000)
typedef struct {
size_t parent;
uint64_t w;
uint64_t v;
uint64_t wSum;
uint64_t vSum;
} UF_Node;
static UF_Node uf_Node[101];
static size_t uf_GetRoot(const size_t idx) {
if (uf_Node[idx].parent == UF_ROOT) {
return idx;
}
const size_t root = uf_GetRoot(uf_Node[idx].parent);
uf_Node[idx].parent = root;
return root;
}
static void uf_Merge(const size_t a, const size_t b) {
const size_t aRoot = uf_GetRoot(a);
const size_t bRoot = uf_GetRoot(b);
if (aRoot != bRoot) {
uf_Node[aRoot].parent = bRoot;
uf_Node[bRoot].wSum += uf_Node[aRoot].wSum;
uf_Node[bRoot].vSum += uf_Node[aRoot].vSum;
}
}
int main(void) {
uint64_t N;
uint64_t d[50];
scanf("%"PRIu64, &N);
for (uint64_t i = 0; i < N; i++) {
scanf("%"PRIu64, &d[i]);
}
uint64_t sum = 0;
for (uint64_t i = 0; i < N - 1; i++) {
for (uint64_t j = i + 1; j < N; j++) {
sum += d[i] * d[j];
}
}
printf("%"PRIu64"\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102062/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102062/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lu\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lu\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_sz_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_sz_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ugt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_i64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_i64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_u64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_u64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ugt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_c_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
%cmp = icmp slt i8 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_c_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
%cmp = icmp sgt i8 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_dp_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !10
%1 = load double, ptr %b, align 8, !tbaa !10
%cmp = fcmp olt double %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i64, align 8
%d = alloca [50 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp29.not = icmp eq i64 %0, 0
br i1 %cmp29.not, label %for.body6.preheader, label %for.body
for.cond3.preheader: ; preds = %for.body
%sub = add i64 %1, -1
%cmp435.not = icmp eq i64 %sub, 0
br i1 %cmp435.not, label %for.cond.cleanup5, label %for.body6.preheader
for.body6.preheader: ; preds = %entry, %for.cond3.preheader
%sub44 = phi i64 [ %sub, %for.cond3.preheader ], [ -1, %entry ]
%.lcssa43 = phi i64 [ %1, %for.cond3.preheader ], [ 0, %entry ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%i.030 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i64], ptr %d, i64 0, i64 %i.030
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw i64 %i.030, 1
%1 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp ult i64 %inc, %1
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !12
for.cond3.loopexit: ; preds = %for.body10, %middle.block, %for.body6
%sum.1.lcssa = phi i64 [ %sum.036, %for.body6 ], [ %13, %middle.block ], [ %add13, %for.body10 ]
%exitcond.not = icmp eq i64 %add, %sub44
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !14
for.cond.cleanup5: ; preds = %for.cond3.loopexit, %for.cond3.preheader
%sum.0.lcssa = phi i64 [ 0, %for.cond3.preheader ], [ %sum.1.lcssa, %for.cond3.loopexit ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5
ret i32 0
for.body6: ; preds = %for.body6.preheader, %for.cond3.loopexit
%i2.037 = phi i64 [ %add, %for.cond3.loopexit ], [ 0, %for.body6.preheader ]
%sum.036 = phi i64 [ %sum.1.lcssa, %for.cond3.loopexit ], [ 0, %for.body6.preheader ]
%2 = xor i64 %i2.037, -1
%3 = add i64 %.lcssa43, %2
%add = add nuw i64 %i2.037, 1
%cmp831 = icmp ult i64 %add, %.lcssa43
br i1 %cmp831, label %for.body10.lr.ph, label %for.cond3.loopexit
for.body10.lr.ph: ; preds = %for.body6
%arrayidx11 = getelementptr inbounds [50 x i64], ptr %d, i64 0, i64 %i2.037
%4 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%min.iters.check = icmp ult i64 %3, 4
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.body10.lr.ph
%n.vec = and i64 %3, -4
%ind.end = add i64 %add, %n.vec
%5 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %sum.036, i64 0
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %4, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %5, %vector.ph ], [ %10, %vector.body ]
%vec.phi45 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%offset.idx = add i64 %add, %index
%6 = getelementptr inbounds [50 x i64], ptr %d, i64 0, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %6, align 8, !tbaa !5
%7 = getelementptr inbounds i64, ptr %6, i64 2
%wide.load46 = load <2 x i64>, ptr %7, align 8, !tbaa !5
%8 = mul <2 x i64> %wide.load, %broadcast.splat
%9 = mul <2 x i64> %wide.load46, %broadcast.splat
%10 = add <2 x i64> %8, %vec.phi
%11 = add <2 x i64> %9, %vec.phi45
%index.next = add nuw i64 %index, 4
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %11, %10
%13 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.cond3.loopexit, label %for.body10.preheader
for.body10.preheader: ; preds = %for.body10.lr.ph, %middle.block
%j.033.ph = phi i64 [ %add, %for.body10.lr.ph ], [ %ind.end, %middle.block ]
%sum.132.ph = phi i64 [ %sum.036, %for.body10.lr.ph ], [ %13, %middle.block ]
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%j.033 = phi i64 [ %inc15, %for.body10 ], [ %j.033.ph, %for.body10.preheader ]
%sum.132 = phi i64 [ %add13, %for.body10 ], [ %sum.132.ph, %for.body10.preheader ]
%arrayidx12 = getelementptr inbounds [50 x i64], ptr %d, i64 0, i64 %j.033
%14 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%mul = mul i64 %14, %4
%add13 = add i64 %mul, %sum.132
%inc15 = add nuw i64 %j.033, 1
%cmp8 = icmp ult i64 %inc15, %.lcssa43
br i1 %cmp8, label %for.body10, label %for.cond3.loopexit, !llvm.loop !18
}
; 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 i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = !{!"long", !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 = !{!"double", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !13, !17, !16}
|
#include <stdio.h>
#define MAX 10000
#define NIL -1
struct Node {int p, l ,r; };
struct Node T[MAX];
int n;
/* 先行順巡回*/
void preParse(int u) {
if ( u == NIL ) return;
printf(" %d", u);
preParse(T[u].l);
preParse(T[u].r);
}
/* 中間順巡回*/
void inParse(int u) {
if ( u == NIL ) return;
inParse(T[u].l);
printf(" %d", u);
inParse(T[u].r);
}
/* 後行順巡回*/
void postParse(int u) {
if ( u == NIL ) return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d", u);
}
int main(){
int i, v, l, r, root;
scanf("%d", &n);
for ( i = 0; i < n; i++ ) {
T[i].p = NIL;
}
for ( i = 0; i < n; i++ ) {
scanf("%d %d %d", &v, &l, &r);
T[v].l = l;
T[v].r = r;
if ( l != NIL ) T[l].p = v;
if ( r != NIL ) T[r].p = v;
}
for ( i = 0; i < n; i++ ) if ( T[i].p == NIL ) root = i;
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102105/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102105/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !11
%4 = load i32, ptr %v, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !11
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !10
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%root.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"Node", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include <stdio.h>
#define MAX 10000
typedef struct {
int p;
int left;
int right;
} Node;
Node tree[MAX];
int n;
void preparse(int); /* 先行順巡回 */
void inparse(int); /* 中間順巡回 */
void postparse(int); /* 後行順巡回 */
int main()
{
int i, v, left, right, root;
scanf("%d", &n);
for(i=0; i<n; i++) {
tree[i].p = -1;
}
for(i=0; i<n; i++) {
scanf("%d %d %d", &v, &left, &right);
tree[v].left = left;
tree[v].right = right;
if(left != -1)
tree[left].p = v;
if(right != -1)
tree[right].p = v;
}
for(i=0; i<n; i++) {
if(tree[i].p == -1)
root = i;
}
printf("Preorder\n");
preparse(root);
printf("\nInorder\n");
inparse(root);
printf("\nPostorder\n");
postparse(root);
printf("\n");
return 0;
}
void preparse(int u)
{
if(u == -1)
return ;
printf(" %d", u);
preparse(tree[u].left);
preparse(tree[u].right);
}
void inparse(int u)
{
if(u == -1)
return ;
inparse(tree[u].left);
printf(" %d", u);
inparse(tree[u].right);
}
void postparse(int u)
{
if(u == -1)
return ;
postparse(tree[u].left);
postparse(tree[u].right);
printf(" %d", u);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102149/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102149/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@tree = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp53, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond24.preheader: ; preds = %for.inc21
%cmp2557 = icmp sgt i32 %6, 0
br i1 %cmp2557, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count66 = zext i32 %6 to i64
%xtraiter70 = and i64 %wide.trip.count66, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter74 = and i64 %wide.trip.count66, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.156 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %left, ptr noundef nonnull %right)
%3 = load i32, ptr %left, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %4 to i64
%left7 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %left7, align 4, !tbaa !15
%5 = load i32, ptr %right, align 4, !tbaa !5
%right10 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %right10, align 4, !tbaa !16
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !9
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.156, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv63 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next64.3, %for.body26 ]
%root.059 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter75 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter75.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv63
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !9
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv63 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.059
%indvars.iv.next64 = or i64 %indvars.iv63, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next64
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !9
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next64 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next64.1 = or i64 %indvars.iv63, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next64.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !9
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next64.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next64.2 = or i64 %indvars.iv63, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next64.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !9
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next64.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next64.3 = add nuw nsw i64 %indvars.iv63, 4
%niter75.next.3 = add i64 %niter75, 4
%niter75.ncmp.3 = icmp eq i64 %niter75.next.3, %unroll_iter74
br i1 %niter75.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv63.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next64.3, %for.body26 ]
%root.059.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod72.not = icmp eq i64 %xtraiter70, 0
br i1 %lcmp.mod72.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv63.epil = phi i64 [ %indvars.iv.next64.epil, %for.body26.epil ], [ %indvars.iv63.unr, %for.end35.loopexit.unr-lcssa ]
%root.059.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.059.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter71 = phi i64 [ %epil.iter71.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv63.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !9
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv63.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.059.epil
%indvars.iv.next64.epil = add nuw nsw i64 %indvars.iv63.epil, 1
%epil.iter71.next = add i64 %epil.iter71, 1
%epil.iter71.cmp.not = icmp eq i64 %epil.iter71.next, %xtraiter70
br i1 %epil.iter71.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.059.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preparse(i32 noundef %root.0.lcssa)
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inparse(i32 noundef %root.0.lcssa)
%puts52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postparse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #4
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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preparse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @preparse(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inparse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @inparse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postparse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @postparse(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
tail call void @postparse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include<stdio.h>
int main()
{
int t,n,a,i;
scanf("%d",&t);
while(t--)
{
int num1[2000],num2[2000],f1=0,f2=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a%2==0)
{
num2[f2]=a;
f2++;
}
else
{
num1[f1]=a;
f1++;
}
}
for(i=0;i<f1;i++)
printf("%d ",num1[i]);
for(i=0;i<f2;i++)
printf("%d ",num2[i]);
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1022/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1022/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca i32, align 4
%num1 = alloca [2000 x i32], align 16
%num2 = alloca [2000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec47 = add nsw i32 %0, -1
store i32 %dec47, ptr %t, align 4, !tbaa !5
%tobool.not48 = icmp eq i32 %0, 0
br i1 %tobool.not48, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end25
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %num1) #4
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %num2) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %1, 0
br i1 %cmp38, label %for.body, label %for.end25
for.cond8.preheader: ; preds = %for.inc
%cmp943 = icmp sgt i32 %f1.1, 0
br i1 %cmp943, label %for.body10.preheader, label %for.cond17.preheader
for.body10.preheader: ; preds = %for.cond8.preheader
%wide.trip.count = zext i32 %f1.1 to i64
br label %for.body10
for.body: ; preds = %while.body, %for.inc
%f2.041 = phi i32 [ %f2.1, %for.inc ], [ 0, %while.body ]
%f1.040 = phi i32 [ %f1.1, %for.inc ], [ 0, %while.body ]
%i.039 = phi i32 [ %inc7, %for.inc ], [ 0, %while.body ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = and i32 %2, 1
%cmp3 = icmp eq i32 %3, 0
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
%idxprom = sext i32 %f2.041 to i64
%arrayidx = getelementptr inbounds [2000 x i32], ptr %num2, i64 0, i64 %idxprom
store i32 %2, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %f2.041, 1
br label %for.inc
if.else: ; preds = %for.body
%idxprom4 = sext i32 %f1.040 to i64
%arrayidx5 = getelementptr inbounds [2000 x i32], ptr %num1, i64 0, i64 %idxprom4
store i32 %2, ptr %arrayidx5, align 4, !tbaa !5
%inc6 = add nsw i32 %f1.040, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%f1.1 = phi i32 [ %f1.040, %if.then ], [ %inc6, %if.else ]
%f2.1 = phi i32 [ %inc, %if.then ], [ %f2.041, %if.else ]
%inc7 = add nuw nsw i32 %i.039, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc7, %4
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond17.preheader: ; preds = %for.body10, %for.cond8.preheader
%cmp1845 = icmp sgt i32 %f2.1, 0
br i1 %cmp1845, label %for.body19.preheader, label %for.end25
for.body19.preheader: ; preds = %for.cond17.preheader
%wide.trip.count53 = zext i32 %f2.1 to i64
br label %for.body19
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next, %for.body10 ]
%arrayidx12 = getelementptr inbounds [2000 x i32], ptr %num1, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond17.preheader, label %for.body10, !llvm.loop !11
for.body19: ; preds = %for.body19.preheader, %for.body19
%indvars.iv50 = phi i64 [ 0, %for.body19.preheader ], [ %indvars.iv.next51, %for.body19 ]
%arrayidx21 = getelementptr inbounds [2000 x i32], ptr %num2, i64 0, i64 %indvars.iv50
%6 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond54.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count53
br i1 %exitcond54.not, label %for.end25, label %for.body19, !llvm.loop !12
for.end25: ; preds = %for.body19, %while.body, %for.cond17.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %num2) #4
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %num1) #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 !13
while.end: ; preds = %for.end25, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
void preParse(int);
void inParse(int);
void postParse(int);
struct Node{
int p, l, r;
};
struct Node T[MAX];
int n;
int main(){
int i, v, l, r, root;
scanf("%d",&n);
for(i=0; i<n; i++){
T[i].p = NIL;
}
for(i=0; i<n; i++){
scanf("%d%d%d",&v,&l,&r);
T[v].l = l;
T[v].r = r;
if(l != NIL) T[l].p = v;
if(r != NIL) T[r].p = v;
}
for(i=0; i<n; i++){
if(T[i].p == NIL) root = i;
}
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}
void preParse(int u){
if(u == NIL) return;
printf(" %d",u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u == NIL) return;
inParse(T[u].l);
printf(" %d",u);
inParse(T[u].r);
}
void postParse(int u){
if(u == NIL) return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d",u);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102264/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102264/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !15
%5 = load i32, ptr %r, align 4, !tbaa !5
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !16
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !9
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !9
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !9
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !9
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !9
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%root.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !9
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include <stdio.h>
#define N -1
typedef struct
{
int id;
int p;
int l;
int r;
}Tree;
Tree T[25];
void pre( int );
void in( int );
void post( int );
int main()
{
int i, j, n;
int id;
int data;
scanf("%d", &n);
for(i = 0; i < n; i++)
T[i].p = N;
for(i=0;i<n;i++)
{
scanf("%d", &id);
T[id].id = id;
scanf("%d", &data);
T[id].l = data;
if(data != N) T[data].p = id;
scanf("%d", &data);
T[id].r = data;
if(data != N)
T[data].p = id;
}
i = 0;
while(T[i].p != N)
i++;
id = i;
printf("Preorder\n");
pre(id);
printf("\nInorder\n");
in(id);
printf("\nPostorder\n");
post(id);
printf("\n");
return 0;
}
void pre(int i)
{
printf(" %d", i);
if(T[i].l != N) pre(T[i].l);
if(T[i].r != N) pre(T[i].r);
}
void in(int i)
{
if(T[i].l != N) in(T[i].l);
printf(" %d",i);
if(T[i].r != N) in(T[i].r);
}
void post(int i)
{
if(T[i].l != N) post(T[i].l);
if(T[i].r != N) post(T[i].r);
printf(" %d",i);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102307/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102307/source.c"
target datalayout = "e-m:e-p270: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.Tree = type { i32, i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@T = dso_local local_unnamed_addr global [25 x %struct.Tree] zeroinitializer, align 16
@.str.5 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.6 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = alloca i32, align 4
%data = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %data) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp46 = icmp sgt i32 %0, 0
br i1 %cmp46, label %for.body.preheader, label %while.cond.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%p.epil = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv.epil, i32 1
store i32 -1, ptr %p.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp46, label %for.body3, label %while.cond.preheader
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%p = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv, i32 1
store i32 -1, ptr %p, align 4, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%p.1 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv.next, i32 1
store i32 -1, ptr %p.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%p.2 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv.next.1, i32 1
store i32 -1, ptr %p.2, align 4, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%p.3 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv.next.2, i32 1
store i32 -1, ptr %p.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.body3: ; preds = %for.cond1.preheader, %for.inc24
%i.149 = phi i32 [ %inc25, %for.inc24 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%2 = load i32, ptr %id, align 4, !tbaa !5
%idxprom5 = sext i32 %2 to i64
%arrayidx6 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom5
store i32 %2, ptr %arrayidx6, align 16, !tbaa !15
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%3 = load i32, ptr %data, align 4, !tbaa !5
%4 = load i32, ptr %id, align 4, !tbaa !5
%idxprom9 = sext i32 %4 to i64
%l = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom9, i32 2
store i32 %3, ptr %l, align 8, !tbaa !16
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%p14 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom12, i32 1
store i32 %4, ptr %p14, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%5 = load i32, ptr %data, align 4, !tbaa !5
%6 = load i32, ptr %id, align 4, !tbaa !5
%idxprom16 = sext i32 %6 to i64
%r = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom16, i32 3
store i32 %5, ptr %r, align 4, !tbaa !17
%cmp18.not = icmp eq i32 %5, -1
br i1 %cmp18.not, label %for.inc24, label %if.then19
if.then19: ; preds = %if.end
%idxprom20 = sext i32 %5 to i64
%p22 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom20, i32 1
store i32 %6, ptr %p22, align 4, !tbaa !9
br label %for.inc24
for.inc24: ; preds = %if.end, %if.then19
%inc25 = add nuw nsw i32 %i.149, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc25, %7
br i1 %cmp2, label %for.body3, label %while.cond.preheader, !llvm.loop !18
while.cond.preheader: ; preds = %for.inc24, %entry, %for.cond1.preheader
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %while.cond
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %while.cond ], [ 0, %while.cond.preheader ]
%p29 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv51, i32 1
%8 = load i32, ptr %p29, align 4, !tbaa !9
%cmp30.not = icmp eq i32 %8, -1
%indvars.iv.next52 = add nuw i64 %indvars.iv51, 1
br i1 %cmp30.not, label %while.end, label %while.cond, !llvm.loop !19
while.end: ; preds = %while.cond
%9 = trunc i64 %indvars.iv51 to i32
store i32 %9, ptr %id, align 4, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%10 = load i32, ptr %id, align 4, !tbaa !5
call void @pre(i32 noundef %10)
%puts44 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%11 = load i32, ptr %id, align 4, !tbaa !5
call void @in(i32 noundef %11)
%puts45 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%12 = load i32, ptr %id, align 4, !tbaa !5
call void @post(i32 noundef %12)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %data) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @pre(i32 noundef %i) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%i.tr = phi i32 [ %i, %entry ], [ %1, %if.end ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %i.tr)
%idxprom = sext i32 %i.tr to i64
%l = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %l, align 8, !tbaa !16
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @pre(i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%r = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 3
%1 = load i32, ptr %r, align 4, !tbaa !17
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end11, label %tailrecurse
if.end11: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @in(i32 noundef %i) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%i.tr = phi i32 [ %i, %entry ], [ %1, %if.end ]
%idxprom = sext i32 %i.tr to i64
%l = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %l, align 8, !tbaa !16
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @in(i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %i.tr)
%r = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 3
%1 = load i32, ptr %r, align 4, !tbaa !17
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end11, label %tailrecurse
if.end11: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @post(i32 noundef %i) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%l = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %l, align 8, !tbaa !16
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
tail call void @post(i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %entry
%r = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 3
%1 = load i32, ptr %r, align 4, !tbaa !17
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end11, label %if.then7
if.then7: ; preds = %if.end
tail call void @post(i32 noundef %1)
br label %if.end11
if.end11: ; preds = %if.then7, %if.end
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %i)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !6, i64 8}
!17 = !{!10, !6, i64 12}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct list tree;
struct list{
int n, ln, rn;
tree *l, *r;
};
void add_t(tree *t, int n, int l, int r){
t[n].n = n;
t[n].ln = l;
t[n].rn = r;
t[n].l = NULL;
t[n].r = NULL;
}
void str_t(int i, tree *t){
if(t[i].ln != -1){
t[i].l = &t[t[i].ln];
str_t(t[i].ln, t);
}
if(t[i].rn != -1){
t[i].r = &t[t[i].rn];
str_t(t[i].rn, t);
}
}
void output(tree *t, int mode){
if(mode == -1) printf(" %d", t->n);
if(t->ln != -1) output(t->l, mode);
if(mode == 0) printf(" %d", t->n);
if(t->rn != -1) output(t->r, mode);
if(mode == 1) printf(" %d", t->n);
}
int main(){
int i, num, n, l, r, *f;
tree *t;
scanf("%d", &num);
t = malloc(num * sizeof(tree));
f = malloc(num * sizeof(int));
for(i = 0; i < num; i++) f[i] = 1;
for(i = 0; i < num; i++){
scanf("%d %d %d", &n, &l, &r);
add_t(t, n, l, r);
f[l] = 0;
f[r] = 0;
}
for(i = 0; i < num; i++){
if(f[i]){
str_t(i, t);
break;
}
}
printf("Preorder\n");
output(&t[i], -1);
printf("\nInorder\n");
output(&t[i], 0);
printf("\nPostorder\n");
output(&t[i], 1);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102358/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102358/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.list = type { i32, i32, i32, ptr, ptr }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @add_t(ptr nocapture noundef writeonly %t, i32 noundef %n, i32 noundef %l, i32 noundef %r) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom
store i32 %n, ptr %arrayidx, align 8, !tbaa !5
%ln = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom, i32 1
store i32 %l, ptr %ln, align 4, !tbaa !11
%rn = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom, i32 2
store i32 %r, ptr %rn, align 8, !tbaa !12
%l8 = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom, i32 3
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %l8, i8 0, i64 16, i1 false)
ret void
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @str_t(i32 noundef %i, ptr noundef %t) local_unnamed_addr #1 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.then14, %entry
%i.tr = phi i32 [ %i, %entry ], [ %1, %if.then14 ]
%idxprom = sext i32 %i.tr to i64
%ln = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom, i32 1
%0 = load i32, ptr %ln, align 4, !tbaa !11
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
%idxprom4 = sext i32 %0 to i64
%arrayidx5 = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom4
%l = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom, i32 3
store ptr %arrayidx5, ptr %l, align 8, !tbaa !13
tail call void @str_t(i32 noundef %0, ptr noundef nonnull %t)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%rn = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom, i32 2
%1 = load i32, ptr %rn, align 8, !tbaa !12
%cmp13.not = icmp eq i32 %1, -1
br i1 %cmp13.not, label %if.end25, label %if.then14
if.then14: ; preds = %if.end
%idxprom18 = sext i32 %1 to i64
%arrayidx19 = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom18
%r = getelementptr inbounds %struct.list, ptr %t, i64 %idxprom, i32 4
store ptr %arrayidx19, ptr %r, align 8, !tbaa !14
br label %tailrecurse
if.end25: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @output(ptr nocapture noundef readonly %t, i32 noundef %mode) local_unnamed_addr #2 {
entry:
%cmp = icmp eq i32 %mode, -1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%0 = load i32, ptr %t, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %entry
%ln = getelementptr inbounds %struct.list, ptr %t, i64 0, i32 1
%1 = load i32, ptr %ln, align 4, !tbaa !11
%cmp1.not = icmp eq i32 %1, -1
br i1 %cmp1.not, label %if.end3, label %if.then2
if.then2: ; preds = %if.end
%l = getelementptr inbounds %struct.list, ptr %t, i64 0, i32 3
%2 = load ptr, ptr %l, align 8, !tbaa !13
tail call void @output(ptr noundef %2, i32 noundef %mode)
br label %if.end3
if.end3: ; preds = %if.then2, %if.end
%cmp4 = icmp eq i32 %mode, 0
br i1 %cmp4, label %if.then5, label %if.end8
if.then5: ; preds = %if.end3
%3 = load i32, ptr %t, align 8, !tbaa !5
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
br label %if.end8
if.end8: ; preds = %if.then5, %if.end3
%rn = getelementptr inbounds %struct.list, ptr %t, i64 0, i32 2
%4 = load i32, ptr %rn, align 8, !tbaa !12
%cmp9.not = icmp eq i32 %4, -1
br i1 %cmp9.not, label %if.end11, label %if.then10
if.then10: ; preds = %if.end8
%r = getelementptr inbounds %struct.list, ptr %t, i64 0, i32 4
%5 = load ptr, ptr %r, align 8, !tbaa !14
tail call void @output(ptr noundef %5, i32 noundef %mode)
br label %if.end11
if.end11: ; preds = %if.then10, %if.end8
%cmp12 = icmp eq i32 %mode, 1
br i1 %cmp12, label %if.then13, label %if.end16
if.then13: ; preds = %if.end11
%6 = load i32, ptr %t, align 8, !tbaa !5
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
br label %if.end16
if.end16: ; preds = %if.then13, %if.end11
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%num = alloca i32, align 4
%n = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !15
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 5
%call1 = call noalias ptr @malloc(i64 noundef %mul) #9
%mul3 = shl nsw i64 %conv, 2
%call4 = call noalias ptr @malloc(i64 noundef %mul3) #9
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.body.preheader, label %for.end26
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader79, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%1 = getelementptr inbounds i32, ptr %call4, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 4, !tbaa !15
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 4, !tbaa !15
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond6.preheader, label %for.body.preheader79
for.body.preheader79: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond6.preheader: ; preds = %for.body, %middle.block
br i1 %cmp59, label %for.body9, label %for.end26
for.body: ; preds = %for.body.preheader79, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader79 ]
%arrayidx = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv
store i32 1, ptr %arrayidx, align 4, !tbaa !15
%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.cond6.preheader, label %for.body, !llvm.loop !20
for.cond18.preheader: ; preds = %for.body9
%cmp1963 = icmp sgt i32 %7, 0
br i1 %cmp1963, label %for.body21.preheader, label %for.end26
for.body21.preheader: ; preds = %for.cond18.preheader
%wide.trip.count72 = zext i32 %7 to i64
br label %for.body21
for.body9: ; preds = %for.cond6.preheader, %for.body9
%i.162 = phi i32 [ %inc16, %for.body9 ], [ 0, %for.cond6.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n, ptr noundef nonnull %l, ptr noundef nonnull %r)
%4 = load i32, ptr %n, align 4, !tbaa !15
%5 = load i32, ptr %l, align 4, !tbaa !15
%6 = load i32, ptr %r, align 4, !tbaa !15
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds %struct.list, ptr %call1, i64 %idxprom.i
store i32 %4, ptr %arrayidx.i, align 8, !tbaa !5
%ln.i = getelementptr inbounds %struct.list, ptr %call1, i64 %idxprom.i, i32 1
store i32 %5, ptr %ln.i, align 4, !tbaa !11
%rn.i = getelementptr inbounds %struct.list, ptr %call1, i64 %idxprom.i, i32 2
store i32 %6, ptr %rn.i, align 8, !tbaa !12
%l8.i = getelementptr inbounds %struct.list, ptr %call1, i64 %idxprom.i, i32 3
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %l8.i, i8 0, i64 16, i1 false)
%idxprom11 = sext i32 %5 to i64
%arrayidx12 = getelementptr inbounds i32, ptr %call4, i64 %idxprom11
store i32 0, ptr %arrayidx12, align 4, !tbaa !15
%idxprom13 = sext i32 %6 to i64
%arrayidx14 = getelementptr inbounds i32, ptr %call4, i64 %idxprom13
store i32 0, ptr %arrayidx14, align 4, !tbaa !15
%inc16 = add nuw nsw i32 %i.162, 1
%7 = load i32, ptr %num, align 4, !tbaa !15
%cmp7 = icmp slt i32 %inc16, %7
br i1 %cmp7, label %for.body9, label %for.cond18.preheader, !llvm.loop !21
for.body21: ; preds = %for.body21.preheader, %for.inc24
%indvars.iv69 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next70, %for.inc24 ]
%arrayidx23 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv69
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !15
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %for.inc24, label %if.then
if.then: ; preds = %for.body21
%9 = trunc i64 %indvars.iv69 to i32
call void @str_t(i32 noundef %9, ptr noundef %call1)
br label %for.end26
for.inc24: ; preds = %for.body21
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond73.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count72
br i1 %exitcond73.not, label %for.end26, label %for.body21, !llvm.loop !22
for.end26: ; preds = %for.inc24, %entry, %for.cond6.preheader, %for.cond18.preheader, %if.then
%i.258 = phi i32 [ %9, %if.then ], [ 0, %for.cond18.preheader ], [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %7, %for.inc24 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%idxprom28 = zext i32 %i.258 to i64
%arrayidx29 = getelementptr inbounds %struct.list, ptr %call1, i64 %idxprom28
call void @output(ptr noundef %arrayidx29, i32 noundef -1)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @output(ptr noundef %arrayidx29, i32 noundef 0)
%puts56 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @output(ptr noundef %arrayidx29, i32 noundef 1)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #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) #4
; 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 #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
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 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"list", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 8}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 24}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17, !18, !19}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !17, !19, !18}
!21 = distinct !{!21, !17}
!22 = distinct !{!22, !17}
|
#include <stdio.h>
#include <stdlib.h>
struct node{
int id;
struct node *parentNode;
struct node *leftChild;
struct node *rightChild;
struct node *sibling;
};
void preorder(struct node* nd);
void inorder(struct node* nd);
void postorder(struct node* nd);
struct node* createNode(int);
struct node* searchNode(int);
struct node* nodes[26];
int n;
int main(){
int i,j;
int id;
int tmpId;
int left, right;
int depth;
struct node* currentNode;
struct node* tmpNode;
struct node* leftChild;
struct node* rightChild;
struct node* root;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&id);
currentNode = createNode(id);
scanf("%d",&left);
leftChild = createNode(left);
scanf("%d",&right);
rightChild = createNode(right);
if(leftChild){
leftChild->sibling = rightChild;
leftChild->parentNode = currentNode;
currentNode->leftChild = leftChild;
}
if(rightChild){
rightChild->sibling = leftChild;
rightChild->parentNode = currentNode;
currentNode->rightChild = rightChild;
}
}
// search root
for(i=0; i<n; i++){
depth = 0;
tmpNode = nodes[i]->parentNode;
while(tmpNode){
depth++;
tmpNode = tmpNode->parentNode;
}
if(depth == 0){
root = nodes[i];
break;
}
}
printf("Preorder\n");
preorder(root);
printf("\nInorder\n");
inorder(root);
printf("\nPostorder\n");
postorder(root);
printf("\n");
return 0;
}
void preorder(struct node* nd){
struct node *tmpNode;
printf(" %d",nd->id);
if(nd->leftChild) preorder(nd->leftChild);
if(nd->rightChild) preorder(nd->rightChild);
}
void inorder(struct node* nd){
struct node *tmpNode;
if(nd->leftChild) inorder(nd->leftChild);
printf(" %d",nd->id);
if(nd->rightChild) inorder(nd->rightChild);
}
void postorder(struct node* nd){
struct node *tmpNode;
if(nd->leftChild) postorder(nd->leftChild);
if(nd->rightChild) postorder(nd->rightChild);
printf(" %d",nd->id);
}
struct node* createNode(int id){
struct node *newNode;
if(id < 0) return NULL;
if(newNode = searchNode(id)) return newNode;
newNode = (struct node*)malloc(sizeof(struct node));
newNode->id=id;
newNode->parentNode = NULL;
newNode->leftChild = NULL;
newNode->rightChild = NULL;
newNode->sibling = NULL;
nodes[id] = newNode;
return newNode;
}
struct node* searchNode(int id){
if(nodes[id]) return nodes[id];
return NULL;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102400/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102400/source.c"
target datalayout = "e-m:e-p270: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, ptr, ptr, ptr }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@nodes = dso_local local_unnamed_addr global [26 x ptr] zeroinitializer, align 16
@.str.5 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.6 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%id = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #8
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp75 = icmp sgt i32 %0, 0
br i1 %cmp75, label %for.body, label %for.end28
for.cond14.preheader: ; preds = %for.inc
%cmp1577 = icmp sgt i32 %7, 0
br i1 %cmp1577, label %for.body16.preheader, label %for.end28
for.body16.preheader: ; preds = %for.cond14.preheader
%wide.trip.count = zext i32 %7 to i64
br label %for.body16
for.body: ; preds = %entry, %for.inc
%i.076 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%1 = load i32, ptr %id, align 4, !tbaa !5
%cmp.i = icmp slt i32 %1, 0
br i1 %cmp.i, label %createNode.exit, label %if.end.i
if.end.i: ; preds = %for.body
%idxprom.i.i = zext i32 %1 to i64
%arrayidx.i.i = getelementptr inbounds [26 x ptr], ptr @nodes, i64 0, i64 %idxprom.i.i
%2 = load ptr, ptr %arrayidx.i.i, align 8, !tbaa !9
%tobool.not.i = icmp eq ptr %2, null
br i1 %tobool.not.i, label %if.end2.i, label %createNode.exit
if.end2.i: ; preds = %if.end.i
%call3.i = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #9
store i32 %1, ptr %call3.i, align 8, !tbaa !11
%parentNode.i = getelementptr inbounds %struct.node, ptr %call3.i, i64 0, i32 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %parentNode.i, i8 0, i64 32, i1 false)
store ptr %call3.i, ptr %arrayidx.i.i, align 8, !tbaa !9
br label %createNode.exit
createNode.exit: ; preds = %for.body, %if.end.i, %if.end2.i
%retval.0.i = phi ptr [ %call3.i, %if.end2.i ], [ null, %for.body ], [ %2, %if.end.i ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %left)
%3 = load i32, ptr %left, align 4, !tbaa !5
%cmp.i55 = icmp slt i32 %3, 0
br i1 %cmp.i55, label %createNode.exit64, label %if.end.i56
if.end.i56: ; preds = %createNode.exit
%idxprom.i.i57 = zext i32 %3 to i64
%arrayidx.i.i58 = getelementptr inbounds [26 x ptr], ptr @nodes, i64 0, i64 %idxprom.i.i57
%4 = load ptr, ptr %arrayidx.i.i58, align 8, !tbaa !9
%tobool.not.i59 = icmp eq ptr %4, null
br i1 %tobool.not.i59, label %if.end2.i61, label %createNode.exit64
if.end2.i61: ; preds = %if.end.i56
%call3.i62 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #9
store i32 %3, ptr %call3.i62, align 8, !tbaa !11
%parentNode.i63 = getelementptr inbounds %struct.node, ptr %call3.i62, i64 0, i32 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %parentNode.i63, i8 0, i64 32, i1 false)
store ptr %call3.i62, ptr %arrayidx.i.i58, align 8, !tbaa !9
br label %createNode.exit64
createNode.exit64: ; preds = %createNode.exit, %if.end.i56, %if.end2.i61
%retval.0.i60 = phi ptr [ %call3.i62, %if.end2.i61 ], [ null, %createNode.exit ], [ %4, %if.end.i56 ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %right)
%5 = load i32, ptr %right, align 4, !tbaa !5
%cmp.i65 = icmp slt i32 %5, 0
br i1 %cmp.i65, label %createNode.exit74, label %if.end.i66
if.end.i66: ; preds = %createNode.exit64
%idxprom.i.i67 = zext i32 %5 to i64
%arrayidx.i.i68 = getelementptr inbounds [26 x ptr], ptr @nodes, i64 0, i64 %idxprom.i.i67
%6 = load ptr, ptr %arrayidx.i.i68, align 8, !tbaa !9
%tobool.not.i69 = icmp eq ptr %6, null
br i1 %tobool.not.i69, label %if.end2.i71, label %createNode.exit74
if.end2.i71: ; preds = %if.end.i66
%call3.i72 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #9
store i32 %5, ptr %call3.i72, align 8, !tbaa !11
%parentNode.i73 = getelementptr inbounds %struct.node, ptr %call3.i72, i64 0, i32 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %parentNode.i73, i8 0, i64 32, i1 false)
store ptr %call3.i72, ptr %arrayidx.i.i68, align 8, !tbaa !9
br label %createNode.exit74
createNode.exit74: ; preds = %createNode.exit64, %if.end.i66, %if.end2.i71
%retval.0.i70 = phi ptr [ %call3.i72, %if.end2.i71 ], [ null, %createNode.exit64 ], [ %6, %if.end.i66 ]
%tobool.not = icmp eq ptr %retval.0.i60, null
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %createNode.exit74
%sibling = getelementptr inbounds %struct.node, ptr %retval.0.i60, i64 0, i32 4
store ptr %retval.0.i70, ptr %sibling, align 8, !tbaa !13
%parentNode = getelementptr inbounds %struct.node, ptr %retval.0.i60, i64 0, i32 1
store ptr %retval.0.i, ptr %parentNode, align 8, !tbaa !14
%leftChild7 = getelementptr inbounds %struct.node, ptr %retval.0.i, i64 0, i32 2
store ptr %retval.0.i60, ptr %leftChild7, align 8, !tbaa !15
br label %if.end
if.end: ; preds = %if.then, %createNode.exit74
%tobool8.not = icmp eq ptr %retval.0.i70, null
br i1 %tobool8.not, label %for.inc, label %if.then9
if.then9: ; preds = %if.end
%sibling10 = getelementptr inbounds %struct.node, ptr %retval.0.i70, i64 0, i32 4
store ptr %retval.0.i60, ptr %sibling10, align 8, !tbaa !13
%parentNode11 = getelementptr inbounds %struct.node, ptr %retval.0.i70, i64 0, i32 1
store ptr %retval.0.i, ptr %parentNode11, align 8, !tbaa !14
%rightChild12 = getelementptr inbounds %struct.node, ptr %retval.0.i, i64 0, i32 3
store ptr %retval.0.i70, ptr %rightChild12, align 8, !tbaa !16
br label %for.inc
for.inc: ; preds = %if.end, %if.then9
%inc = add nuw nsw i32 %i.076, 1
%7 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.cond14.preheader, !llvm.loop !17
for.body16: ; preds = %while.end, %for.body16.preheader
%indvars.iv = phi i64 [ 0, %for.body16.preheader ], [ %indvars.iv.next, %while.end ]
%arrayidx = getelementptr inbounds [26 x ptr], ptr @nodes, i64 0, i64 %indvars.iv
%8 = load ptr, ptr %arrayidx, align 8, !tbaa !9
br label %while.cond
while.cond: ; preds = %while.cond, %for.body16
%.pn = phi ptr [ %8, %for.body16 ], [ %tmpNode.0, %while.cond ]
%depth.0 = phi i32 [ 0, %for.body16 ], [ %inc19, %while.cond ]
%tmpNode.0.in = getelementptr inbounds %struct.node, ptr %.pn, i64 0, i32 1
%tmpNode.0 = load ptr, ptr %tmpNode.0.in, align 8, !tbaa !14
%tobool18.not = icmp eq ptr %tmpNode.0, null
%inc19 = add nuw nsw i32 %depth.0, 1
br i1 %tobool18.not, label %while.end, label %while.cond, !llvm.loop !19
while.end: ; preds = %while.cond
%cmp21 = icmp eq i32 %depth.0, 0
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
%or.cond = select i1 %cmp21, i1 true, i1 %exitcond.not
br i1 %or.cond, label %for.end28, label %for.body16, !llvm.loop !20
for.end28: ; preds = %while.end, %entry, %for.cond14.preheader
%root.0 = phi ptr [ undef, %for.cond14.preheader ], [ undef, %entry ], [ %8, %while.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preorder(ptr noundef %root.0)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
call void @inorder(ptr noundef %root.0)
%puts54 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @postorder(ptr noundef %root.0)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #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: mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable
define dso_local ptr @createNode(i32 noundef %id) local_unnamed_addr #3 {
entry:
%cmp = icmp slt i32 %id, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%idxprom.i = zext i32 %id to i64
%arrayidx.i = getelementptr inbounds [26 x ptr], ptr @nodes, i64 0, i64 %idxprom.i
%0 = load ptr, ptr %arrayidx.i, align 8, !tbaa !9
%tobool.not = icmp eq ptr %0, null
br i1 %tobool.not, label %if.end2, label %cleanup
if.end2: ; preds = %if.end
%call3 = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #9
store i32 %id, ptr %call3, align 8, !tbaa !11
%parentNode = getelementptr inbounds %struct.node, ptr %call3, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %parentNode, i8 0, i64 32, i1 false)
store ptr %call3, ptr %arrayidx.i, align 8, !tbaa !9
br label %cleanup
cleanup: ; preds = %if.end, %entry, %if.end2
%retval.0 = phi ptr [ %call3, %if.end2 ], [ null, %entry ], [ %0, %if.end ]
ret ptr %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr nocapture noundef readonly %nd) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%nd.tr = phi ptr [ %nd, %entry ], [ %2, %if.end ]
%0 = load i32, ptr %nd.tr, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %0)
%leftChild = getelementptr inbounds %struct.node, ptr %nd.tr, i64 0, i32 2
%1 = load ptr, ptr %leftChild, align 8, !tbaa !15
%tobool.not = icmp eq ptr %1, null
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @preorder(ptr noundef nonnull %1)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%rightChild = getelementptr inbounds %struct.node, ptr %nd.tr, i64 0, i32 3
%2 = load ptr, ptr %rightChild, align 8, !tbaa !16
%tobool2.not = icmp eq ptr %2, null
br i1 %tobool2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr nocapture noundef readonly %nd) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%nd.tr = phi ptr [ %nd, %entry ], [ %2, %if.end ]
%leftChild = getelementptr inbounds %struct.node, ptr %nd.tr, i64 0, i32 2
%0 = load ptr, ptr %leftChild, align 8, !tbaa !15
%tobool.not = icmp eq ptr %0, null
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @inorder(ptr noundef nonnull %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%1 = load i32, ptr %nd.tr, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %1)
%rightChild = getelementptr inbounds %struct.node, ptr %nd.tr, i64 0, i32 3
%2 = load ptr, ptr %rightChild, align 8, !tbaa !16
%tobool2.not = icmp eq ptr %2, null
br i1 %tobool2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postorder(ptr nocapture noundef readonly %nd) local_unnamed_addr #0 {
entry:
%leftChild = getelementptr inbounds %struct.node, ptr %nd, i64 0, i32 2
%0 = load ptr, ptr %leftChild, align 8, !tbaa !15
%tobool.not = icmp eq ptr %0, null
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %entry
tail call void @postorder(ptr noundef nonnull %0)
br label %if.end
if.end: ; preds = %if.then, %entry
%rightChild = getelementptr inbounds %struct.node, ptr %nd, i64 0, i32 3
%1 = load ptr, ptr %rightChild, align 8, !tbaa !16
%tobool2.not = icmp eq ptr %1, null
br i1 %tobool2.not, label %if.end5, label %if.then3
if.then3: ; preds = %if.end
tail call void @postorder(ptr noundef nonnull %1)
br label %if.end5
if.end5: ; preds = %if.then3, %if.end
%2 = load i32, ptr %nd, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %2)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local ptr @searchNode(i32 noundef %id) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %id to i64
%arrayidx = getelementptr inbounds [26 x ptr], ptr @nodes, i64 0, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !9
ret ptr %0
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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(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 #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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"node", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!13 = !{!12, !10, i64 32}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
|
#include <stdio.h>
#define NMAX 10001
#define NIL -1
struct Node{
int p;
int l;
int r;
};
struct Node T[NMAX];
int n;
void preParse(int u){
if(u == NIL){
return;
}
printf(" %d",u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u == NIL){
return;
}
inParse(T[u].l);
printf(" %d",u);
inParse(T[u].r);
}
void postParse(int u){
if(u == NIL){
return;
}
postParse(T[u].l);
postParse(T[u].r);
printf(" %d",u);
}
int main(void){
int i,v,l,r,root;
scanf("%d",&n);
for(i = 0;i < n;i++){
T[i].p = NIL;
}
for(i = 0;i < n;i++){
scanf("%d %d %d",&v,&l,&r);
T[v].l = l;
T[v].r = r;
if(l != NIL){
T[l].p = v;
}
if(r != NIL){
T[r].p = v;
}
}
for(i = 0;i < n;i++){
if(T[i].p == NIL){
root = i;
}
}
printf("Preorder\n");
preParse(root);
printf("\nInorder\n");
inParse(root);
printf("\nPostorder\n");
postParse(root);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102459/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102459/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@T = dso_local local_unnamed_addr global [10001 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [9 x i8] c"\0AInorder\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"\0APostorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%r = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp53, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2557 = icmp sgt i32 %6, 0
br i1 %cmp2557, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count66 = zext i32 %6 to i64
%xtraiter70 = and i64 %wide.trip.count66, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter74 = and i64 %wide.trip.count66, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.156 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !11
%4 = load i32, ptr %v, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !11
%r10 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !10
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.156, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv63 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next64.3, %for.body26 ]
%root.059 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter75 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter75.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv63
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv63 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.059
%indvars.iv.next64 = or i64 %indvars.iv63, 1
%arrayidx28.1 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next64
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next64 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next64.1 = or i64 %indvars.iv63, 2
%arrayidx28.2 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next64.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next64.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next64.2 = or i64 %indvars.iv63, 3
%arrayidx28.3 = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next64.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next64.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next64.3 = add nuw nsw i64 %indvars.iv63, 4
%niter75.next.3 = add i64 %niter75, 4
%niter75.ncmp.3 = icmp eq i64 %niter75.next.3, %unroll_iter74
br i1 %niter75.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv63.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next64.3, %for.body26 ]
%root.059.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod72.not = icmp eq i64 %xtraiter70, 0
br i1 %lcmp.mod72.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv63.epil = phi i64 [ %indvars.iv.next64.epil, %for.body26.epil ], [ %indvars.iv63.unr, %for.end35.loopexit.unr-lcssa ]
%root.059.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.059.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter71 = phi i64 [ %epil.iter71.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10001 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv63.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv63.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.059.epil
%indvars.iv.next64.epil = add nuw nsw i64 %indvars.iv63.epil, 1
%epil.iter71.next = add i64 %epil.iter71, 1
%epil.iter71.cmp.not = icmp eq i64 %epil.iter71.next, %xtraiter70
br i1 %epil.iter71.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.059.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%puts52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"Node", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
#define N 100000
typedef struct{
int pare,fstch,sibling;
}Node;
Node node[N];
int n,dep[N],he[N];
void pre(int u){
if(u == -1)return;
printf(" %d",u);
pre(node[u].fstch);
pre(node[u].sibling);
}
void in(int u){
if(u == -1)return;
in(node[u].fstch);
printf(" %d",u);
in(node[u].sibling);
}
void post(int u){
if(u == -1)return;
post(node[u].fstch);
post(node[u].sibling);
printf(" %d",u);
}
int sibling(int x){
if(node[x].pare == -1)
return -1;
if(node[node[x].pare].fstch != x && node[node[x].pare].fstch != -1)
return node[node[x].pare].fstch ;
if(node[node[x].pare].sibling != x && node[node[x].pare].sibling != -1)
return node[node[x].pare].sibling;
return -1;
}
void depth(int x,int cnt){
if(x==-1) return;
dep[x]=cnt;
depth(node[x].fstch,cnt+1);
depth(node[x].sibling,cnt+1);
}
int height(int x){
int h1=0,h2=0;
if(node[x].fstch != -1)
h1=height(node[x].fstch)+1;
if(node[x].sibling != -1)
h2=height(node[x].sibling)+1;
return he[x]=(h1>h2?h1:h2);
}
int main(){
int i,j,ch,v,left,right,root,k;
scanf("%d",&n);
for(i=0;i<n;i++)
node[i].pare = node[i].fstch = node[i].sibling = -1;
for(i=0;i<n;i++){
scanf("%d %d %d",&v,&left,&right);
node[v].fstch=left;
node[v].sibling=right;
if(left!=-1) node[left].pare=v;
if(right!=-1) node[right].pare=v;
}
for(k=0;k<n;k++){
if(node[k].pare==-1)
root=k;
}
depth(root,0);
height(root);
printf("Preorder\n");
pre(root);
printf("\n");
printf("Inorder\n");
in(root);
printf("\n");
printf("Postorder\n");
post(root);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102501/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102501/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@node = dso_local local_unnamed_addr global [100000 x %struct.Node] zeroinitializer, align 16
@dep = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@he = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @pre(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%fstch = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %fstch, align 4, !tbaa !5
tail call void @pre(i32 noundef %0)
%sibling = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %sibling, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @in(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%fstch = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %fstch, align 4, !tbaa !5
tail call void @in(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%sibling = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %sibling, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @post(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%fstch = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %fstch, align 4, !tbaa !5
tail call void @post(i32 noundef %0)
%sibling = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %sibling, align 4, !tbaa !10
tail call void @post(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @sibling(i32 noundef %x) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%fstch = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %fstch, align 4, !tbaa !5
%cmp6.not = icmp eq i32 %1, %x
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%sibling = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %sibling, align 4, !tbaa !10
%cmp27.not = icmp eq i32 %2, %x
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @depth(i32 noundef %x, i32 noundef %cnt) local_unnamed_addr #3 {
entry:
%cmp11 = icmp eq i32 %x, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%cnt.tr13 = phi i32 [ %add, %if.end ], [ %cnt, %entry ]
%x.tr12 = phi i32 [ %1, %if.end ], [ %x, %entry ]
%idxprom = sext i32 %x.tr12 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @dep, i64 0, i64 %idxprom
store i32 %cnt.tr13, ptr %arrayidx, align 4, !tbaa !12
%fstch = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %fstch, align 4, !tbaa !5
%add = add nsw i32 %cnt.tr13, 1
tail call void @depth(i32 noundef %0, i32 noundef %add)
%sibling = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %sibling, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @height(i32 noundef %x) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %x to i64
%fstch = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %fstch, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @height(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%h1.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%sibling = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %sibling, align 4, !tbaa !10
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @height(i32 noundef %1)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%h2.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr @he, i64 0, i64 %idxprom
store i32 %cond, ptr %arrayidx16, align 4, !tbaa !12
ret i32 %cond
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #9
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !12
%cmp65 = icmp sgt i32 %0, 0
br i1 %cmp65, label %for.body7.preheader, label %for.cond28.preheader
for.body7.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @node, i8 -1, i64 %2, i1 false), !tbaa !12
br label %for.body7
for.cond28.preheader: ; preds = %for.inc25, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %7, %for.inc25 ]
%cmp2969 = icmp sgt i32 %.lcssa, 0
call void @llvm.assume(i1 %cmp2969)
%wide.trip.count = zext i32 %.lcssa to i64
%xtraiter = and i64 %wide.trip.count, 3
%3 = icmp ult i32 %.lcssa, 4
br i1 %3, label %for.end39.unr-lcssa, label %for.cond28.preheader.new
for.cond28.preheader.new: ; preds = %for.cond28.preheader
%unroll_iter = and i64 %wide.trip.count, 2147483644
br label %for.body30
for.body7: ; preds = %for.body7.preheader, %for.inc25
%i.168 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.body7.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %left, align 4, !tbaa !12
%5 = load i32, ptr %v, align 4, !tbaa !12
%idxprom9 = sext i32 %5 to i64
%fstch11 = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom9, i32 1
store i32 %4, ptr %fstch11, align 4, !tbaa !5
%6 = load i32, ptr %right, align 4, !tbaa !12
%sibling14 = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom9, i32 2
store i32 %6, ptr %sibling14, align 4, !tbaa !10
%cmp15.not = icmp eq i32 %4, -1
br i1 %cmp15.not, label %if.end, label %if.then
if.then: ; preds = %for.body7
%idxprom16 = sext i32 %4 to i64
%arrayidx17 = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom16
store i32 %5, ptr %arrayidx17, align 4, !tbaa !11
br label %if.end
if.end: ; preds = %if.then, %for.body7
%cmp19.not = icmp eq i32 %6, -1
br i1 %cmp19.not, label %for.inc25, label %if.then20
if.then20: ; preds = %if.end
%idxprom21 = sext i32 %6 to i64
%arrayidx22 = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %idxprom21
store i32 %5, ptr %arrayidx22, align 4, !tbaa !11
br label %for.inc25
for.inc25: ; preds = %if.end, %if.then20
%inc26 = add nuw nsw i32 %i.168, 1
%7 = load i32, ptr @n, align 4, !tbaa !12
%cmp6 = icmp slt i32 %inc26, %7
br i1 %cmp6, label %for.body7, label %for.cond28.preheader, !llvm.loop !13
for.body30: ; preds = %for.body30, %for.cond28.preheader.new
%indvars.iv = phi i64 [ 0, %for.cond28.preheader.new ], [ %indvars.iv.next.3, %for.body30 ]
%root.070 = phi i32 [ undef, %for.cond28.preheader.new ], [ %spec.select.3, %for.body30 ]
%niter = phi i64 [ 0, %for.cond28.preheader.new ], [ %niter.next.3, %for.body30 ]
%arrayidx32 = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx32, align 16, !tbaa !11
%cmp34 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp34, i32 %9, i32 %root.070
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx32.1 = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv.next
%10 = load i32, ptr %arrayidx32.1, align 4, !tbaa !11
%cmp34.1 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp34.1, i32 %11, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx32.2 = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv.next.1
%12 = load i32, ptr %arrayidx32.2, align 8, !tbaa !11
%cmp34.2 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp34.2, i32 %13, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx32.3 = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv.next.2
%14 = load i32, ptr %arrayidx32.3, align 4, !tbaa !11
%cmp34.3 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp34.3, i32 %15, i32 %spec.select.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.end39.unr-lcssa, label %for.body30, !llvm.loop !15
for.end39.unr-lcssa: ; preds = %for.body30, %for.cond28.preheader
%indvars.iv.unr = phi i64 [ 0, %for.cond28.preheader ], [ %indvars.iv.next.3, %for.body30 ]
%root.070.unr = phi i32 [ undef, %for.cond28.preheader ], [ %spec.select.3, %for.body30 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end39, label %for.body30.epil
for.body30.epil: ; preds = %for.end39.unr-lcssa, %for.body30.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body30.epil ], [ %indvars.iv.unr, %for.end39.unr-lcssa ]
%root.070.epil = phi i32 [ %spec.select.epil, %for.body30.epil ], [ %root.070.unr, %for.end39.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body30.epil ], [ 0, %for.end39.unr-lcssa ]
%arrayidx32.epil = getelementptr inbounds [100000 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv.epil
%16 = load i32, ptr %arrayidx32.epil, align 4, !tbaa !11
%cmp34.epil = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp34.epil, i32 %17, i32 %root.070.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.end39, label %for.body30.epil, !llvm.loop !16
for.end39: ; preds = %for.body30.epil, %for.end39.unr-lcssa
%spec.select.lcssa = phi i32 [ %root.070.unr, %for.end39.unr-lcssa ], [ %spec.select.epil, %for.body30.epil ]
call void @depth(i32 noundef %spec.select.lcssa, i32 noundef 0)
%call40 = call i32 @height(i32 noundef %spec.select.lcssa)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @pre(i32 noundef %spec.select.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts61 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @in(i32 noundef %spec.select.lcssa)
%putchar62 = call i32 @putchar(i32 10)
%puts63 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @post(i32 noundef %spec.select.lcssa)
%putchar64 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
|
#include<stdio.h>
#define MAX 100001
#define NIL -1
struct Node{
int left;
int right;
int parent;
};
struct Node Tree[MAX];
void Preorder(int);
void Inorder(int);
void Postorder(int);
int main(){
int n, i;
int id,l,r,root;
scanf("%d",&n);
for(i = 0 ; i < n ; i++){
Tree[i].parent = NIL;
}
for(i = 0 ; i < n ; i++){
scanf("%d %d %d",&id, &l, &r);
Tree[id].left = l;
Tree[id].right = r;
if(l != NIL) Tree[l].parent = id;
if(r != NIL) Tree[r].parent = id;
}
for(i = 0 ; i < n ; i++) if(Tree[i].parent == NIL) root = i;
printf("Preorder\n");
Preorder(root);
printf("\n");
printf("Inorder\n");
Inorder(root);
printf("\n");
printf("Postorder\n");
Postorder(root);
printf("\n");
return 0;
}
void Preorder(int x){
if(x == NIL) return;
printf(" %d",x);
Preorder(Tree[x].left);
Preorder(Tree[x].right);
}
void Inorder(int x){
if(x == NIL) return;
Inorder(Tree[x].left);
printf(" %d",x);
Inorder(Tree[x].right);
}
void Postorder(int x){
if(x == NIL) return;
Postorder(Tree[x].left);
Postorder(Tree[x].right);
printf(" %d",x);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102545/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102545/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@Tree = dso_local local_unnamed_addr global [100001 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp55 = icmp sgt i32 %0, 0
br i1 %cmp55, label %for.body.preheader, label %for.end33
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%parent.epil = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.epil, i32 2
store i32 -1, ptr %parent.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp55, label %for.body3, label %for.end33
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%parent = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv, i32 2
store i32 -1, ptr %parent, align 8, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%parent.1 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next, i32 2
store i32 -1, ptr %parent.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%parent.2 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next.1, i32 2
store i32 -1, ptr %parent.2, align 16, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%parent.3 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next.2, i32 2
store i32 -1, ptr %parent.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond22.preheader: ; preds = %for.inc19
%cmp2359 = icmp sgt i32 %6, 0
br i1 %cmp2359, label %for.body24.preheader, label %for.end33
for.body24.preheader: ; preds = %for.cond22.preheader
%wide.trip.count68 = zext i32 %6 to i64
%xtraiter72 = and i64 %wide.trip.count68, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end33.loopexit.unr-lcssa, label %for.body24.preheader.new
for.body24.preheader.new: ; preds = %for.body24.preheader
%unroll_iter76 = and i64 %wide.trip.count68, 4294967292
br label %for.body24
for.body3: ; preds = %for.cond1.preheader, %for.inc19
%i.158 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %id, align 4, !tbaa !5
%idxprom5 = sext i32 %4 to i64
%arrayidx6 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5
store i32 %3, ptr %arrayidx6, align 4, !tbaa !15
%5 = load i32, ptr %r, align 4, !tbaa !5
%right = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5, i32 1
store i32 %5, ptr %right, align 4, !tbaa !16
%cmp9.not = icmp eq i32 %3, -1
br i1 %cmp9.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom10 = sext i32 %3 to i64
%parent12 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom10, i32 2
store i32 %4, ptr %parent12, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp13.not = icmp eq i32 %5, -1
br i1 %cmp13.not, label %for.inc19, label %if.then14
if.then14: ; preds = %if.end
%idxprom15 = sext i32 %5 to i64
%parent17 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom15, i32 2
store i32 %4, ptr %parent17, align 4, !tbaa !9
br label %for.inc19
for.inc19: ; preds = %if.end, %if.then14
%inc20 = add nuw nsw i32 %i.158, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc20, %6
br i1 %cmp2, label %for.body3, label %for.cond22.preheader, !llvm.loop !17
for.body24: ; preds = %for.body24, %for.body24.preheader.new
%indvars.iv65 = phi i64 [ 0, %for.body24.preheader.new ], [ %indvars.iv.next66.3, %for.body24 ]
%root.061 = phi i32 [ undef, %for.body24.preheader.new ], [ %spec.select.3, %for.body24 ]
%niter77 = phi i64 [ 0, %for.body24.preheader.new ], [ %niter77.next.3, %for.body24 ]
%parent27 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv65, i32 2
%7 = load i32, ptr %parent27, align 8, !tbaa !9
%cmp28 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv65 to i32
%spec.select = select i1 %cmp28, i32 %8, i32 %root.061
%indvars.iv.next66 = or i64 %indvars.iv65, 1
%parent27.1 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next66, i32 2
%9 = load i32, ptr %parent27.1, align 4, !tbaa !9
%cmp28.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next66 to i32
%spec.select.1 = select i1 %cmp28.1, i32 %10, i32 %spec.select
%indvars.iv.next66.1 = or i64 %indvars.iv65, 2
%parent27.2 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next66.1, i32 2
%11 = load i32, ptr %parent27.2, align 16, !tbaa !9
%cmp28.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next66.1 to i32
%spec.select.2 = select i1 %cmp28.2, i32 %12, i32 %spec.select.1
%indvars.iv.next66.2 = or i64 %indvars.iv65, 3
%parent27.3 = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next66.2, i32 2
%13 = load i32, ptr %parent27.3, align 4, !tbaa !9
%cmp28.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next66.2 to i32
%spec.select.3 = select i1 %cmp28.3, i32 %14, i32 %spec.select.2
%indvars.iv.next66.3 = add nuw nsw i64 %indvars.iv65, 4
%niter77.next.3 = add i64 %niter77, 4
%niter77.ncmp.3 = icmp eq i64 %niter77.next.3, %unroll_iter76
br i1 %niter77.ncmp.3, label %for.end33.loopexit.unr-lcssa, label %for.body24, !llvm.loop !18
for.end33.loopexit.unr-lcssa: ; preds = %for.body24, %for.body24.preheader
%indvars.iv65.unr = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next66.3, %for.body24 ]
%root.061.unr = phi i32 [ undef, %for.body24.preheader ], [ %spec.select.3, %for.body24 ]
%lcmp.mod74.not = icmp eq i64 %xtraiter72, 0
br i1 %lcmp.mod74.not, label %for.end33, label %for.body24.epil
for.body24.epil: ; preds = %for.end33.loopexit.unr-lcssa, %for.body24.epil
%indvars.iv65.epil = phi i64 [ %indvars.iv.next66.epil, %for.body24.epil ], [ %indvars.iv65.unr, %for.end33.loopexit.unr-lcssa ]
%root.061.epil = phi i32 [ %spec.select.epil, %for.body24.epil ], [ %root.061.unr, %for.end33.loopexit.unr-lcssa ]
%epil.iter73 = phi i64 [ %epil.iter73.next, %for.body24.epil ], [ 0, %for.end33.loopexit.unr-lcssa ]
%parent27.epil = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv65.epil, i32 2
%15 = load i32, ptr %parent27.epil, align 4, !tbaa !9
%cmp28.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv65.epil to i32
%spec.select.epil = select i1 %cmp28.epil, i32 %16, i32 %root.061.epil
%indvars.iv.next66.epil = add nuw nsw i64 %indvars.iv65.epil, 1
%epil.iter73.next = add i64 %epil.iter73, 1
%epil.iter73.cmp.not = icmp eq i64 %epil.iter73.next, %xtraiter72
br i1 %epil.iter73.cmp.not, label %for.end33, label %for.body24.epil, !llvm.loop !19
for.end33: ; preds = %for.end33.loopexit.unr-lcssa, %for.body24.epil, %entry, %for.cond1.preheader, %for.cond22.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond22.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.061.unr, %for.end33.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body24.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @Preorder(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @Inorder(i32 noundef %root.0.lcssa)
%putchar52 = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @Postorder(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %x, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr7 = phi i32 [ %1, %if.end ], [ %x, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x.tr7)
%idxprom = sext i32 %x.tr7 to i64
%arrayidx = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !15
tail call void @Preorder(i32 noundef %0)
%right = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %x, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr7 = phi i32 [ %1, %if.end ], [ %x, %entry ]
%idxprom = sext i32 %x.tr7 to i64
%arrayidx = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !15
tail call void @Inorder(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x.tr7)
%right = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Postorder(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %x, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !15
tail call void @Postorder(i32 noundef %0)
%right = getelementptr inbounds [100001 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %right, align 4, !tbaa !16
tail call void @Postorder(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %x)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !6, i64 4}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include <stdio.h>
#define MAX 10000
#define NIL -1
typedef struct{
int p, l, r;
}Node;
Node T[MAX];
int n;
void preParse(int u){
if(u==NIL) return;
printf(" %d", u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u==NIL) return;
inParse(T[u].l);
printf(" %d", u);
inParse(T[u].r);
}
void postParse(int u){
if(u==NIL) return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d", u);
}
int main(){
int i, v, l, r, root;
scanf("%d", &n);
for(i=0; i<n; i++) T[i].p=NIL;
for(i=0; i<n; i++){
scanf("%d %d %d", &v, &l, &r);
T[v].l = l;
T[v].r = r;
if(l!=NIL) T[l].p=v;
if(r!=NIL) T[r].p=v;
}
for(i=0; i<n; i++){
if(T[i].p==NIL) root=i;
}
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102589/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102589/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !11
%4 = load i32, ptr %v, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !11
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !10
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%root.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
#define MAX 10000
struct Node{
int parent;
int left;
int right;
};
struct Node T[MAX];
int n;
void preParse(int u){
if( u==-1 ){ return; }
printf(" %d", u);
preParse(T[u].left);
preParse(T[u].right);
}
void inParse(int u){
if( u==-1 ){ return; }
inParse(T[u].left);
printf(" %d", u);
inParse(T[u].right);
}
void postParse(int u){
if( u==-1 ){ return; }
postParse(T[u].left);
postParse(T[u].right);
printf(" %d", u);
}
int main(void){
int i, num, left, right, root;
scanf("%d", &n);
for(i=0; i<n; i++){
T[i].parent = -1;
}
for(i=0; i<n; i++){
scanf("%d %d %d", &num, &left, &right);
T[num].left = left;
T[num].right = right;
if( left != -1 ){ T[left].parent = num; }
if( right != -1 ){ T[ right].parent = num; }
}
for(i=0; i<n; i++){
if( T[i].parent == -1 ){ root = i; }
}
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102631/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102631/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
tail call void @preParse(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !5
tail call void @postParse(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !10
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %num, ptr noundef nonnull %left, ptr noundef nonnull %right)
%3 = load i32, ptr %left, align 4, !tbaa !11
%4 = load i32, ptr %num, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%left7 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %left7, align 4, !tbaa !5
%5 = load i32, ptr %right, align 4, !tbaa !11
%right10 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %right10, align 4, !tbaa !10
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%root.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"Node", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
#define M 10000
#define NIL -1
typedef struct{
int parent;
int left;
int right;
}Tree;
Tree t[M];
int n;
void preParse(int);
void inParse(int);
void postParse(int);
void print(void);
int main(){
int i,v,l,r;
scanf("%d",&n);
for(i = 0; i < n; i++){
t[i].parent =NIL;
}
for(i = 0;i < n; i++){
scanf("%d %d %d",&v,&l,&r);
t[v].left = l;
t[v].right = r;
if(l != NIL)t[l].parent = v;
if(r != NIL)t[r].parent = v;
}
print();
return 0;
}
void preParse(int u){
if(u == NIL)return;
printf(" %d",u);
preParse(t[u].left);
preParse(t[u].right);
}
void inParse(int u){
if(u == NIL)return;
inParse(t[u].left);
printf( " %d",u);
inParse(t[u].right);
}
void postParse(int u){
if(u == NIL)return;
postParse(t[u].left);
postParse(t[u].right);
printf(" %d",u);
}
void print(){
int i,r;
for(i = 0; i < n; i++){
if(t[i].parent == NIL)r = i;
}
printf("Preorder\n");
preParse(r);
printf("\n");
printf("Inorder\n");
inParse(r);
printf("\n");
printf("Postorder\n");
postParse(r);
printf("\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102675/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102675/source.c"
target datalayout = "e-m:e-p270: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.Tree = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@t = dso_local local_unnamed_addr global [10000 x %struct.Tree] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %0, 0
br i1 %cmp27, label %for.body.preheader, label %for.end21
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp27, label %for.body3, label %for.end21
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.body3: ; preds = %for.cond1.preheader, %for.inc19
%i.130 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%2 = load i32, ptr %l, align 4, !tbaa !5
%3 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %3 to i64
%left = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom5, i32 1
store i32 %2, ptr %left, align 4, !tbaa !15
%4 = load i32, ptr %r, align 4, !tbaa !5
%right = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom5, i32 2
store i32 %4, ptr %right, align 4, !tbaa !16
%cmp9.not = icmp eq i32 %2, -1
br i1 %cmp9.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom10 = sext i32 %2 to i64
%arrayidx11 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom10
store i32 %3, ptr %arrayidx11, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp13.not = icmp eq i32 %4, -1
br i1 %cmp13.not, label %for.inc19, label %if.then14
if.then14: ; preds = %if.end
%idxprom15 = sext i32 %4 to i64
%arrayidx16 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom15
store i32 %3, ptr %arrayidx16, align 4, !tbaa !9
br label %for.inc19
for.inc19: ; preds = %if.end, %if.then14
%inc20 = add nuw nsw i32 %i.130, 1
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc20, %5
br i1 %cmp2, label %for.body3, label %for.end21, !llvm.loop !17
for.end21: ; preds = %for.inc19, %entry, %for.cond1.preheader
call void @print()
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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 nounwind uwtable
define dso_local void @print() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%r.018 = phi i32 [ undef, %for.body.preheader.new ], [ %spec.select.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx, align 16, !tbaa !9
%cmp1 = icmp eq i32 %2, -1
%3 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp1, i32 %3, i32 %r.018
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next
%4 = load i32, ptr %arrayidx.1, align 4, !tbaa !9
%cmp1.1 = icmp eq i32 %4, -1
%5 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp1.1, i32 %5, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next.1
%6 = load i32, ptr %arrayidx.2, align 8, !tbaa !9
%cmp1.2 = icmp eq i32 %6, -1
%7 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp1.2, i32 %7, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next.2
%8 = load i32, ptr %arrayidx.3, align 4, !tbaa !9
%cmp1.3 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp1.3, i32 %9, i32 %spec.select.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.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%r.018.unr = phi i32 [ undef, %for.body.preheader ], [ %spec.select.3, %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 ]
%r.018.epil = phi i32 [ %spec.select.epil, %for.body.epil ], [ %r.018.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.epil
%10 = load i32, ptr %arrayidx.epil, align 4, !tbaa !9
%cmp1.epil = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp1.epil, i32 %11, i32 %r.018.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 !19
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i32 [ undef, %entry ], [ %r.018.unr, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body.epil ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
tail call void @preParse(i32 noundef %r.0.lcssa)
%putchar = tail call i32 @putchar(i32 10)
%puts12 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
tail call void @inParse(i32 noundef %r.0.lcssa)
%putchar13 = tail call i32 @putchar(i32 10)
%puts14 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
tail call void @postParse(i32 noundef %r.0.lcssa)
%putchar15 = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @preParse(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %u.tr7)
%right = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @postParse(i32 noundef %0)
%right = getelementptr inbounds [10000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include <stdio.h>
#define MAX 10000
#define NIL -1
struct Node {
int p,l,r;
};
struct Node t[MAX];
int n;
void pre(int );
void in(int );
void post(int );
int main(){
int i,v,l,r,root;
scanf("%d",&n);
for(i=0;i<n;i++){
t[i].p=NIL;
}
for(i=0;i<n;i++){
scanf("%d %d %d",&v,&l,&r);
t[v].l=l;
t[v].r=r;
if(l!=NIL) t[l].p=v;
if(r!=NIL) t[r].p=v;
}
for(i=0;i<n;i++) if(t[i].p==NIL) root=i;
printf("Preorder\n");
pre(root);
printf("\n");
printf("Inorder\n");
in(root);
printf("\n");
printf("Postorder\n");
post(root);
printf("\n");
return 0;
}
void pre(int u){
if(u==NIL) return;
printf(" %d",u);
pre(t[u].l);
pre(t[u].r);
}
void in(int u){
if(u==NIL)return;
in(t[u].l);
printf(" %d",u);
in(t[u].r);
}
void post(int u){
if(u==NIL)return;
post(t[u].l);
post(t[u].r);
printf(" %d",u);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102718/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102718/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@t = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !15
%5 = load i32, ptr %r, align 4, !tbaa !5
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !16
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !9
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !9
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !9
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !9
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !9
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%root.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !9
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @pre(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @in(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @post(i32 noundef %root.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @pre(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @pre(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @in(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @in(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @post(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @post(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
tail call void @post(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node{
int p;
int l;
int r;
};
struct Node T[MAX];
int n;
void preParse(int);
void inParse(int);
void postParse(int);
int main(){
int i,v,l,r,root;
scanf("%d",&n);
for(i=0;i<n;i++) T[i].p=NIL;
for(i=0;i<n;i++){
scanf("%d %d %d",&v,&l,&r);
T[v].l=l;
T[v].r=r;
if(l!=NIL) T[l].p=v;
if(r!=NIL) T[r].p=v;
}
for(i=0;i<n;i++) if( T[i].p==NIL) root=i;
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}
void preParse(int u){
if(u==NIL) return;
printf(" %d",u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u==NIL) return;
inParse(T[u].l);
printf(" %d",u);
inParse(T[u].r);
}
void postParse(int u){
if(u==NIL) return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d",u);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102769/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102769/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !15
%5 = load i32, ptr %r, align 4, !tbaa !5
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !16
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !9
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !9
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !9
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !9
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !9
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%root.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !9
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !15
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !16
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include <stdio.h>
#define MAX 25
struct Node{
int parent;
int left;
int right;
};
struct Node T[MAX];
void preP(int);
void inP(int);
void postP(int);
int main(){
int i=0;
int n=0;
int id=0;
int root=0;
scanf("%d",&n);
for(i=0;i<n;i++){
T[i].parent=-1;
}
for(i=0;i<n;i++){
scanf("%d",&id);
scanf("%d%d",&T[id].left,&T[id].right);
if(T[id].left!=-1)T[T[id].left].parent=id;
if(T[id].right!=-1)T[T[id].right].parent=id;
}
for(i=0;i<n;i++) if(T[i].parent==-1) root=i;
printf("Preorder\n");
preP(root);
printf("\n");
printf("Inorder\n");
inP(root);
printf("\n");
printf("Postorder\n");
postP(root);
printf("\n");
return 0;
}
void preP(int u){
if(u==-1) return;
printf(" %d",u);
preP(T[u].left);
preP(T[u].right);
}
void inP(int u){
if(u==-1) return;
inP(T[u].left);
printf(" %d",u);
inP(T[u].right);
}
void postP(int u){
if(u==-1) return;
postP(T[u].left);
postP(T[u].right);
printf(" %d",u);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102811/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102811/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@T = dso_local global [25 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #4
store i32 0, ptr %id, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body.preheader, label %for.end46
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp68, label %for.body3, label %for.end46
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond35.preheader: ; preds = %for.inc32
%cmp3672 = icmp sgt i32 %7, 0
br i1 %cmp3672, label %for.body37.preheader, label %for.end46
for.body37.preheader: ; preds = %for.cond35.preheader
%wide.trip.count81 = zext i32 %7 to i64
%xtraiter85 = and i64 %wide.trip.count81, 3
%2 = icmp ult i32 %7, 4
br i1 %2, label %for.end46.loopexit.unr-lcssa, label %for.body37.preheader.new
for.body37.preheader.new: ; preds = %for.body37.preheader
%unroll_iter89 = and i64 %wide.trip.count81, 4294967292
br label %for.body37
for.body3: ; preds = %for.cond1.preheader, %for.inc32
%i.171 = phi i32 [ %inc33, %for.inc32 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%3 = load i32, ptr %id, align 4, !tbaa !5
%idxprom5 = sext i32 %3 to i64
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %id, align 4, !tbaa !5
%idxprom10 = sext i32 %4 to i64
%left12 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom10, i32 1
%5 = load i32, ptr %left12, align 4, !tbaa !15
%cmp13.not = icmp eq i32 %5, -1
br i1 %cmp13.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%right22 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom10, i32 2
%6 = load i32, ptr %right22, align 4, !tbaa !16
%cmp23.not = icmp eq i32 %6, -1
br i1 %cmp23.not, label %for.inc32, label %if.then24
if.then24: ; preds = %if.end
%idxprom28 = sext i32 %6 to i64
%arrayidx29 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom28
store i32 %4, ptr %arrayidx29, align 4, !tbaa !9
br label %for.inc32
for.inc32: ; preds = %if.end, %if.then24
%inc33 = add nuw nsw i32 %i.171, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc33, %7
br i1 %cmp2, label %for.body3, label %for.cond35.preheader, !llvm.loop !17
for.body37: ; preds = %for.body37, %for.body37.preheader.new
%indvars.iv78 = phi i64 [ 0, %for.body37.preheader.new ], [ %indvars.iv.next79.3, %for.body37 ]
%root.074 = phi i32 [ 0, %for.body37.preheader.new ], [ %spec.select.3, %for.body37 ]
%niter90 = phi i64 [ 0, %for.body37.preheader.new ], [ %niter90.next.3, %for.body37 ]
%arrayidx39 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv78
%8 = load i32, ptr %arrayidx39, align 16, !tbaa !9
%cmp41 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv78 to i32
%spec.select = select i1 %cmp41, i32 %9, i32 %root.074
%indvars.iv.next79 = or i64 %indvars.iv78, 1
%arrayidx39.1 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next79
%10 = load i32, ptr %arrayidx39.1, align 4, !tbaa !9
%cmp41.1 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.next79 to i32
%spec.select.1 = select i1 %cmp41.1, i32 %11, i32 %spec.select
%indvars.iv.next79.1 = or i64 %indvars.iv78, 2
%arrayidx39.2 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next79.1
%12 = load i32, ptr %arrayidx39.2, align 8, !tbaa !9
%cmp41.2 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next79.1 to i32
%spec.select.2 = select i1 %cmp41.2, i32 %13, i32 %spec.select.1
%indvars.iv.next79.2 = or i64 %indvars.iv78, 3
%arrayidx39.3 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next79.2
%14 = load i32, ptr %arrayidx39.3, align 4, !tbaa !9
%cmp41.3 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next79.2 to i32
%spec.select.3 = select i1 %cmp41.3, i32 %15, i32 %spec.select.2
%indvars.iv.next79.3 = add nuw nsw i64 %indvars.iv78, 4
%niter90.next.3 = add i64 %niter90, 4
%niter90.ncmp.3 = icmp eq i64 %niter90.next.3, %unroll_iter89
br i1 %niter90.ncmp.3, label %for.end46.loopexit.unr-lcssa, label %for.body37, !llvm.loop !18
for.end46.loopexit.unr-lcssa: ; preds = %for.body37, %for.body37.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body37.preheader ], [ %spec.select.3, %for.body37 ]
%indvars.iv78.unr = phi i64 [ 0, %for.body37.preheader ], [ %indvars.iv.next79.3, %for.body37 ]
%root.074.unr = phi i32 [ 0, %for.body37.preheader ], [ %spec.select.3, %for.body37 ]
%lcmp.mod87.not = icmp eq i64 %xtraiter85, 0
br i1 %lcmp.mod87.not, label %for.end46, label %for.body37.epil
for.body37.epil: ; preds = %for.end46.loopexit.unr-lcssa, %for.body37.epil
%indvars.iv78.epil = phi i64 [ %indvars.iv.next79.epil, %for.body37.epil ], [ %indvars.iv78.unr, %for.end46.loopexit.unr-lcssa ]
%root.074.epil = phi i32 [ %spec.select.epil, %for.body37.epil ], [ %root.074.unr, %for.end46.loopexit.unr-lcssa ]
%epil.iter86 = phi i64 [ %epil.iter86.next, %for.body37.epil ], [ 0, %for.end46.loopexit.unr-lcssa ]
%arrayidx39.epil = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv78.epil
%16 = load i32, ptr %arrayidx39.epil, align 4, !tbaa !9
%cmp41.epil = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv78.epil to i32
%spec.select.epil = select i1 %cmp41.epil, i32 %17, i32 %root.074.epil
%indvars.iv.next79.epil = add nuw nsw i64 %indvars.iv78.epil, 1
%epil.iter86.next = add i64 %epil.iter86, 1
%epil.iter86.cmp.not = icmp eq i64 %epil.iter86.next, %xtraiter85
br i1 %epil.iter86.cmp.not, label %for.end46, label %for.body37.epil, !llvm.loop !19
for.end46: ; preds = %for.end46.loopexit.unr-lcssa, %for.body37.epil, %entry, %for.cond1.preheader, %for.cond35.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond35.preheader ], [ 0, %for.cond1.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end46.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body37.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preP(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts64 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inP(i32 noundef %root.0.lcssa)
%putchar65 = call i32 @putchar(i32 10)
%puts66 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postP(i32 noundef %root.0.lcssa)
%putchar67 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preP(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @preP(i32 noundef %0)
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inP(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @inP(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7)
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postP(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !15
tail call void @postP(i32 noundef %0)
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !16
tail call void @postP(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u)
br label %common.ret6
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !12}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
typedef struct{
int p,l,r;
}Node;
Node T[MAX];
int n;
void preParse(int u){
if(u == NIL)return;
printf(" %d",u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u == NIL)return;
inParse(T[u].l);
printf(" %d",u);
inParse(T[u].r);
}
void postParse(int u){
if(u == NIL)return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d",u);
}
int main(){
int i,v,l,r,root;
scanf("%d",&n);
for(i = 0 ; i < n ; i++){
T[i].p = NIL;
}
for(i = 0 ; i < n ; i++){
scanf("%d %d %d",&v,&l,&r);
T[v].l = l;
T[v].r = r;
if(l != NIL)T[l].p = v;
if(r != NIL)T[r].p = v;
}
for(i = 0 ; i < n ; i++){
if(T[i].p == NIL)root = i;
}
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102862/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102862/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"Preorder\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Inorder\00", align 1
@str.8 = private unnamed_addr constant [10 x i8] c"Postorder\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @preParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp6 = icmp eq i32 %u, -1
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr7 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr7 to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @inParse(i32 noundef %0)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u.tr7)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @postParse(i32 noundef %u) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %u, -1
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !5
tail call void @postParse(i32 noundef %0)
%r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !10
tail call void @postParse(i32 noundef %1)
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
br label %common.ret6
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !11
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp57, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2561 = icmp sgt i32 %6, 0
br i1 %cmp2561, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count70 = zext i32 %6 to i64
%xtraiter74 = and i64 %wide.trip.count70, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter78 = and i64 %wide.trip.count70, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.160 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !11
%4 = load i32, ptr %v, align 4, !tbaa !11
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !11
%r10 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !10
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.160, 1
%6 = load i32, ptr @n, align 4, !tbaa !11
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv67 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063 = phi i32 [ undef, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter79 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter79.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv67 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.063
%indvars.iv.next68 = or i64 %indvars.iv67, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next68 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next68.1 = or i64 %indvars.iv67, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next68.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next68.2 = or i64 %indvars.iv67, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next68.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next68.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
%niter79.next.3 = add i64 %niter79, 4
%niter79.ncmp.3 = icmp eq i64 %niter79.next.3, %unroll_iter78
br i1 %niter79.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv67.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next68.3, %for.body26 ]
%root.063.unr = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod76.not = icmp eq i64 %xtraiter74, 0
br i1 %lcmp.mod76.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %for.body26.epil ], [ %indvars.iv67.unr, %for.end35.loopexit.unr-lcssa ]
%root.063.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter75 = phi i64 [ %epil.iter75.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv67.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv67.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.063.epil
%indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
%epil.iter75.next = add i64 %epil.iter75, 1
%epil.iter75.cmp.not = icmp eq i64 %epil.iter75.next, %xtraiter74
br i1 %epil.iter75.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %root.063.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @preParse(i32 noundef %root.0.lcssa)
%putchar = call i32 @putchar(i32 10)
%puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @inParse(i32 noundef %root.0.lcssa)
%putchar54 = call i32 @putchar(i32 10)
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @postParse(i32 noundef %root.0.lcssa)
%putchar56 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
|
#include <stdio.h>
int main(int argc, char const *argv[])
{
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
if( (x == y) && (z == 0) )
{
printf("0");
}
else if ( x > y+z )
{
printf("+");
}
else if ( y > x+z)
{
printf("-");
}
else
{
printf("?");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10292/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10292/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%x = alloca 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%2 = load i32, ptr %z, align 4
%cmp1 = icmp eq i32 %2, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %if.end14, label %if.else
if.else: ; preds = %entry
%add = add nsw i32 %2, %1
%cmp3 = icmp sgt i32 %0, %add
br i1 %cmp3, label %if.end14, label %if.else6
if.else6: ; preds = %if.else
%add7 = add nsw i32 %2, %0
%cmp8 = icmp sgt i32 %1, %add7
%. = select i1 %cmp8, i32 45, i32 63
br label %if.end14
if.end14: ; preds = %if.else6, %if.else, %entry
%.sink = phi i32 [ 48, %entry ], [ 43, %if.else ], [ %., %if.else6 ]
%putchar16 = call i32 @putchar(i32 %.sink)
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(void){
while(1){
int n; int jewel[21][21]={0};
scanf("%d",&n); if(n==0) break;
int x,y;
for(int i=0;i<n;i++){
scanf("%d%d",&x,&y);
jewel[y][x]=1;
}
int m; x=10,y=10;
int ans=0;
scanf("%d",&m); getchar();
for(int i=0;i<m;i++){
char c; int len,d=0;
scanf("%c%d",&c,&len); getchar();
//printf("%c\n",c);
switch(c){
case 'N':d=0; break;
case 'E':d=1; break;
case 'S':d=2; break;
case 'W':d=3; break;
}
for(int j=0;j<len;j++){
x+=dx[d]; y+=dy[d];
if(jewel[y][x]){
jewel[y][x]=0;
ans++;
}
}
}
if(ans==n) printf("Yes\n");
else printf("No\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102978/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102978/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dx = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 1, i32 0, i32 -1], align 16
@dy = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@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:
%n = alloca i32, align 4
%jewel = alloca [21 x [21 x i32]], align 16
%x = alloca i32, align 4
%y = alloca i32, align 4
%m = alloca i32, align 4
%c = alloca i8, align 1
%len = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1764, ptr nonnull %jewel) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1764) %jewel, i8 0, i64 1764, i1 false)
%call73 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp74 = icmp eq i32 %0, 0
br i1 %cmp74, label %while.end, label %if.end
if.end: ; preds = %entry, %for.cond.cleanup10
%1 = phi i32 [ %8, %for.cond.cleanup10 ], [ %0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
%cmp160 = icmp sgt i32 %1, 0
br i1 %cmp160, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
store i32 10, ptr %x, align 4, !tbaa !5
store i32 10, ptr %y, align 4, !tbaa !5
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%2 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = call i32 @getc(ptr noundef %2)
%3 = load i32, ptr %m, align 4, !tbaa !5
%cmp969 = icmp sgt i32 %3, 0
br i1 %cmp969, label %for.body11, label %for.cond.cleanup10
for.body: ; preds = %if.end, %for.body
%i.061 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%4 = load i32, ptr %y, align 4, !tbaa !5
%idxprom = sext i32 %4 to i64
%5 = load i32, ptr %x, align 4, !tbaa !5
%idxprom3 = sext i32 %5 to i64
%arrayidx4 = getelementptr inbounds [21 x [21 x i32]], ptr %jewel, i64 0, i64 %idxprom, i64 %idxprom3
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.061, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc, %6
br i1 %cmp1, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.cond.cleanup10: ; preds = %for.cond.cleanup20, %for.cond.cleanup
%ans.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %ans.1.lcssa, %for.cond.cleanup20 ]
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp44 = icmp eq i32 %ans.0.lcssa, %7
%str.5.str = select i1 %cmp44, ptr @str.5, ptr @str
%puts56 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 1764, ptr nonnull %jewel) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1764, ptr nonnull %jewel) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1764) %jewel, i8 0, i64 1764, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %8, 0
br i1 %cmp, label %while.end, label %if.end
for.body11: ; preds = %for.cond.cleanup, %for.cond.cleanup20
%i7.071 = phi i32 [ %inc42, %for.cond.cleanup20 ], [ 0, %for.cond.cleanup ]
%ans.070 = phi i32 [ %ans.1.lcssa, %for.cond.cleanup20 ], [ 0, %for.cond.cleanup ]
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %len) #5
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %c, ptr noundef nonnull %len)
%9 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i57 = call i32 @getc(ptr noundef %9)
%10 = load i8, ptr %c, align 1, !tbaa !13
%conv = sext i8 %10 to i32
switch i32 %conv, label %sw.epilog [
i32 87, label %sw.bb16
i32 69, label %sw.bb14
i32 83, label %sw.bb15
]
sw.bb14: ; preds = %for.body11
br label %sw.epilog
sw.bb15: ; preds = %for.body11
br label %sw.epilog
sw.bb16: ; preds = %for.body11
br label %sw.epilog
sw.epilog: ; preds = %for.body11, %sw.bb16, %sw.bb15, %sw.bb14
%d.0 = phi i64 [ 3, %sw.bb16 ], [ 2, %sw.bb15 ], [ 1, %sw.bb14 ], [ 0, %for.body11 ]
%11 = load i32, ptr %len, align 4, !tbaa !5
%cmp1864 = icmp sgt i32 %11, 0
br i1 %cmp1864, label %for.body21.lr.ph, label %for.cond.cleanup20
for.body21.lr.ph: ; preds = %sw.epilog
%y.promoted = load i32, ptr %y, align 4, !tbaa !5
%x.promoted = load i32, ptr %x, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %d.0
%12 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%arrayidx25 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %d.0
%13 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%14 = sext i32 %x.promoted to i64
%15 = sext i32 %12 to i64
%16 = sext i32 %y.promoted to i64
%17 = sext i32 %13 to i64
%xtraiter = and i32 %11, 1
%18 = icmp eq i32 %11, 1
br i1 %18, label %for.cond17.for.cond.cleanup20_crit_edge.unr-lcssa, label %for.body21.lr.ph.new
for.body21.lr.ph.new: ; preds = %for.body21.lr.ph
%unroll_iter = and i32 %11, -2
br label %for.body21
for.cond17.for.cond.cleanup20_crit_edge.unr-lcssa: ; preds = %for.inc38.1, %for.body21.lr.ph
%ans.2.lcssa.ph = phi i32 [ undef, %for.body21.lr.ph ], [ %ans.2.1, %for.inc38.1 ]
%indvars.iv.next.lcssa.ph = phi i64 [ undef, %for.body21.lr.ph ], [ %indvars.iv.next.1, %for.inc38.1 ]
%indvars.iv.next76.lcssa.ph = phi i64 [ undef, %for.body21.lr.ph ], [ %indvars.iv.next76.1, %for.inc38.1 ]
%indvars.iv75.unr = phi i64 [ %16, %for.body21.lr.ph ], [ %indvars.iv.next76.1, %for.inc38.1 ]
%indvars.iv.unr = phi i64 [ %14, %for.body21.lr.ph ], [ %indvars.iv.next.1, %for.inc38.1 ]
%ans.167.unr = phi i32 [ %ans.070, %for.body21.lr.ph ], [ %ans.2.1, %for.inc38.1 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond17.for.cond.cleanup20_crit_edge, label %for.body21.epil
for.body21.epil: ; preds = %for.cond17.for.cond.cleanup20_crit_edge.unr-lcssa
%indvars.iv.next.epil = add i64 %indvars.iv.unr, %15
%indvars.iv.next76.epil = add i64 %indvars.iv75.unr, %17
%arrayidx30.epil = getelementptr inbounds [21 x [21 x i32]], ptr %jewel, i64 0, i64 %indvars.iv.next76.epil, i64 %indvars.iv.next.epil
%19 = load i32, ptr %arrayidx30.epil, align 4, !tbaa !5
%tobool.not.epil = icmp eq i32 %19, 0
br i1 %tobool.not.epil, label %for.cond17.for.cond.cleanup20_crit_edge, label %if.then31.epil
if.then31.epil: ; preds = %for.body21.epil
store i32 0, ptr %arrayidx30.epil, align 4, !tbaa !5
%inc36.epil = add nsw i32 %ans.167.unr, 1
br label %for.cond17.for.cond.cleanup20_crit_edge
for.cond17.for.cond.cleanup20_crit_edge: ; preds = %for.body21.epil, %if.then31.epil, %for.cond17.for.cond.cleanup20_crit_edge.unr-lcssa
%ans.2.lcssa = phi i32 [ %ans.2.lcssa.ph, %for.cond17.for.cond.cleanup20_crit_edge.unr-lcssa ], [ %inc36.epil, %if.then31.epil ], [ %ans.167.unr, %for.body21.epil ]
%indvars.iv.next.lcssa = phi i64 [ %indvars.iv.next.lcssa.ph, %for.cond17.for.cond.cleanup20_crit_edge.unr-lcssa ], [ %indvars.iv.next.epil, %if.then31.epil ], [ %indvars.iv.next.epil, %for.body21.epil ]
%indvars.iv.next76.lcssa = phi i64 [ %indvars.iv.next76.lcssa.ph, %for.cond17.for.cond.cleanup20_crit_edge.unr-lcssa ], [ %indvars.iv.next76.epil, %if.then31.epil ], [ %indvars.iv.next76.epil, %for.body21.epil ]
%20 = trunc i64 %indvars.iv.next76.lcssa to i32
%21 = trunc i64 %indvars.iv.next.lcssa to i32
store i32 %21, ptr %x, align 4, !tbaa !5
store i32 %20, ptr %y, align 4, !tbaa !5
br label %for.cond.cleanup20
for.cond.cleanup20: ; preds = %for.cond17.for.cond.cleanup20_crit_edge, %sw.epilog
%ans.1.lcssa = phi i32 [ %ans.2.lcssa, %for.cond17.for.cond.cleanup20_crit_edge ], [ %ans.070, %sw.epilog ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %len) #5
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
%inc42 = add nuw nsw i32 %i7.071, 1
%22 = load i32, ptr %m, align 4, !tbaa !5
%cmp9 = icmp slt i32 %inc42, %22
br i1 %cmp9, label %for.body11, label %for.cond.cleanup10, !llvm.loop !14
for.body21: ; preds = %for.inc38.1, %for.body21.lr.ph.new
%indvars.iv75 = phi i64 [ %16, %for.body21.lr.ph.new ], [ %indvars.iv.next76.1, %for.inc38.1 ]
%indvars.iv = phi i64 [ %14, %for.body21.lr.ph.new ], [ %indvars.iv.next.1, %for.inc38.1 ]
%ans.167 = phi i32 [ %ans.070, %for.body21.lr.ph.new ], [ %ans.2.1, %for.inc38.1 ]
%niter = phi i32 [ 0, %for.body21.lr.ph.new ], [ %niter.next.1, %for.inc38.1 ]
%indvars.iv.next = add i64 %indvars.iv, %15
%indvars.iv.next76 = add i64 %indvars.iv75, %17
%arrayidx30 = getelementptr inbounds [21 x [21 x i32]], ptr %jewel, i64 0, i64 %indvars.iv.next76, i64 %indvars.iv.next
%23 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%tobool.not = icmp eq i32 %23, 0
br i1 %tobool.not, label %for.inc38, label %if.then31
if.then31: ; preds = %for.body21
store i32 0, ptr %arrayidx30, align 4, !tbaa !5
%inc36 = add nsw i32 %ans.167, 1
br label %for.inc38
for.inc38: ; preds = %for.body21, %if.then31
%ans.2 = phi i32 [ %inc36, %if.then31 ], [ %ans.167, %for.body21 ]
%indvars.iv.next.1 = add i64 %indvars.iv.next, %15
%indvars.iv.next76.1 = add i64 %indvars.iv.next76, %17
%arrayidx30.1 = getelementptr inbounds [21 x [21 x i32]], ptr %jewel, i64 0, i64 %indvars.iv.next76.1, i64 %indvars.iv.next.1
%24 = load i32, ptr %arrayidx30.1, align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %24, 0
br i1 %tobool.not.1, label %for.inc38.1, label %if.then31.1
if.then31.1: ; preds = %for.inc38
store i32 0, ptr %arrayidx30.1, align 4, !tbaa !5
%inc36.1 = add nsw i32 %ans.2, 1
br label %for.inc38.1
for.inc38.1: ; preds = %if.then31.1, %for.inc38
%ans.2.1 = phi i32 [ %inc36.1, %if.then31.1 ], [ %ans.2, %for.inc38 ]
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond17.for.cond.cleanup20_crit_edge.unr-lcssa, label %for.body21, !llvm.loop !15
while.end: ; preds = %for.cond.cleanup10, %entry
call void @llvm.lifetime.end.p0(i64 1764, ptr nonnull %jewel) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
#include <stdio.h>
int main(void) {
int x,y,z,i;
scanf("%d %d %d\n",&x,&y,&z);
for(i=0;i<1;i++){
if(x>(y+z)){
printf("+\n");
}
if(y>(x+z)){
printf("-\n");
}
if((z==0)&&(x==y)){
printf("0\n");
break;
}
if((z>(x-y))&&((x-y)>0)){
printf("?\n");
}
if((z>(y-x))&&((y-x)>=0)){
printf("?\n");
}
if((z==(x-y))||(z==(y-x))){
printf("?\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10302/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d %d %d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"+\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"-\00", align 1
@str.8 = private unnamed_addr constant [2 x i8] c"?\00", align 1
@str.9 = 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:
%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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%2 = load i32, ptr %z, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%cmp1 = icmp sgt i32 %0, %add
br i1 %cmp1, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %y, align 4, !tbaa !5
%.pre43 = load i32, ptr %x, align 4, !tbaa !5
%.pre44 = load i32, ptr %z, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%3 = phi i32 [ %.pre44, %if.then ], [ %2, %entry ]
%4 = phi i32 [ %.pre43, %if.then ], [ %0, %entry ]
%5 = phi i32 [ %.pre, %if.then ], [ %1, %entry ]
%add3 = add nsw i32 %3, %4
%cmp4 = icmp sgt i32 %5, %add3
br i1 %cmp4, label %if.then5, label %if.end7
if.then5: ; preds = %if.end
%puts36 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%.pr = load i32, ptr %z, align 4, !tbaa !5
%.pre45.pre = load i32, ptr %x, align 4, !tbaa !5
%.pre46.pre = load i32, ptr %y, align 4, !tbaa !5
br label %if.end7
if.end7: ; preds = %if.then5, %if.end
%.pre46 = phi i32 [ %.pre46.pre, %if.then5 ], [ %5, %if.end ]
%.pre45 = phi i32 [ %.pre45.pre, %if.then5 ], [ %4, %if.end ]
%6 = phi i32 [ %.pr, %if.then5 ], [ %3, %if.end ]
%cmp8 = icmp eq i32 %6, 0
%cmp9 = icmp eq i32 %.pre45, %.pre46
%or.cond56 = select i1 %cmp8, i1 %cmp9, i1 false
br i1 %or.cond56, label %for.end.sink.split, label %if.end12
if.end12: ; preds = %if.end7
%sub = sub nsw i32 %.pre45, %.pre46
%cmp13 = icmp sgt i32 %6, %sub
%cmp16 = icmp sgt i32 %sub, 0
%or.cond = and i1 %cmp13, %cmp16
br i1 %or.cond, label %if.then17, label %if.end19
if.then17: ; preds = %if.end12
%puts37 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%.pre47 = load i32, ptr %z, align 4, !tbaa !5
%.pre48 = load i32, ptr %y, align 4, !tbaa !5
%.pre49 = load i32, ptr %x, align 4, !tbaa !5
br label %if.end19
if.end19: ; preds = %if.then17, %if.end12
%7 = phi i32 [ %.pre49, %if.then17 ], [ %.pre45, %if.end12 ]
%8 = phi i32 [ %.pre48, %if.then17 ], [ %.pre46, %if.end12 ]
%9 = phi i32 [ %.pre47, %if.then17 ], [ %6, %if.end12 ]
%sub20 = sub nsw i32 %8, %7
%cmp21 = icmp sgt i32 %9, %sub20
%cmp24 = icmp sgt i32 %sub20, -1
%or.cond41 = and i1 %cmp21, %cmp24
br i1 %or.cond41, label %if.then25, label %if.end27
if.then25: ; preds = %if.end19
%puts38 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%.pre50 = load i32, ptr %z, align 4, !tbaa !5
%.pre51 = load i32, ptr %x, align 4, !tbaa !5
%.pre52 = load i32, ptr %y, align 4, !tbaa !5
%.pre55 = sub nsw i32 %.pre52, %.pre51
br label %if.end27
if.end27: ; preds = %if.then25, %if.end19
%sub30.pre-phi = phi i32 [ %.pre55, %if.then25 ], [ %sub20, %if.end19 ]
%10 = phi i32 [ %.pre52, %if.then25 ], [ %8, %if.end19 ]
%11 = phi i32 [ %.pre51, %if.then25 ], [ %7, %if.end19 ]
%12 = phi i32 [ %.pre50, %if.then25 ], [ %9, %if.end19 ]
%sub28 = sub nsw i32 %11, %10
%cmp29 = icmp eq i32 %12, %sub28
%cmp31 = icmp eq i32 %12, %sub30.pre-phi
%or.cond42 = select i1 %cmp29, i1 true, i1 %cmp31
br i1 %or.cond42, label %for.end.sink.split, label %for.end
for.end.sink.split: ; preds = %if.end27, %if.end7
%str.8.sink = phi ptr [ @str.9, %if.end7 ], [ @str.8, %if.end27 ]
%puts39 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
br label %for.end
for.end: ; preds = %for.end.sink.split, %if.end27
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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"}
|
// AtCoder150 C
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>
// qsortで用いる比較用関数.*a<*bならaが先になる.
int compare(const void* a, const void* b) {
return *(int*)a - *(int*)b;
}
int revcompare(const void* a, const void* b) {
return *(int*)b- *(int*)a;
}
int main(void)
{
int i,j,n;
int a,b;
scanf("%d %d", &a, &b);
char* s = (char*)malloc(sizeof(char) * (a + b + 2));
scanf("%s", s);
for(i=0;i<strlen(s);i++){
if(i == a){
if(s[i] != '-'){
printf("No");
return 0;
}
}else{
if(!(s[i] >= '0'&&s[i] <= '9')){
printf("No");
return 0;
}
}
}
printf("Yes");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103078/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103078/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @revcompare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: 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) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add i32 %0, 2
%add1 = add i32 %add, %1
%conv = sext i32 %add1 to i64
%call2 = call noalias ptr @malloc(i64 noundef %conv) #7
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call2)
%call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %call2) #8
%cmp43.not = icmp eq i64 %call5, 0
br i1 %cmp43.not, label %cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = zext i32 %2 to i64
%arrayidx = getelementptr inbounds i8, ptr %call2, i64 %3
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%cmp7 = icmp eq i64 %indvars.iv, %3
br i1 %cmp7, label %if.then, label %if.else
if.then: ; preds = %for.body
%4 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp10.not = icmp eq i8 %4, 45
br i1 %cmp10.not, label %for.inc, label %cleanup
if.else: ; preds = %for.body
%arrayidx15 = getelementptr inbounds i8, ptr %call2, i64 %indvars.iv
%5 = load i8, ptr %arrayidx15, align 1, !tbaa !9
%6 = add i8 %5, -48
%or.cond = icmp ult i8 %6, 10
br i1 %or.cond, label %for.inc, label %cleanup
for.inc: ; preds = %if.else, %if.then
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call5
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !10
cleanup: ; preds = %for.inc, %if.else, %if.then, %entry
%.str.3.sink = phi ptr [ @.str.3, %entry ], [ @.str.2, %if.then ], [ @.str.2, %if.else ], [ @.str.3, %for.inc ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn 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 allocsize(0) }
attributes #8 = { 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"}
|
#include<stdio.h>
int main(void){
int a,b;
scanf("%d%d",&a,&b);
char s[12];
for(int i=0;i<12;i++){
scanf("%s",&s[i]);
}
//printf("%s",s);
if(s[a]=='-'){
for(int i=0;i<12;i++){
if(i==a){
i++;
}
if(s[i]=='-'){
puts("No");
return 0;
}
}
}else{
puts("No");
return 0;
}
puts("Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103120/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103120/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%s = alloca [12 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %s) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%arrayidx.1 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 1
%call1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 2
%call1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 3
%call1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.3)
%arrayidx.4 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 4
%call1.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.4)
%arrayidx.5 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 5
%call1.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.5)
%arrayidx.6 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 6
%call1.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.6)
%arrayidx.7 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 7
%call1.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.7)
%arrayidx.8 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 8
%call1.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.8)
%arrayidx.9 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 9
%call1.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.9)
%arrayidx.10 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 10
%call1.10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.10)
%arrayidx.11 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 11
%call1.11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.11)
%0 = load i32, ptr %a, align 4, !tbaa !5
%idxprom2 = sext i32 %0 to i64
%arrayidx3 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %idxprom2
%1 = load i8, ptr %arrayidx3, align 1, !tbaa !9
%cmp4 = icmp eq i8 %1, 45
br i1 %cmp4, label %for.body11, label %cleanup30
for.cond7: ; preds = %for.body11
%inc25 = add nsw i32 %spec.select, 1
%cmp8 = icmp sgt i32 %spec.select, 10
br i1 %cmp8, label %cleanup30, label %for.body11, !llvm.loop !10
for.body11: ; preds = %entry, %for.cond7
%i6.040 = phi i32 [ %inc25, %for.cond7 ], [ 0, %entry ]
%cmp12 = icmp eq i32 %i6.040, %0
%inc15 = zext i1 %cmp12 to i32
%spec.select = add nsw i32 %i6.040, %inc15
%idxprom16 = sext i32 %spec.select to i64
%arrayidx17 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %idxprom16
%2 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%cmp19 = icmp eq i8 %2, 45
br i1 %cmp19, label %cleanup30, label %for.cond7
cleanup30: ; preds = %for.cond7, %for.body11, %entry
%.str.2.sink = phi ptr [ @.str.2, %entry ], [ @.str.2, %for.body11 ], [ @.str.3, %for.cond7 ]
%call22 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %s) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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>
int main(void){
int A,B;
scanf("%d",&A);
scanf("%d",&B);
char S[A+B+2];
int i;
scanf("%s",&S);
int flag = 0;
for(i=0;i<=A+B;i++){
if(i==A){
if(S[i] == '-'){flag=0;}
else {flag=1; break;}
}
if(i != A){
if(S[i] != '-') flag=0;
else {flag=1; break;}
}
}
if(flag==1) printf("No");
else printf("Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103164/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103164/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add i32 %0, 2
%add2 = add i32 %add, %1
%2 = zext i32 %add2 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %2, align 16
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%4 = load i32, ptr %A, align 4, !tbaa !5
%5 = load i32, ptr %B, align 4, !tbaa !5
%add4 = add i32 %5, %4
%cmp.not.not34 = icmp slt i32 %add4, 0
br i1 %cmp.not.not34, label %if.end28, label %for.body.preheader
for.body.preheader: ; preds = %entry
%6 = zext i32 %4 to i64
%7 = add nuw i32 %add4, 1
%wide.trip.count = zext i32 %7 to i64
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %6
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 ]
%cmp5 = icmp eq i64 %indvars.iv, %6
br i1 %cmp5, label %if.then, label %if.then12
if.then: ; preds = %for.body
%8 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp6 = icmp eq i8 %8, 45
br i1 %cmp6, label %for.inc, label %if.end28
if.then12: ; preds = %for.body
%arrayidx14 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%9 = load i8, ptr %arrayidx14, align 1, !tbaa !9
%cmp16.not = icmp eq i8 %9, 45
br i1 %cmp16.not, label %if.end28, label %for.inc
for.inc: ; preds = %if.then, %if.then12
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %if.end28, label %for.body, !llvm.loop !10
if.end28: ; preds = %for.inc, %if.then12, %if.then, %entry
%.str.3.sink = phi ptr [ @.str.3, %entry ], [ @.str.2, %if.then ], [ @.str.2, %if.then12 ], [ @.str.3, %for.inc ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void){
int i,j,k,n,s;
char ca[201],can[201];
while(1){
scanf("%s\n%d", ca, &n);
if(!strcmp(ca, "-")) break;
for(i=0;i<n;i++){
scanf("%d", &s);
for(j=s;ca[j]!='\0';j++)
can[j-s] = ca[j];
for(k=0;k<s;k++)
can[j-s+k] = ca[k];
for(j=0;ca[j]!='\0';j++)
ca[j] = can[j];
}
printf("%s\n", ca);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103250/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103250/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%s\0A%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca i32, align 4
%ca = alloca [201 x i8], align 16
%can = alloca [201 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %ca) #4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %can) #4
%call68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ca, ptr noundef nonnull %n)
%lhsv69 = load i16, ptr %ca, align 16
%.not70 = icmp eq i16 %lhsv69, 45
br i1 %.not70, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end40
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body, label %for.end40
for.body: ; preds = %for.cond.preheader, %for.inc38
%i.067 = phi i32 [ %inc39, %for.inc38 ], [ 0, %for.cond.preheader ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %s)
%1 = load i32, ptr %s, align 4, !tbaa !5
%idxprom56 = sext i32 %1 to i64
%arrayidx57 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %idxprom56
%2 = load i8, ptr %arrayidx57, align 1, !tbaa !9
%cmp5.not58 = icmp eq i8 %2, 0
br i1 %cmp5.not58, label %for.cond12.preheader, label %for.body7
for.cond12.preheader.loopexit: ; preds = %for.body7
%3 = trunc i64 %indvars.iv.next to i32
br label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.cond12.preheader.loopexit, %for.body
%j.0.lcssa = phi i32 [ %1, %for.body ], [ %3, %for.cond12.preheader.loopexit ]
%cmp1360 = icmp sgt i32 %1, 0
br i1 %cmp1360, label %iter.check, label %for.cond24.preheader
iter.check: ; preds = %for.cond12.preheader
%sub18 = sub i32 %j.0.lcssa, %1
%4 = sext i32 %sub18 to i64
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 8
br i1 %min.iters.check, label %for.body15.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check79 = icmp ult i32 %1, 32
br i1 %min.iters.check79, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %wide.trip.count, 4294967264
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%5 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %index
%wide.load = load <16 x i8>, ptr %5, align 16, !tbaa !9
%6 = getelementptr inbounds i8, ptr %5, i64 16
%wide.load80 = load <16 x i8>, ptr %6, align 16, !tbaa !9
%7 = add nsw i64 %index, %4
%8 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %7
store <16 x i8> %wide.load, ptr %8, align 1, !tbaa !9
%9 = getelementptr inbounds i8, ptr %8, i64 16
store <16 x i8> %wide.load80, ptr %9, align 1, !tbaa !9
%index.next = add nuw i64 %index, 32
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond24.preheader, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %wide.trip.count, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body15.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.vec82 = and i64 %wide.trip.count, 4294967288
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index84 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next86, %vec.epilog.vector.body ]
%11 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %index84
%wide.load85 = load <8 x i8>, ptr %11, align 8, !tbaa !9
%12 = add nsw i64 %index84, %4
%13 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %12
store <8 x i8> %wide.load85, ptr %13, align 1, !tbaa !9
%index.next86 = add nuw i64 %index84, 8
%14 = icmp eq i64 %index.next86, %n.vec82
br i1 %14, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !14
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n83 = icmp eq i64 %n.vec82, %wide.trip.count
br i1 %cmp.n83, label %for.cond24.preheader, label %for.body15.preheader
for.body15.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv72.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec82, %vec.epilog.middle.block ]
br label %for.body15
for.body7: ; preds = %for.body, %for.body7
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ %idxprom56, %for.body ]
%15 = phi i8 [ %17, %for.body7 ], [ %2, %for.body ]
%16 = sub nsw i64 %indvars.iv, %idxprom56
%arrayidx11 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %16
store i8 %15, ptr %arrayidx11, align 1, !tbaa !9
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %indvars.iv.next
%17 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp5.not = icmp eq i8 %17, 0
br i1 %cmp5.not, label %for.cond12.preheader.loopexit, label %for.body7, !llvm.loop !15
for.cond24.preheader: ; preds = %for.body15, %middle.block, %vec.epilog.middle.block, %for.cond12.preheader
%18 = load i8, ptr %ca, align 16, !tbaa !9
%cmp28.not62 = icmp eq i8 %18, 0
br i1 %cmp28.not62, label %for.inc38, label %for.body30
for.body15: ; preds = %for.body15.preheader, %for.body15
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.body15 ], [ %indvars.iv72.ph, %for.body15.preheader ]
%arrayidx17 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %indvars.iv72
%19 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%20 = add nsw i64 %indvars.iv72, %4
%arrayidx20 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %20
store i8 %19, ptr %arrayidx20, align 1, !tbaa !9
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%exitcond.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count
br i1 %exitcond.not, label %for.cond24.preheader, label %for.body15, !llvm.loop !16
for.body30: ; preds = %for.cond24.preheader, %for.body30
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body30 ], [ 0, %for.cond24.preheader ]
%arrayidx2665 = phi ptr [ %arrayidx26, %for.body30 ], [ %ca, %for.cond24.preheader ]
%arrayidx32 = getelementptr inbounds [201 x i8], ptr %can, i64 0, i64 %indvars.iv76
%21 = load i8, ptr %arrayidx32, align 1, !tbaa !9
store i8 %21, ptr %arrayidx2665, align 1, !tbaa !9
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%arrayidx26 = getelementptr inbounds [201 x i8], ptr %ca, i64 0, i64 %indvars.iv.next77
%22 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%cmp28.not = icmp eq i8 %22, 0
br i1 %cmp28.not, label %for.inc38, label %for.body30, !llvm.loop !17
for.inc38: ; preds = %for.body30, %for.cond24.preheader
%inc39 = add nuw nsw i32 %i.067, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc39, %23
br i1 %cmp, label %for.body, label %for.end40, !llvm.loop !18
for.end40: ; preds = %for.inc38, %for.cond.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %ca)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ca, ptr noundef nonnull %n)
%lhsv = load i16, ptr %ca, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end40, %entry
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %can) #4
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %ca) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !12, !13}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11, !13, !12}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
|
#include<stdio.h>
#include<string.h>
int main(void)
{
char str[201],temp[201]={};
int m,i,sh;
size_t len;
for( ; ; ){
scanf("%s",&str);
if(str[0] == '-'){break;}
scanf("%d",&m);
for(i=0;i<m;i++)
{
memset(temp,0,201*sizeof(char));
scanf("%d",&sh);
len= sh*sizeof(char);
strncpy(temp,str,len);
strcpy(str,str+len);
strcat(str,temp);
}
printf("%s\n",str);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103294/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103294/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [201 x i8], align 16
%temp = alloca [201 x i8], align 16
%m = alloca i32, align 4
%sh = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %str) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %temp) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %temp, i8 0, i64 201, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sh) #6
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp25 = icmp eq i8 %0, 45
br i1 %cmp25, label %for.end19, label %if.end
if.end: ; preds = %entry, %for.end
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !8
%cmp422 = icmp sgt i32 %1, 0
br i1 %cmp422, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%i.023 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %temp, i8 0, i64 201, i1 false)
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %sh)
%2 = load i32, ptr %sh, align 4, !tbaa !8
%conv7 = sext i32 %2 to i64
%call10 = call ptr @strncpy(ptr noundef nonnull %temp, ptr noundef nonnull %str, i64 noundef %conv7) #6
%add.ptr = getelementptr inbounds i8, ptr %str, i64 %conv7
%call13 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %add.ptr) #6
%call16 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %temp) #6
%inc = add nuw nsw i32 %i.023, 1
%3 = load i32, ptr %m, align 4, !tbaa !8
%cmp4 = icmp slt i32 %inc, %3
br i1 %cmp4, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%4 = load i8, ptr %str, align 16, !tbaa !5
%cmp = icmp eq i8 %4, 45
br i1 %cmp, label %for.end19, label %if.end
for.end19: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sh) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %temp) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %str) #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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 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 #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void){
char word[210],temp[210];
int i,j,snum,num,leng;
while(1){
scanf("%s",word);
leng=strlen(word);
if(word[0]=='-') break;
scanf("%d",&snum);
for(i=0;i<snum;i++){
scanf("%d",&num);
for(j=0;j<num;j++) temp[j]=word[j];
for(j=num;word[j]!='\0';j++){
word[j-num]=word[j];
}
for(j=0;j<num;j++){
word[leng-num+j]=temp[j];
}
}
printf("%s\n",word);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103344/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%word = alloca [210 x i8], align 16
%temp = alloca [210 x i8], align 16
%snum = alloca i32, align 4
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 210, ptr nonnull %word) #6
call void @llvm.lifetime.start.p0(i64 210, ptr nonnull %temp) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %snum) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6
%call70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %word)
%0 = load i8, ptr %word, align 16, !tbaa !5
%cmp73 = icmp eq i8 %0, 45
br i1 %cmp73, label %while.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%call271 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %word) #7
br label %if.end
if.end: ; preds = %if.end.preheader, %for.end44
%conv74.in = phi i64 [ %call2, %for.end44 ], [ %call271, %if.end.preheader ]
%conv74 = trunc i64 %conv74.in to i32
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %snum)
%1 = load i32, ptr %snum, align 4, !tbaa !8
%cmp668 = icmp sgt i32 %1, 0
br i1 %cmp668, label %for.body, label %for.end44
for.body: ; preds = %if.end, %for.inc42
%i.069 = phi i32 [ %inc43, %for.inc42 ], [ 0, %if.end ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num)
%2 = load i32, ptr %num, align 4, !tbaa !8
%cmp1060 = icmp sgt i32 %2, 0
br i1 %cmp1060, label %for.body12.preheader, label %for.cond16.preheader
for.body12.preheader: ; preds = %for.body
%3 = zext i32 %2 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %temp, ptr nonnull align 16 %word, i64 %3, i1 false), !tbaa !5
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.body12.preheader, %for.body
%idxprom1762 = sext i32 %2 to i64
%arrayidx1863 = getelementptr inbounds [210 x i8], ptr %word, i64 0, i64 %idxprom1762
%4 = load i8, ptr %arrayidx1863, align 1, !tbaa !5
%cmp20.not64 = icmp eq i8 %4, 0
br i1 %cmp20.not64, label %for.cond30.preheader, label %for.body22
for.cond30.preheader: ; preds = %for.body22, %for.cond16.preheader
br i1 %cmp1060, label %iter.check, label %for.inc42
iter.check: ; preds = %for.cond30.preheader
%sub36 = sub i32 %conv74, %2
%5 = sext i32 %sub36 to i64
%wide.trip.count = zext i32 %2 to i64
%min.iters.check = icmp ult i32 %2, 8
br i1 %min.iters.check, label %for.body33.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check81 = icmp ult i32 %2, 32
br i1 %min.iters.check81, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %wide.trip.count, 4294967264
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%6 = getelementptr inbounds [210 x i8], ptr %temp, i64 0, i64 %index
%wide.load = load <16 x i8>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i8, ptr %6, i64 16
%wide.load82 = load <16 x i8>, ptr %7, align 16, !tbaa !5
%8 = add nsw i64 %index, %5
%9 = getelementptr inbounds [210 x i8], ptr %word, i64 0, i64 %8
store <16 x i8> %wide.load, ptr %9, align 1, !tbaa !5
%10 = getelementptr inbounds i8, ptr %9, i64 16
store <16 x i8> %wide.load82, ptr %10, align 1, !tbaa !5
%index.next = add nuw i64 %index, 32
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.inc42, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %wide.trip.count, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body33.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.vec84 = and i64 %wide.trip.count, 4294967288
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index86 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next88, %vec.epilog.vector.body ]
%12 = getelementptr inbounds [210 x i8], ptr %temp, i64 0, i64 %index86
%wide.load87 = load <8 x i8>, ptr %12, align 8, !tbaa !5
%13 = add nsw i64 %index86, %5
%14 = getelementptr inbounds [210 x i8], ptr %word, i64 0, i64 %13
store <8 x i8> %wide.load87, ptr %14, align 1, !tbaa !5
%index.next88 = add nuw i64 %index86, 8
%15 = icmp eq i64 %index.next88, %n.vec84
br i1 %15, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !14
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n85 = icmp eq i64 %n.vec84, %wide.trip.count
br i1 %cmp.n85, label %for.inc42, label %for.body33.preheader
for.body33.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv77.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec84, %vec.epilog.middle.block ]
br label %for.body33
for.body22: ; preds = %for.cond16.preheader, %for.body22
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body22 ], [ %idxprom1762, %for.cond16.preheader ]
%16 = phi i8 [ %18, %for.body22 ], [ %4, %for.cond16.preheader ]
%17 = sub nsw i64 %indvars.iv, %idxprom1762
%arrayidx26 = getelementptr inbounds [210 x i8], ptr %word, i64 0, i64 %17
store i8 %16, ptr %arrayidx26, align 1, !tbaa !5
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx18 = getelementptr inbounds [210 x i8], ptr %word, i64 0, i64 %indvars.iv.next
%18 = load i8, ptr %arrayidx18, align 1, !tbaa !5
%cmp20.not = icmp eq i8 %18, 0
br i1 %cmp20.not, label %for.cond30.preheader, label %for.body22, !llvm.loop !15
for.body33: ; preds = %for.body33.preheader, %for.body33
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body33 ], [ %indvars.iv77.ph, %for.body33.preheader ]
%arrayidx35 = getelementptr inbounds [210 x i8], ptr %temp, i64 0, i64 %indvars.iv77
%19 = load i8, ptr %arrayidx35, align 1, !tbaa !5
%20 = add nsw i64 %indvars.iv77, %5
%arrayidx38 = getelementptr inbounds [210 x i8], ptr %word, i64 0, i64 %20
store i8 %19, ptr %arrayidx38, align 1, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%exitcond.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count
br i1 %exitcond.not, label %for.inc42, label %for.body33, !llvm.loop !16
for.inc42: ; preds = %for.body33, %middle.block, %vec.epilog.middle.block, %for.cond30.preheader
%inc43 = add nuw nsw i32 %i.069, 1
%21 = load i32, ptr %snum, align 4, !tbaa !8
%cmp6 = icmp slt i32 %inc43, %21
br i1 %cmp6, label %for.body, label %for.end44, !llvm.loop !17
for.end44: ; preds = %for.inc42, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %word)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %word)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %word) #7
%22 = load i8, ptr %word, align 16, !tbaa !5
%cmp = icmp eq i8 %22, 45
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end44, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %snum) #6
call void @llvm.lifetime.end.p0(i64 210, ptr nonnull %temp) #6
call void @llvm.lifetime.end.p0(i64 210, ptr nonnull %word) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !12, !13}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11, !13, !12}
!17 = distinct !{!17, !11}
|
#include <stdio.h>
#include <string.h>
int main() {
char s[201], t[201], u[201];
int i, j, k, m, h;
while(1) {
scanf("%s", s);
if (s[0] == '-') break;
scanf("%d", &m);
for (i=0; i<m; i++) {
scanf("%d", &h);
for (j=0; j<h; j++) {
t[j] = s[j];
}
t[h] = '\0';
for (k=0; k<strlen(s)-h; k++) {
u[k] = s[h+k];
}
u[strlen(s)-h] = '\0';
strcat(u, t);
strcpy(s, u);
}
printf("%s\n", s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103388/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [201 x i8], align 16
%t = alloca [201 x i8], align 16
%u = alloca [201 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %s) #7
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %t) #7
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %u) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #7
%call61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp62 = icmp eq i8 %0, 45
br i1 %cmp62, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end43
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !8
%cmp359 = icmp sgt i32 %1, 0
br i1 %cmp359, label %for.body, label %for.end43
for.body: ; preds = %if.end, %for.end29
%i.060 = phi i32 [ %inc42, %for.end29 ], [ 0, %if.end ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%2 = load i32, ptr %h, align 4, !tbaa !8
%cmp753 = icmp sgt i32 %2, 0
br i1 %cmp753, label %for.body9.preheader, label %for.end
for.body9.preheader: ; preds = %for.body
%3 = zext i32 %2 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %t, ptr nonnull align 16 %s, i64 %3, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body9.preheader, %for.body
%idxprom13 = sext i32 %2 to i64
%arrayidx14 = getelementptr inbounds [201 x i8], ptr %t, i64 0, i64 %idxprom13
store i8 0, ptr %arrayidx14, align 1, !tbaa !5
%call18 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #8
%sub = sub i64 %call18, %idxprom13
%cmp2055.not = icmp eq i64 %call18, %idxprom13
br i1 %cmp2055.not, label %for.end29, label %for.body22.preheader
for.body22.preheader: ; preds = %for.end
%scevgep = getelementptr i8, ptr %s, i64 %idxprom13
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %u, ptr align 1 %scevgep, i64 %sub, i1 false), !tbaa !5
br label %for.end29
for.end29: ; preds = %for.body22.preheader, %for.end
%arrayidx34 = getelementptr inbounds [201 x i8], ptr %u, i64 0, i64 %sub
store i8 0, ptr %arrayidx34, align 1, !tbaa !5
%call37 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %u, ptr noundef nonnull dereferenceable(1) %t) #7
%call40 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) %u) #7
%inc42 = add nuw nsw i32 %i.060, 1
%4 = load i32, ptr %m, align 4, !tbaa !8
%cmp3 = icmp slt i32 %inc42, %4
br i1 %cmp3, label %for.body, label %for.end43, !llvm.loop !10
for.end43: ; preds = %for.end29, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%5 = load i8, ptr %s, align 16, !tbaa !5
%cmp = icmp eq i8 %5, 45
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end43, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %t) #7
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %s) #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 memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) 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 #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
void Shuffle(char[]);
int main ()
{
while(1)
{
char word[201];
char end[] = "-"; //??????????????¨
int i = 0 ;
int N = 0 ; //???????????°
int sum = 0 ;
int num = 0 ;
scanf("%s",word); //??????????????????
if(!strcmp(word,end))
{
return 0;
}
scanf("%d",&N); //?????????????????????
sum = 0 ; //????¨????????????????
for( i = 0 ; i < N ; i++ )
{
scanf("%d",&num);
sum += num ;
}
for( i = 0 ; i < sum ; i++)
{
Shuffle(word); //sum???shuffle??????
}
printf("%s\n", word); //????????¨???
}
return 0;
}
void Shuffle(char line[])
{
char tmp = line[0];
int i = 0 ;
for( i = 0 ; i < strlen(line)-1 ; i++)
{
line[i] = line[i+1];
}
line[strlen(line)-1] = tmp;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103430/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103430/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%word = alloca [201 x i8], align 16
%N = alloca i32, align 4
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %word) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
store i32 0, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6
store i32 0, ptr %num, align 4, !tbaa !5
%call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %word)
%lhsv34 = load i16, ptr %word, align 16
%.not.not35 = icmp eq i16 %lhsv34, 45
br i1 %.not.not35, label %return, label %if.end
if.end: ; preds = %entry, %cleanup
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body, label %cleanup
for.cond6.preheader: ; preds = %for.body
%cmp729 = icmp sgt i32 %add, 0
br i1 %cmp729, label %for.body8, label %cleanup
for.body: ; preds = %if.end, %for.body
%sum.028 = phi i32 [ %add, %for.body ], [ 0, %if.end ]
%i.027 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num)
%1 = load i32, ptr %num, align 4, !tbaa !5
%add = add nsw i32 %1, %sum.028
%inc = add nuw nsw i32 %i.027, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.body8: ; preds = %for.cond6.preheader, %Shuffle.exit
%i.130 = phi i32 [ %inc11, %Shuffle.exit ], [ 0, %for.cond6.preheader ]
%3 = load i8, ptr %word, align 16, !tbaa !11
%call16.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %word) #7
%cmp18.not.i = icmp eq i64 %call16.i, 1
br i1 %cmp18.not.i, label %Shuffle.exit, label %for.body.i
for.body.i: ; preds = %for.body8, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 0, %for.body8 ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx2.i = getelementptr inbounds i8, ptr %word, i64 %indvars.iv.next.i
%4 = load i8, ptr %arrayidx2.i, align 1, !tbaa !11
%arrayidx4.i = getelementptr inbounds i8, ptr %word, i64 %indvars.iv.i
store i8 %4, ptr %arrayidx4.i, align 1, !tbaa !11
%call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %word) #7
%sub.i = add i64 %call.i, -1
%cmp.i = icmp ugt i64 %sub.i, %indvars.iv.next.i
br i1 %cmp.i, label %for.body.i, label %Shuffle.exit, !llvm.loop !12
Shuffle.exit: ; preds = %for.body.i, %for.body8
%sub.lcssa.i = phi i64 [ 0, %for.body8 ], [ %sub.i, %for.body.i ]
%arrayidx7.i = getelementptr inbounds i8, ptr %word, i64 %sub.lcssa.i
store i8 %3, ptr %arrayidx7.i, align 1, !tbaa !11
%inc11 = add nuw nsw i32 %i.130, 1
%exitcond.not = icmp eq i32 %inc11, %add
br i1 %exitcond.not, label %cleanup, label %for.body8, !llvm.loop !13
cleanup: ; preds = %Shuffle.exit, %if.end, %for.cond6.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %word)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %word) #6
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %word) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
store i32 0, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6
store i32 0, ptr %num, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %word)
%lhsv = load i16, ptr %word, align 16
%.not.not = icmp eq i16 %lhsv, 45
br i1 %.not.not, label %return, label %if.end
return: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %word) #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 nounwind memory(argmem: readwrite) uwtable
define dso_local void @Shuffle(ptr nocapture noundef %line) local_unnamed_addr #3 {
entry:
%0 = load i8, ptr %line, align 1, !tbaa !11
%call16 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %line) #7
%cmp18.not = icmp eq i64 %call16, 1
br i1 %cmp18.not, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds i8, ptr %line, i64 %indvars.iv.next
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !11
%arrayidx4 = getelementptr inbounds i8, ptr %line, i64 %indvars.iv
store i8 %1, ptr %arrayidx4, align 1, !tbaa !11
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %line) #7
%sub = add i64 %call, -1
%cmp = icmp ugt i64 %sub, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%sub.lcssa = phi i64 [ 0, %entry ], [ %sub, %for.body ]
%arrayidx7 = getelementptr inbounds i8, ptr %line, i64 %sub.lcssa
store i8 %0, ptr %arrayidx7, align 1, !tbaa !11
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(int argc, char *args[])
{
char string_a[2][201];
int length;
int m;
int i,j;
int h;
int offset;
while(1) {
offset = 0;
scanf("%s", string_a[0]);
if( string_a[0][0] == '-' ) break;
length=0;
while( string_a[0][length] != 0 ) {
length++;
}
scanf("%d", &m);
for( i=0; i<m; i++ ) {
scanf("%d", &h);
for( j=0; j<length-h; j++ ) {
string_a[offset^1][j] = string_a[offset][h+j];
}
for( j=0; j<h; j++ ) {
string_a[offset^1][length-h+j] = string_a[offset][j];
}
string_a[offset^1][length] = 0;
offset = offset ^ 1;
}
printf("%s\n", string_a[offset]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103474/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103474/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %args) local_unnamed_addr #0 {
entry:
%string_a = alloca [2 x [201 x i8]], align 16
%string_a103 = ptrtoint ptr %string_a to i64
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 402, ptr nonnull %string_a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
%call86 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %string_a)
%0 = load i8, ptr %string_a, align 16, !tbaa !5
%cmp87 = icmp eq i8 %0, 45
br i1 %cmp87, label %while.end59, label %while.cond4
while.cond4: ; preds = %entry, %while.cond4.backedge
%indvars.iv94 = phi i32 [ %indvars.iv94.be, %while.cond4.backedge ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.be, %while.cond4.backedge ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [201 x i8], ptr %string_a, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp8.not = icmp eq i8 %1, 0
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next95 = add nuw i32 %indvars.iv94, 1
br i1 %cmp8.not, label %while.end, label %while.cond4.backedge
while.cond4.backedge: ; preds = %while.cond4, %for.end54
%indvars.iv94.be = phi i32 [ %indvars.iv.next95, %while.cond4 ], [ 0, %for.end54 ]
%indvars.iv.be = phi i64 [ %indvars.iv.next, %while.cond4 ], [ 0, %for.end54 ]
br label %while.cond4, !llvm.loop !8
while.end: ; preds = %while.cond4
%2 = trunc i64 %indvars.iv to i32
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%3 = load i32, ptr %m, align 4, !tbaa !10
%cmp1283 = icmp sgt i32 %3, 0
br i1 %cmp1283, label %for.body, label %for.end54
for.body: ; preds = %while.end, %for.end45
%offset.085 = phi i32 [ %xor46.pre-phi, %for.end45 ], [ 0, %while.end ]
%i.084 = phi i32 [ %inc53, %for.end45 ], [ 0, %while.end ]
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%4 = load i32, ptr %h, align 4, !tbaa !10
%sub = sub nsw i32 %2, %4
%cmp1678 = icmp sgt i32 %sub, 0
br i1 %cmp1678, label %iter.check117, label %for.cond28.preheader
iter.check117: ; preds = %for.body
%idxprom19 = zext i32 %offset.085 to i64
%xor = xor i32 %offset.085, 1
%idxprom23 = zext i32 %xor to i64
%5 = sext i32 %4 to i64
%6 = sub i32 %indvars.iv94, %4
%wide.trip.count = zext i32 %6 to i64
%min.iters.check115 = icmp ult i32 %6, 8
br i1 %min.iters.check115, label %for.body18.preheader, label %vector.memcheck112
vector.memcheck112: ; preds = %iter.check117
%7 = mul nuw nsw i64 %idxprom23, 201
%8 = add nuw i64 %7, %string_a103
%9 = mul nuw nsw i64 %idxprom19, 201
%10 = add i64 %9, %string_a103
%11 = add i64 %10, %5
%12 = sub i64 %8, %11
%diff.check113 = icmp ult i64 %12, 32
br i1 %diff.check113, label %for.body18.preheader, label %vector.main.loop.iter.check119
vector.main.loop.iter.check119: ; preds = %vector.memcheck112
%min.iters.check118 = icmp ult i32 %6, 32
br i1 %min.iters.check118, label %vec.epilog.ph131, label %vector.ph120
vector.ph120: ; preds = %vector.main.loop.iter.check119
%n.vec122 = and i64 %wide.trip.count, 4294967264
br label %vector.body124
vector.body124: ; preds = %vector.body124, %vector.ph120
%index = phi i64 [ 0, %vector.ph120 ], [ %index.next127, %vector.body124 ]
%13 = add nsw i64 %index, %5
%14 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom19, i64 %13
%wide.load125 = load <16 x i8>, ptr %14, align 1, !tbaa !5
%15 = getelementptr inbounds i8, ptr %14, i64 16
%wide.load126 = load <16 x i8>, ptr %15, align 1, !tbaa !5
%16 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom23, i64 %index
store <16 x i8> %wide.load125, ptr %16, align 1, !tbaa !5
%17 = getelementptr inbounds i8, ptr %16, i64 16
store <16 x i8> %wide.load126, ptr %17, align 1, !tbaa !5
%index.next127 = add nuw i64 %index, 32
%18 = icmp eq i64 %index.next127, %n.vec122
br i1 %18, label %middle.block114, label %vector.body124, !llvm.loop !12
middle.block114: ; preds = %vector.body124
%cmp.n123 = icmp eq i64 %n.vec122, %wide.trip.count
br i1 %cmp.n123, label %for.cond28.preheader, label %vec.epilog.iter.check130
vec.epilog.iter.check130: ; preds = %middle.block114
%n.vec.remaining132 = and i64 %wide.trip.count, 24
%min.epilog.iters.check133 = icmp eq i64 %n.vec.remaining132, 0
br i1 %min.epilog.iters.check133, label %for.body18.preheader, label %vec.epilog.ph131
vec.epilog.ph131: ; preds = %vector.main.loop.iter.check119, %vec.epilog.iter.check130
%vec.epilog.resume.val134 = phi i64 [ %n.vec122, %vec.epilog.iter.check130 ], [ 0, %vector.main.loop.iter.check119 ]
%n.vec136 = and i64 %wide.trip.count, 4294967288
br label %vec.epilog.vector.body139
vec.epilog.vector.body139: ; preds = %vec.epilog.vector.body139, %vec.epilog.ph131
%index140 = phi i64 [ %vec.epilog.resume.val134, %vec.epilog.ph131 ], [ %index.next142, %vec.epilog.vector.body139 ]
%19 = add nsw i64 %index140, %5
%20 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom19, i64 %19
%wide.load141 = load <8 x i8>, ptr %20, align 1, !tbaa !5
%21 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom23, i64 %index140
store <8 x i8> %wide.load141, ptr %21, align 1, !tbaa !5
%index.next142 = add nuw i64 %index140, 8
%22 = icmp eq i64 %index.next142, %n.vec136
br i1 %22, label %vec.epilog.middle.block128, label %vec.epilog.vector.body139, !llvm.loop !15
vec.epilog.middle.block128: ; preds = %vec.epilog.vector.body139
%cmp.n138 = icmp eq i64 %n.vec136, %wide.trip.count
br i1 %cmp.n138, label %for.cond28.preheader, label %for.body18.preheader
for.body18.preheader: ; preds = %vector.memcheck112, %iter.check117, %vec.epilog.iter.check130, %vec.epilog.middle.block128
%indvars.iv90.ph = phi i64 [ 0, %iter.check117 ], [ 0, %vector.memcheck112 ], [ %n.vec122, %vec.epilog.iter.check130 ], [ %n.vec136, %vec.epilog.middle.block128 ]
%xtraiter = and i64 %wide.trip.count, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body18.prol.loopexit, label %for.body18.prol
for.body18.prol: ; preds = %for.body18.preheader
%23 = add nsw i64 %indvars.iv90.ph, %5
%arrayidx22.prol = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom19, i64 %23
%24 = load i8, ptr %arrayidx22.prol, align 1, !tbaa !5
%arrayidx26.prol = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom23, i64 %indvars.iv90.ph
store i8 %24, ptr %arrayidx26.prol, align 1, !tbaa !5
%indvars.iv.next91.prol = or i64 %indvars.iv90.ph, 1
br label %for.body18.prol.loopexit
for.body18.prol.loopexit: ; preds = %for.body18.prol, %for.body18.preheader
%indvars.iv90.unr = phi i64 [ %indvars.iv90.ph, %for.body18.preheader ], [ %indvars.iv.next91.prol, %for.body18.prol ]
%25 = sub nsw i64 0, %wide.trip.count
%26 = xor i64 %indvars.iv90.ph, %25
%27 = icmp eq i64 %26, -1
br i1 %27, label %for.cond28.preheader, label %for.body18
for.cond28.preheader: ; preds = %for.body18.prol.loopexit, %for.body18, %middle.block114, %vec.epilog.middle.block128, %for.body
%cmp2981 = icmp sgt i32 %4, 0
br i1 %cmp2981, label %iter.check, label %for.cond28.preheader.for.end45_crit_edge
for.cond28.preheader.for.end45_crit_edge: ; preds = %for.cond28.preheader
%.pre = xor i32 %offset.085, 1
%.pre102 = zext i32 %.pre to i64
br label %for.end45
iter.check: ; preds = %for.cond28.preheader
%idxprom32 = zext i32 %offset.085 to i64
%xor36 = xor i32 %offset.085, 1
%idxprom37 = zext i32 %xor36 to i64
%wide.trip.count100 = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body31.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %iter.check
%28 = add nsw i64 %wide.trip.count100, -1
%29 = trunc i64 %28 to i32
%30 = add i32 %sub, %29
%31 = icmp slt i32 %30, %sub
%32 = icmp ugt i64 %28, 4294967295
%33 = or i1 %31, %32
br i1 %33, label %for.body31.preheader, label %vector.memcheck
vector.memcheck: ; preds = %vector.scevcheck
%34 = mul nuw nsw i64 %idxprom37, 201
%35 = add i64 %34, %string_a103
%36 = sext i32 %sub to i64
%37 = add i64 %35, %36
%38 = mul nuw nsw i64 %idxprom32, 201
%39 = add i64 %38, %string_a103
%40 = sub i64 %37, %39
%diff.check = icmp ult i64 %40, 32
br i1 %diff.check, label %for.body31.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.memcheck
%min.iters.check104 = icmp ult i32 %4, 32
br i1 %min.iters.check104, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %wide.trip.count100, 4294967264
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%offset.idx = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%41 = trunc i64 %offset.idx to i32
%42 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom32, i64 %offset.idx
%wide.load = load <16 x i8>, ptr %42, align 1, !tbaa !5
%43 = getelementptr inbounds i8, ptr %42, i64 16
%wide.load105 = load <16 x i8>, ptr %43, align 1, !tbaa !5
%44 = add nsw i32 %sub, %41
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom37, i64 %45
store <16 x i8> %wide.load, ptr %46, align 1, !tbaa !5
%47 = getelementptr inbounds i8, ptr %46, i64 16
store <16 x i8> %wide.load105, ptr %47, align 1, !tbaa !5
%index.next = add nuw i64 %offset.idx, 32
%48 = icmp eq i64 %index.next, %n.vec
br i1 %48, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count100
br i1 %cmp.n, label %for.end45, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %wide.trip.count100, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body31.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.vec107 = and i64 %wide.trip.count100, 4294967288
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%offset.idx109 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next111, %vec.epilog.vector.body ]
%49 = trunc i64 %offset.idx109 to i32
%50 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom32, i64 %offset.idx109
%wide.load110 = load <8 x i8>, ptr %50, align 1, !tbaa !5
%51 = add nsw i32 %sub, %49
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom37, i64 %52
store <8 x i8> %wide.load110, ptr %53, align 1, !tbaa !5
%index.next111 = add nuw i64 %offset.idx109, 8
%54 = icmp eq i64 %index.next111, %n.vec107
br i1 %54, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !17
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n108 = icmp eq i64 %n.vec107, %wide.trip.count100
br i1 %cmp.n108, label %for.end45, label %for.body31.preheader
for.body31.preheader: ; preds = %vector.memcheck, %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv96.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec107, %vec.epilog.middle.block ]
%xtraiter143 = and i64 %wide.trip.count100, 1
%lcmp.mod144.not = icmp eq i64 %xtraiter143, 0
br i1 %lcmp.mod144.not, label %for.body31.prol.loopexit, label %for.body31.prol
for.body31.prol: ; preds = %for.body31.preheader
%indvars99.prol = trunc i64 %indvars.iv96.ph to i32
%arrayidx35.prol = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom32, i64 %indvars.iv96.ph
%55 = load i8, ptr %arrayidx35.prol, align 1, !tbaa !5
%add40.prol = add nsw i32 %sub, %indvars99.prol
%idxprom41.prol = sext i32 %add40.prol to i64
%arrayidx42.prol = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom37, i64 %idxprom41.prol
store i8 %55, ptr %arrayidx42.prol, align 1, !tbaa !5
%indvars.iv.next97.prol = or i64 %indvars.iv96.ph, 1
br label %for.body31.prol.loopexit
for.body31.prol.loopexit: ; preds = %for.body31.prol, %for.body31.preheader
%indvars.iv96.unr = phi i64 [ %indvars.iv96.ph, %for.body31.preheader ], [ %indvars.iv.next97.prol, %for.body31.prol ]
%56 = sub nsw i64 0, %wide.trip.count100
%57 = xor i64 %indvars.iv96.ph, %56
%58 = icmp eq i64 %57, -1
br i1 %58, label %for.end45, label %for.body31
for.body18: ; preds = %for.body18.prol.loopexit, %for.body18
%indvars.iv90 = phi i64 [ %indvars.iv.next91.1, %for.body18 ], [ %indvars.iv90.unr, %for.body18.prol.loopexit ]
%59 = add nsw i64 %indvars.iv90, %5
%arrayidx22 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom19, i64 %59
%60 = load i8, ptr %arrayidx22, align 1, !tbaa !5
%arrayidx26 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom23, i64 %indvars.iv90
store i8 %60, ptr %arrayidx26, align 1, !tbaa !5
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%61 = add nsw i64 %indvars.iv.next91, %5
%arrayidx22.1 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom19, i64 %61
%62 = load i8, ptr %arrayidx22.1, align 1, !tbaa !5
%arrayidx26.1 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom23, i64 %indvars.iv.next91
store i8 %62, ptr %arrayidx26.1, align 1, !tbaa !5
%indvars.iv.next91.1 = add nuw nsw i64 %indvars.iv90, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next91.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.cond28.preheader, label %for.body18, !llvm.loop !18
for.body31: ; preds = %for.body31.prol.loopexit, %for.body31
%indvars.iv96 = phi i64 [ %indvars.iv.next97.1, %for.body31 ], [ %indvars.iv96.unr, %for.body31.prol.loopexit ]
%indvars99 = trunc i64 %indvars.iv96 to i32
%arrayidx35 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom32, i64 %indvars.iv96
%63 = load i8, ptr %arrayidx35, align 1, !tbaa !5
%add40 = add nsw i32 %sub, %indvars99
%idxprom41 = sext i32 %add40 to i64
%arrayidx42 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom37, i64 %idxprom41
store i8 %63, ptr %arrayidx42, align 1, !tbaa !5
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%indvars99.1 = trunc i64 %indvars.iv.next97 to i32
%arrayidx35.1 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom32, i64 %indvars.iv.next97
%64 = load i8, ptr %arrayidx35.1, align 1, !tbaa !5
%add40.1 = add nsw i32 %sub, %indvars99.1
%idxprom41.1 = sext i32 %add40.1 to i64
%arrayidx42.1 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom37, i64 %idxprom41.1
store i8 %64, ptr %arrayidx42.1, align 1, !tbaa !5
%indvars.iv.next97.1 = add nuw nsw i64 %indvars.iv96, 2
%exitcond101.not.1 = icmp eq i64 %indvars.iv.next97.1, %wide.trip.count100
br i1 %exitcond101.not.1, label %for.end45, label %for.body31, !llvm.loop !19
for.end45: ; preds = %for.body31.prol.loopexit, %for.body31, %middle.block, %vec.epilog.middle.block, %for.cond28.preheader.for.end45_crit_edge
%idxprom47.pre-phi = phi i64 [ %.pre102, %for.cond28.preheader.for.end45_crit_edge ], [ %idxprom37, %vec.epilog.middle.block ], [ %idxprom37, %middle.block ], [ %idxprom37, %for.body31 ], [ %idxprom37, %for.body31.prol.loopexit ]
%xor46.pre-phi = phi i32 [ %.pre, %for.cond28.preheader.for.end45_crit_edge ], [ %xor36, %vec.epilog.middle.block ], [ %xor36, %middle.block ], [ %xor36, %for.body31 ], [ %xor36, %for.body31.prol.loopexit ]
%arrayidx50 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom47.pre-phi, i64 %indvars.iv
store i8 0, ptr %arrayidx50, align 1, !tbaa !5
%inc53 = add nuw nsw i32 %i.084, 1
%65 = load i32, ptr %m, align 4, !tbaa !10
%cmp12 = icmp slt i32 %inc53, %65
br i1 %cmp12, label %for.body, label %for.end54, !llvm.loop !20
for.end54: ; preds = %for.end45, %while.end
%offset.0.lcssa = phi i32 [ 0, %while.end ], [ %xor46.pre-phi, %for.end45 ]
%idxprom55 = zext i32 %offset.0.lcssa to i64
%arrayidx56 = getelementptr inbounds [2 x [201 x i8]], ptr %string_a, i64 0, i64 %idxprom55
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx56)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %string_a)
%66 = load i8, ptr %string_a, align 16, !tbaa !5
%cmp = icmp eq i8 %66, 45
br i1 %cmp, label %while.end59, label %while.cond4.backedge
while.end59: ; preds = %for.end54, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 402, ptr nonnull %string_a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !9, !13, !14}
!16 = distinct !{!16, !9, !13, !14}
!17 = distinct !{!17, !9, !13, !14}
!18 = distinct !{!18, !9, !13}
!19 = distinct !{!19, !9, !13}
!20 = distinct !{!20, !9}
|
#include<stdio.h>
#include<string.h>
int main(void){
int m, i, j, k, l, h, len, aft_len;
char str[201], *first, *last, str_first[200], str_last[200];
first = str;
last = str;
//シャッフルする文字列を、境界のインデックスで二つに分けてそれぞれを別の配列に保存する、という方法もアリかも
do{
scanf("%s\n", str);
if(str[0] == '-'){
break;
}
len = strlen(str);
scanf("%d\n", &m);
for(i = 0; i < m; i++){
scanf("%d\n", &h);
last += h;
aft_len = len-h;
strncpy(str_first, first, h);
strncpy(str_last, last, aft_len);
for(j = 0; j < aft_len; j++){
str[j] = str_last[j];
}
for(k = aft_len, l = 0; k < len; k++, l++){
str[k] = str_first[l];
}
last = str;
}
printf("%s\n", str);
}while (1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103524/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103524/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\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:
%m = alloca i32, align 4
%h = alloca i32, align 4
%str = alloca [201 x i8], align 16
%str_first = alloca [200 x i8], align 16
%str_last = alloca [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #8
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %str) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %str_first) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %str_last) #8
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp61 = icmp eq i8 %0, 45
br i1 %cmp61, label %do.end, label %if.end
if.end: ; preds = %entry, %for.end39
%call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #9
%conv6 = trunc i64 %call5 to i32
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !8
%cmp858 = icmp sgt i32 %1, 0
br i1 %cmp858, label %for.body.preheader, label %for.end39
for.body.preheader: ; preds = %if.end
%2 = xor i32 %conv6, -1
%3 = add i32 %conv6, 1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.end35
%i.059 = phi i32 [ %inc38, %for.end35 ], [ 0, %for.body.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%4 = load i32, ptr %h, align 4, !tbaa !8
%idx.ext = sext i32 %4 to i64
%add.ptr = getelementptr inbounds i8, ptr %str, i64 %idx.ext
%sub = sub nsw i32 %conv6, %4
%call13 = call ptr @strncpy(ptr noundef nonnull %str_first, ptr noundef nonnull %str, i64 noundef %idx.ext) #8
%conv15 = sext i32 %sub to i64
%call16 = call ptr @strncpy(ptr noundef nonnull %str_last, ptr noundef nonnull %add.ptr, i64 noundef %conv15) #8
%cmp1853 = icmp sgt i32 %sub, 0
br i1 %cmp1853, label %for.body20.preheader, label %for.cond24.preheader
for.body20.preheader: ; preds = %for.body
%5 = xor i32 %4, -1
%6 = add i32 %5, %conv6
%7 = zext i32 %6 to i64
%8 = add nuw nsw i64 %7, 1
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %str, ptr noundef nonnull align 16 dereferenceable(1) %str_last, i64 %8, i1 false), !tbaa !5
br label %for.cond24.preheader
for.cond24.preheader: ; preds = %for.body20.preheader, %for.body
%cmp2555 = icmp sgt i32 %4, 0
br i1 %cmp2555, label %for.body27.preheader, label %for.end35
for.body27.preheader: ; preds = %for.cond24.preheader
%scevgep = getelementptr i8, ptr %str, i64 %conv15
%9 = add i32 %4, %2
%10 = sub i32 %3, %4
%smax = call i32 @llvm.smax.i32(i32 %10, i32 %conv6)
%11 = add i32 %9, %smax
%12 = zext i32 %11 to i64
%13 = add nuw nsw i64 %12, 1
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, ptr noundef nonnull align 16 dereferenceable(1) %str_first, i64 %13, i1 false), !tbaa !5
br label %for.end35
for.end35: ; preds = %for.body27.preheader, %for.cond24.preheader
%inc38 = add nuw nsw i32 %i.059, 1
%14 = load i32, ptr %m, align 4, !tbaa !8
%cmp8 = icmp slt i32 %inc38, %14
br i1 %cmp8, label %for.body, label %for.end39, !llvm.loop !10
for.end39: ; preds = %for.end35, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%15 = load i8, ptr %str, align 16, !tbaa !5
%cmp = icmp eq i8 %15, 45
br i1 %cmp, label %do.end, label %if.end
do.end: ; preds = %for.end39, %entry
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %str_last) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %str_first) #8
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %str) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[201], s2[201], s3[201];
int m, h;
int i;
while (1){
scanf("%s", s);
if (strcmp(s, "-") == 0){
break;
}
scanf("%d", &m);
for (i = 0; i < m; i++){
scanf("%d", &h);
strncpy(s2, s, h);
s2[h] = '\0';
strcpy(s3, &s[h]);
strcpy(s, s3);
strcat(s, s2);
}
printf("%s\n", s);
}
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103575/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103575/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [201 x i8], align 16
%s2 = alloca [201 x i8], align 16
%s3 = alloca [201 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %s2) #5
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %s3) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%lhsv26 = load i16, ptr %s, align 16
%.not27 = icmp eq i16 %lhsv26, 45
br i1 %.not27, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %0, 0
br i1 %cmp423, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%i.024 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
%conv = sext i32 %1 to i64
%call8 = call ptr @strncpy(ptr noundef nonnull %s2, ptr noundef nonnull %s, i64 noundef %conv) #5
%arrayidx = getelementptr inbounds [201 x i8], ptr %s2, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !9
%arrayidx11 = getelementptr inbounds [201 x i8], ptr %s, i64 0, i64 %conv
%call12 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %s3, ptr noundef nonnull dereferenceable(1) %arrayidx11) #5
%call15 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) %s3) #5
%call18 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(1) %s2) #5
%inc = add nuw nsw i32 %i.024, 1
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc, %2
br i1 %cmp4, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%lhsv = load i16, ptr %s, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end, label %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %s3) #5
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %s2) #5
call void @llvm.lifetime.end.p0(i64 201, 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 nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #3
; 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 #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: 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 #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main(void)
{
char n[200],tmp;
int i,j,k,m,num,h;
while(1)
{
scanf("%s",n);
if(n[0]=='-')
break;
num=strlen(n);
// printf("m:");
scanf("%d",&m);
for(i=0;i<m;i++)
{
// printf("h:");
scanf("%d",&h);
for(k=0;k<h;k++)
{
tmp=n[0];
for(j=0;j<num;j++)
{
n[j]=n[j+1];
}
n[num-1]=tmp;
}
}
printf("%s\n",n);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103618/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103618/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca [200 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 200, 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 %h) #6
%call43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i8, ptr %n, align 16, !tbaa !5
%cmp44 = icmp eq i8 %0, 45
br i1 %cmp44, label %while.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%scevgep = getelementptr inbounds i8, ptr %n, i64 1
br label %if.end
if.end: ; preds = %if.end.preheader, %for.end28
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %n) #7
%call3.fr = freeze i64 %call3
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !8
%cmp641 = icmp sgt i32 %1, 0
br i1 %cmp641, label %for.body.lr.ph, label %for.end28
for.body.lr.ph: ; preds = %if.end
%conv4 = trunc i64 %call3.fr to i32
%cmp1537 = icmp sgt i32 %conv4, 0
%sub = shl i64 %call3.fr, 32
%sext = add i64 %sub, -4294967296
%idxprom21 = ashr exact i64 %sext, 32
%arrayidx22 = getelementptr inbounds [200 x i8], ptr %n, i64 0, i64 %idxprom21
br i1 %cmp1537, label %for.body.us.preheader, label %for.body
for.body.us.preheader: ; preds = %for.body.lr.ph
%2 = and i64 %call3.fr, 4294967295
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.inc26.us
%i.042.us = phi i32 [ %inc27.us, %for.inc26.us ], [ 0, %for.body.us.preheader ]
%call8.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%3 = load i32, ptr %h, align 4, !tbaa !8
%cmp1039.us = icmp sgt i32 %3, 0
br i1 %cmp1039.us, label %for.body12.us.us.preheader, label %for.inc26.us
for.body12.us.us.preheader: ; preds = %for.body.us
%xtraiter51 = and i32 %3, 3
%4 = icmp ult i32 %3, 4
br i1 %4, label %for.inc26.us.loopexit.unr-lcssa, label %for.body12.us.us.preheader.new
for.body12.us.us.preheader.new: ; preds = %for.body12.us.us.preheader
%unroll_iter54 = and i32 %3, -4
br label %for.body12.us.us
for.inc26.us.loopexit.unr-lcssa: ; preds = %for.body12.us.us, %for.body12.us.us.preheader
%lcmp.mod53.not = icmp eq i32 %xtraiter51, 0
br i1 %lcmp.mod53.not, label %for.inc26.us, label %for.body12.us.us.epil
for.body12.us.us.epil: ; preds = %for.inc26.us.loopexit.unr-lcssa, %for.body12.us.us.epil
%epil.iter52 = phi i32 [ %epil.iter52.next, %for.body12.us.us.epil ], [ 0, %for.inc26.us.loopexit.unr-lcssa ]
%5 = load i8, ptr %n, align 16, !tbaa !5
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %n, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !5
store i8 %5, ptr %arrayidx22, align 1, !tbaa !5
%epil.iter52.next = add i32 %epil.iter52, 1
%epil.iter52.cmp.not = icmp eq i32 %epil.iter52.next, %xtraiter51
br i1 %epil.iter52.cmp.not, label %for.inc26.us, label %for.body12.us.us.epil, !llvm.loop !10
for.inc26.us: ; preds = %for.inc26.us.loopexit.unr-lcssa, %for.body12.us.us.epil, %for.body.us
%inc27.us = add nuw nsw i32 %i.042.us, 1
%6 = load i32, ptr %m, align 4, !tbaa !8
%cmp6.us = icmp slt i32 %inc27.us, %6
br i1 %cmp6.us, label %for.body.us, label %for.end28, !llvm.loop !12
for.body12.us.us: ; preds = %for.body12.us.us, %for.body12.us.us.preheader.new
%niter55 = phi i32 [ 0, %for.body12.us.us.preheader.new ], [ %niter55.next.3, %for.body12.us.us ]
%7 = load i8, ptr %n, align 16, !tbaa !5
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %n, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !5
store i8 %7, ptr %arrayidx22, align 1, !tbaa !5
%8 = load i8, ptr %n, align 16, !tbaa !5
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %n, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !5
store i8 %8, ptr %arrayidx22, align 1, !tbaa !5
%9 = load i8, ptr %n, align 16, !tbaa !5
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %n, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !5
store i8 %9, ptr %arrayidx22, align 1, !tbaa !5
%10 = load i8, ptr %n, align 16, !tbaa !5
call void @llvm.memmove.p0.p0.i64(ptr nonnull align 16 %n, ptr nonnull align 1 %scevgep, i64 %2, i1 false), !tbaa !5
store i8 %10, ptr %arrayidx22, align 1, !tbaa !5
%niter55.next.3 = add i32 %niter55, 4
%niter55.ncmp.3 = icmp eq i32 %niter55.next.3, %unroll_iter54
br i1 %niter55.ncmp.3, label %for.inc26.us.loopexit.unr-lcssa, label %for.body12.us.us, !llvm.loop !14
for.body: ; preds = %for.body.lr.ph, %for.inc26
%i.042 = phi i32 [ %inc27, %for.inc26 ], [ 0, %for.body.lr.ph ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%11 = load i32, ptr %h, align 4, !tbaa !8
%cmp1039 = icmp sgt i32 %11, 0
br i1 %cmp1039, label %for.body12.preheader, label %for.inc26
for.body12.preheader: ; preds = %for.body
%xtraiter = and i32 %11, 3
%12 = icmp ult i32 %11, 4
br i1 %12, label %for.inc26.loopexit.unr-lcssa, label %for.body12.preheader.new
for.body12.preheader.new: ; preds = %for.body12.preheader
%unroll_iter = and i32 %11, -4
br label %for.body12
for.body12: ; preds = %for.body12, %for.body12.preheader.new
%niter = phi i32 [ 0, %for.body12.preheader.new ], [ %niter.next.3, %for.body12 ]
%13 = load i8, ptr %n, align 16, !tbaa !5
store i8 %13, ptr %arrayidx22, align 1, !tbaa !5
%14 = load i8, ptr %n, align 16, !tbaa !5
store i8 %14, ptr %arrayidx22, align 1, !tbaa !5
%15 = load i8, ptr %n, align 16, !tbaa !5
store i8 %15, ptr %arrayidx22, align 1, !tbaa !5
%16 = load i8, ptr %n, align 16, !tbaa !5
store i8 %16, ptr %arrayidx22, align 1, !tbaa !5
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.inc26.loopexit.unr-lcssa, label %for.body12, !llvm.loop !14
for.inc26.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc26, label %for.body12.epil
for.body12.epil: ; preds = %for.inc26.loopexit.unr-lcssa, %for.body12.epil
%epil.iter = phi i32 [ %epil.iter.next, %for.body12.epil ], [ 0, %for.inc26.loopexit.unr-lcssa ]
%17 = load i8, ptr %n, align 16, !tbaa !5
store i8 %17, ptr %arrayidx22, align 1, !tbaa !5
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.inc26, label %for.body12.epil, !llvm.loop !15
for.inc26: ; preds = %for.inc26.loopexit.unr-lcssa, %for.body12.epil, %for.body
%inc27 = add nuw nsw i32 %i.042, 1
%18 = load i32, ptr %m, align 4, !tbaa !8
%cmp6 = icmp slt i32 %inc27, %18
br i1 %cmp6, label %for.body, label %for.end28, !llvm.loop !12
for.end28: ; preds = %for.inc26, %for.inc26.us, %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %n)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%19 = load i8, ptr %n, align 16, !tbaa !5
%cmp = icmp eq i8 %19, 45
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end28, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 200, 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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.unroll.disable"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !11}
|
#include<stdio.h>
#include<string.h>
int main(){
int m,i,h,len;
int count=0;
char str[404],inc[203];
while(1){
scanf("%s",str);
if(str[0]=='-') break;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d",&h);
count+=h;
}
len=strlen(str);
count%=len;
strcpy(inc,str);
strcat(str,inc);
strncpy(inc,str+count,len);
printf("%s\n",inc);
count=0;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103669/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103669/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%h = alloca i32, align 4
%str = alloca [404 x i8], align 16
%inc = alloca [203 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %str) #6
call void @llvm.lifetime.start.p0(i64 203, ptr nonnull %inc) #6
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp30 = icmp eq i8 %0, 45
br i1 %cmp30, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !8
%cmp326 = icmp sgt i32 %1, 0
br i1 %cmp326, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%count.128 = phi i32 [ %add, %for.body ], [ 0, %if.end ]
%i.027 = phi i32 [ %inc6, %for.body ], [ 0, %if.end ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%2 = load i32, ptr %h, align 4, !tbaa !8
%add = add nsw i32 %2, %count.128
%inc6 = add nuw nsw i32 %i.027, 1
%3 = load i32, ptr %m, align 4, !tbaa !8
%cmp3 = icmp slt i32 %inc6, %3
br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %if.end
%count.1.lcssa = phi i32 [ 0, %if.end ], [ %add, %for.body ]
%call8 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%conv9 = trunc i64 %call8 to i32
%rem = srem i32 %count.1.lcssa, %conv9
%call12 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %inc, ptr noundef nonnull dereferenceable(1) %str) #6
%call15 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %inc) #6
%idx.ext = sext i32 %rem to i64
%add.ptr = getelementptr inbounds i8, ptr %str, i64 %idx.ext
%sext = shl i64 %call8, 32
%conv18 = ashr exact i64 %sext, 32
%call19 = call ptr @strncpy(ptr noundef nonnull %inc, ptr noundef nonnull %add.ptr, i64 noundef %conv18) #6
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %inc)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%4 = load i8, ptr %str, align 16, !tbaa !5
%cmp = icmp eq i8 %4, 45
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 203, ptr nonnull %inc) #6
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %str) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#define MAX 1024
int main(){
char s[MAX], t[MAX];
int n, m, h;
int i;
while(scanf("%s", s), strcmp(s, "-") != 0){
n = strlen(s);
scanf("%d", &m);
for(i = 0; i < m; ++i){
scanf("%d", &h);
memcpy(t + n - h, s, h);
memcpy(t, s + h, n - h);
memcpy(s, t, n);
}
printf("%s\n", s);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103711/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103711/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [1024 x i8], align 16
%t = alloca [1024 x i8], align 16
%m = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %t) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
%call30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%lhsv31 = load i16, ptr %s, align 16
%.not32 = icmp eq i16 %lhsv31, 45
br i1 %.not32, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%conv = trunc i64 %call4 to i32
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp628 = icmp sgt i32 %0, 0
br i1 %cmp628, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %while.body
%sext = shl i64 %call4, 32
%idx.ext = ashr exact i64 %sext, 32
%add.ptr = getelementptr inbounds i8, ptr %t, i64 %idx.ext
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.029 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h)
%1 = load i32, ptr %h, align 4, !tbaa !5
%idx.ext10 = sext i32 %1 to i64
%idx.neg = sub nsw i64 0, %idx.ext10
%add.ptr11 = getelementptr inbounds i8, ptr %add.ptr, i64 %idx.neg
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %add.ptr11, ptr nonnull align 16 %s, i64 %idx.ext10, i1 false)
%add.ptr17 = getelementptr inbounds i8, ptr %s, i64 %idx.ext10
%sub = sub nsw i32 %conv, %1
%conv18 = sext i32 %sub to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %t, ptr nonnull align 1 %add.ptr17, i64 %conv18, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %s, ptr nonnull align 16 %t, i64 %idx.ext, i1 false)
%inc = add nuw nsw i32 %i.029, 1
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc, %2
br i1 %cmp6, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%lhsv = load i16, ptr %s, align 16
%.not = icmp eq i16 %lhsv, 45
br i1 %.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %t) #6
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <string.h>
int main(void) {
char str[200], tmp[200] = {};
int s,n,a,i,j;
while (scanf("%s", str), str[0] != '-'){
s=strlen(str);
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &a);
for (j = 0; j < a; j++) tmp[j] = str[j];
for (j = 0; j < s - a; j++) str[j] = str[j+a];
for (j = 0; j < a; j++) str[s-1 - j] = tmp[a-1 - j];
}
printf("%s\n", str);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103755/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103755/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [200 x i8], align 16
%tmp = alloca [200 x i8], align 16
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %str) #7
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %tmp) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %tmp, i8 0, i64 200, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7
%call68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not69 = icmp eq i8 %0, 45
br i1 %cmp.not69, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%invariant.gep = getelementptr i8, ptr %tmp, i64 -15
%invariant.gep124 = getelementptr i8, ptr %str, i64 -15
%invariant.gep126 = getelementptr i8, ptr %tmp, i64 -7
%invariant.gep128 = getelementptr i8, ptr %str, i64 -7
br label %while.body
while.body: ; preds = %while.body.preheader, %for.end44
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #8
%conv4 = trunc i64 %call3 to i32
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !8
%cmp666 = icmp sgt i32 %1, 0
br i1 %cmp666, label %for.body.preheader, label %for.end44
for.body.preheader: ; preds = %while.body
%2 = add i32 %conv4, -1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc42
%i.067 = phi i32 [ %inc43, %for.inc42 ], [ 0, %for.body.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !8
%cmp1060 = icmp sgt i32 %3, 0
br i1 %cmp1060, label %for.body12.preheader, label %for.cond16.preheader
for.body12.preheader: ; preds = %for.body
%4 = zext i32 %3 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr nonnull align 16 %str, i64 %4, i1 false), !tbaa !5
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.body12.preheader, %for.body
%sub = sub nsw i32 %conv4, %3
%cmp1762 = icmp sgt i32 %sub, 0
br i1 %cmp1762, label %iter.check95, label %for.cond27.preheader
iter.check95: ; preds = %for.cond16.preheader
%5 = sext i32 %3 to i64
%wide.trip.count = zext i32 %sub to i64
%min.iters.check93 = icmp ult i32 %sub, 8
%6 = add nsw i64 %5, 31
%diff.check = icmp ult i64 %6, 32
%or.cond = select i1 %min.iters.check93, i1 true, i1 %diff.check
br i1 %or.cond, label %for.body19.preheader, label %vector.main.loop.iter.check97
vector.main.loop.iter.check97: ; preds = %iter.check95
%min.iters.check96 = icmp ult i32 %sub, 32
br i1 %min.iters.check96, label %vec.epilog.ph109, label %vector.ph98
vector.ph98: ; preds = %vector.main.loop.iter.check97
%n.vec100 = and i64 %wide.trip.count, 4294967264
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph98
%index = phi i64 [ 0, %vector.ph98 ], [ %index.next105, %vector.body102 ]
%7 = add nsw i64 %index, %5
%8 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %7
%wide.load103 = load <16 x i8>, ptr %8, align 1, !tbaa !5
%9 = getelementptr inbounds i8, ptr %8, i64 16
%wide.load104 = load <16 x i8>, ptr %9, align 1, !tbaa !5
%10 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %index
store <16 x i8> %wide.load103, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds i8, ptr %10, i64 16
store <16 x i8> %wide.load104, ptr %11, align 16, !tbaa !5
%index.next105 = add nuw i64 %index, 32
%12 = icmp eq i64 %index.next105, %n.vec100
br i1 %12, label %middle.block92, label %vector.body102, !llvm.loop !10
middle.block92: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec100, %wide.trip.count
br i1 %cmp.n101, label %for.cond27.preheader, label %vec.epilog.iter.check108
vec.epilog.iter.check108: ; preds = %middle.block92
%n.vec.remaining110 = and i64 %wide.trip.count, 24
%min.epilog.iters.check111 = icmp eq i64 %n.vec.remaining110, 0
br i1 %min.epilog.iters.check111, label %for.body19.preheader, label %vec.epilog.ph109
vec.epilog.ph109: ; preds = %vector.main.loop.iter.check97, %vec.epilog.iter.check108
%vec.epilog.resume.val112 = phi i64 [ %n.vec100, %vec.epilog.iter.check108 ], [ 0, %vector.main.loop.iter.check97 ]
%n.vec114 = and i64 %wide.trip.count, 4294967288
br label %vec.epilog.vector.body117
vec.epilog.vector.body117: ; preds = %vec.epilog.vector.body117, %vec.epilog.ph109
%index118 = phi i64 [ %vec.epilog.resume.val112, %vec.epilog.ph109 ], [ %index.next120, %vec.epilog.vector.body117 ]
%13 = add nsw i64 %index118, %5
%14 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %13
%wide.load119 = load <8 x i8>, ptr %14, align 1, !tbaa !5
%15 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %index118
store <8 x i8> %wide.load119, ptr %15, align 8, !tbaa !5
%index.next120 = add nuw i64 %index118, 8
%16 = icmp eq i64 %index.next120, %n.vec114
br i1 %16, label %vec.epilog.middle.block106, label %vec.epilog.vector.body117, !llvm.loop !14
vec.epilog.middle.block106: ; preds = %vec.epilog.vector.body117
%cmp.n116 = icmp eq i64 %n.vec114, %wide.trip.count
br i1 %cmp.n116, label %for.cond27.preheader, label %for.body19.preheader
for.body19.preheader: ; preds = %iter.check95, %vec.epilog.iter.check108, %vec.epilog.middle.block106
%indvars.iv.ph = phi i64 [ 0, %iter.check95 ], [ %n.vec100, %vec.epilog.iter.check108 ], [ %n.vec114, %vec.epilog.middle.block106 ]
%17 = xor i64 %indvars.iv.ph, -1
%18 = add nsw i64 %17, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body19.prol.loopexit, label %for.body19.prol
for.body19.prol: ; preds = %for.body19.preheader, %for.body19.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body19.prol ], [ %indvars.iv.ph, %for.body19.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body19.prol ], [ 0, %for.body19.preheader ]
%19 = add nsw i64 %indvars.iv.prol, %5
%arrayidx21.prol = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %19
%20 = load i8, ptr %arrayidx21.prol, align 1, !tbaa !5
%arrayidx23.prol = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %indvars.iv.prol
store i8 %20, ptr %arrayidx23.prol, align 1, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body19.prol.loopexit, label %for.body19.prol, !llvm.loop !15
for.body19.prol.loopexit: ; preds = %for.body19.prol, %for.body19.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body19.preheader ], [ %indvars.iv.next.prol, %for.body19.prol ]
%21 = icmp ult i64 %18, 3
br i1 %21, label %for.cond27.preheader, label %for.body19
for.cond27.preheader: ; preds = %for.body19.prol.loopexit, %for.body19, %middle.block92, %vec.epilog.middle.block106, %for.cond16.preheader
br i1 %cmp1060, label %iter.check, label %for.inc42
iter.check: ; preds = %for.cond27.preheader
%wide.trip.count76 = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body30.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %iter.check
%22 = add nsw i64 %wide.trip.count76, -1
%23 = add i32 %3, -1
%24 = trunc i64 %22 to i32
%25 = sub i32 %23, %24
%26 = icmp sgt i32 %25, %23
%27 = trunc i64 %22 to i32
%28 = sub i32 %2, %27
%29 = icmp sgt i32 %28, %2
%30 = icmp ugt i64 %22, 4294967295
%31 = or i1 %29, %30
%32 = or i1 %26, %31
br i1 %32, label %for.body30.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.scevcheck
%min.iters.check81 = icmp ult i32 %3, 16
br i1 %min.iters.check81, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %wide.trip.count76, 4294967280
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%offset.idx = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%33 = trunc i64 %offset.idx to i32
%34 = xor i32 %33, -1
%35 = add i32 %3, %34
%36 = sext i32 %35 to i64
%gep = getelementptr [200 x i8], ptr %invariant.gep, i64 0, i64 %36
%wide.load = load <16 x i8>, ptr %gep, align 1, !tbaa !5
%37 = add i32 %34, %conv4
%38 = sext i32 %37 to i64
%gep125 = getelementptr [200 x i8], ptr %invariant.gep124, i64 0, i64 %38
store <16 x i8> %wide.load, ptr %gep125, align 1, !tbaa !5
%index.next = add nuw i64 %offset.idx, 16
%39 = icmp eq i64 %index.next, %n.vec
br i1 %39, label %middle.block, label %vector.body, !llvm.loop !17
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count76
br i1 %cmp.n, label %for.inc42, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %wide.trip.count76, 8
%min.epilog.iters.check.not.not = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check.not.not, label %for.body30.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.vec84 = and i64 %wide.trip.count76, 4294967288
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%offset.idx86 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next90, %vec.epilog.vector.body ]
%40 = trunc i64 %offset.idx86 to i32
%41 = xor i32 %40, -1
%42 = add i32 %3, %41
%43 = sext i32 %42 to i64
%gep127 = getelementptr [200 x i8], ptr %invariant.gep126, i64 0, i64 %43
%wide.load87 = load <8 x i8>, ptr %gep127, align 1, !tbaa !5
%44 = add i32 %41, %conv4
%45 = sext i32 %44 to i64
%gep129 = getelementptr [200 x i8], ptr %invariant.gep128, i64 0, i64 %45
store <8 x i8> %wide.load87, ptr %gep129, align 1, !tbaa !5
%index.next90 = add nuw i64 %offset.idx86, 8
%46 = icmp eq i64 %index.next90, %n.vec84
br i1 %46, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !18
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n85 = icmp eq i64 %n.vec84, %wide.trip.count76
br i1 %cmp.n85, label %for.inc42, label %for.body30.preheader
for.body30.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv73.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec84, %vec.epilog.middle.block ]
%xtraiter121 = and i64 %wide.trip.count76, 1
%lcmp.mod122.not = icmp eq i64 %xtraiter121, 0
br i1 %lcmp.mod122.not, label %for.body30.prol.loopexit, label %for.body30.prol
for.body30.prol: ; preds = %for.body30.preheader
%47 = trunc i64 %indvars.iv73.ph to i32
%48 = xor i32 %47, -1
%sub32.prol = add i32 %3, %48
%idxprom33.prol = sext i32 %sub32.prol to i64
%arrayidx34.prol = getelementptr inbounds [200 x i8], ptr %tmp, i64 0, i64 %idxprom33.prol
%49 = load i8, ptr %arrayidx34.prol, align 1, !tbaa !5
%sub36.prol = add i32 %48, %conv4
%idxprom37.prol = sext i32 %sub36.prol to i64
%arrayidx38.prol = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %idxprom37.prol
store i8 %49, ptr %arrayidx38.prol, align 1, !tbaa !5
%indvars.iv.next74.prol = or i64 %indvars.iv73.ph, 1
br label %for.body30.prol.loopexit
for.body30.prol.loopexit: ; preds = %for.body30.prol, %for.body30.preheader
%indvars.iv73.unr = phi i64 [ %indvars.iv73.ph, %for.body30.preheader ], [ %indvars.iv.next74.prol, %for.body30.prol ]
%50 = sub nsw i64 0, %wide.trip.count76
%51 = xor i64 %indvars.iv73.ph, %50
%52 = icmp eq i64 %51, -1
br i1 %52, label %for.inc42, label %for.body30
for.body19: ; preds = %for.body19.prol.loopexit, %for.body19
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body19 ], [ %indvars.iv.unr, %for.body19.prol.loopexit ]
%53 = add nsw i64 %indvars.iv, %5
%arrayidx21 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %53
%54 = load i8, ptr %arrayidx21, align 1, !tbaa !5
%arrayidx23 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %indvars.iv
store i8 %54, ptr %arrayidx23, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%55 = add nsw i64 %indvars.iv.next, %5
%arrayidx21.1 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %55
%56 = load i8, ptr %arrayidx21.1, align 1, !tbaa !5
%arrayidx23.1 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %indvars.iv.next
store i8 %56, ptr %arrayidx23.1, align 1, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%57 = add nsw i64 %indvars.iv.next.1, %5
%arrayidx21.2 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %57
%58 = load i8, ptr %arrayidx21.2, align 1, !tbaa !5
%arrayidx23.2 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %indvars.iv.next.1
store i8 %58, ptr %arrayidx23.2, align 1, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%59 = add nsw i64 %indvars.iv.next.2, %5
%arrayidx21.3 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %59
%60 = load i8, ptr %arrayidx21.3, align 1, !tbaa !5
%arrayidx23.3 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %indvars.iv.next.2
store i8 %60, ptr %arrayidx23.3, align 1, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond27.preheader, label %for.body19, !llvm.loop !19
for.body30: ; preds = %for.body30.prol.loopexit, %for.body30
%indvars.iv73 = phi i64 [ %indvars.iv.next74.1, %for.body30 ], [ %indvars.iv73.unr, %for.body30.prol.loopexit ]
%61 = trunc i64 %indvars.iv73 to i32
%62 = xor i32 %61, -1
%sub32 = add i32 %3, %62
%idxprom33 = sext i32 %sub32 to i64
%arrayidx34 = getelementptr inbounds [200 x i8], ptr %tmp, i64 0, i64 %idxprom33
%63 = load i8, ptr %arrayidx34, align 1, !tbaa !5
%sub36 = add i32 %62, %conv4
%idxprom37 = sext i32 %sub36 to i64
%arrayidx38 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %idxprom37
store i8 %63, ptr %arrayidx38, align 1, !tbaa !5
%64 = trunc i64 %indvars.iv73 to i32
%65 = sub i32 -2, %64
%sub32.1 = add i32 %3, %65
%idxprom33.1 = sext i32 %sub32.1 to i64
%arrayidx34.1 = getelementptr inbounds [200 x i8], ptr %tmp, i64 0, i64 %idxprom33.1
%66 = load i8, ptr %arrayidx34.1, align 1, !tbaa !5
%sub36.1 = add i32 %65, %conv4
%idxprom37.1 = sext i32 %sub36.1 to i64
%arrayidx38.1 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %idxprom37.1
store i8 %66, ptr %arrayidx38.1, align 1, !tbaa !5
%indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 2
%exitcond77.not.1 = icmp eq i64 %indvars.iv.next74.1, %wide.trip.count76
br i1 %exitcond77.not.1, label %for.inc42, label %for.body30, !llvm.loop !20
for.inc42: ; preds = %for.body30.prol.loopexit, %for.body30, %middle.block, %vec.epilog.middle.block, %for.cond27.preheader
%inc43 = add nuw nsw i32 %i.067, 1
%67 = load i32, ptr %n, align 4, !tbaa !8
%cmp6 = icmp slt i32 %inc43, %67
br i1 %cmp6, label %for.body, label %for.end44, !llvm.loop !21
for.end44: ; preds = %for.inc42, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%68 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not = icmp eq i8 %68, 45
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !22
while.end: ; preds = %for.end44, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %tmp) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %str) #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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 = { 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 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !12, !13}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !11, !12, !13}
!18 = distinct !{!18, !11, !12, !13}
!19 = distinct !{!19, !11, !12}
!20 = distinct !{!20, !11, !12}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
|
#include<stdio.h>
int main()
{
int n, a, b, i, j, x;
scanf("%d %d", &n, &a);
if(n%2==0){
x = n/2;
}else{
x = (n-1)/2;
}
if(a<=x){
b = a - 1;
}else{
b = n - a;
}
if(n==a && a==1){
j = n * 3;
}else{
i = (n * 3);
j = b + i;
}
printf("%d\n", j);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10382/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10382/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a)
%0 = load i32, ptr %n, align 4
%x.0.in = ashr i32 %0, 1
%1 = load i32, ptr %a, align 4
%cmp2.not = icmp sgt i32 %1, %x.0.in
%sub4 = add nsw i32 %1, -1
%sub6 = sub nsw i32 %0, %1
%b.0 = select i1 %cmp2.not, i32 %sub6, i32 %sub4
%cmp9 = icmp eq i32 %1, 1
%2 = icmp eq i32 %0, 1
%or.cond = and i1 %2, %cmp9
%mul = mul nsw i32 %0, 3
%add = select i1 %or.cond, i32 0, i32 %b.0
%j.0 = add nsw i32 %add, %mul
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %j.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(void){
int n;
int a[250];
scanf("%d", &n);
for(int i = 0;i < n;++i){
scanf("%d", &a[i]);
}
int flag = 0;
int cnt = 0;
while(1){
for(int i = 0;i < n;++i){
if(a[i] % 2 == 0) a[i] /= 2;
else{
flag = 1;
break;
}
}
if(flag == 1) break;
else cnt++;
}
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103863/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103863/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [250 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %while.cond.preheader43
while.cond.preheader: ; preds = %for.body
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %while.cond.us.preheader, label %while.cond.preheader43
while.cond.preheader43: ; preds = %entry, %while.cond.preheader
br label %while.cond
while.cond.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %3 to i64
br label %while.cond.us
while.cond.us: ; preds = %while.cond.us.preheader, %for.cond3.if.else17_crit_edge.us
%cnt.0.us = phi i32 [ %inc18.us, %for.cond3.if.else17_crit_edge.us ], [ 0, %while.cond.us.preheader ]
br label %for.body6.us
for.body6.us: ; preds = %while.cond.us, %if.then.us
%indvars.iv38 = phi i64 [ 0, %while.cond.us ], [ %indvars.iv.next39, %if.then.us ]
%arrayidx8.us = getelementptr inbounds [250 x i32], ptr %a, i64 0, i64 %indvars.iv38
%1 = load i32, ptr %arrayidx8.us, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp9.us = icmp eq i32 %2, 0
br i1 %cmp9.us, label %if.then.us, label %while.end
if.then.us: ; preds = %for.body6.us
%div.us = sdiv i32 %1, 2
store i32 %div.us, ptr %arrayidx8.us, align 4, !tbaa !5
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%exitcond.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.if.else17_crit_edge.us, label %for.body6.us, !llvm.loop !9
for.cond3.if.else17_crit_edge.us: ; preds = %if.then.us
%inc18.us = add nuw nsw i32 %cnt.0.us, 1
br label %while.cond.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [250 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
while.cond: ; preds = %while.cond.preheader43, %while.cond
br label %while.cond
while.end: ; preds = %for.body6.us
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.us)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
// AtCoder150 C
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>
// qsortで用いる比較用関数.*a<*bならaが先になる.
int compare(const void* a, const void* b) {
return *(int*)a - *(int*)b;
}
int revcompare(const void* a, const void* b) {
return *(int*)b- *(int*)a;
}
int main(void)
{
int i,j,n;
scanf("%d", &n);
int* a = (int*)malloc(sizeof(int) * n);
int min = 1000000000;
for(i=0;i<n;i++){
scanf("%d", a+i);
for(j=0;*(a+i) % 2 == 0; *(a+i) /= 2, j++);
if(min > j) min = j;
}
printf("%d", min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103906/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103906/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @revcompare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.end16
for.body: ; preds = %entry, %for.end
%indvars.iv = phi i64 [ %indvars.iv.next, %for.end ], [ 0, %entry ]
%min.033 = phi i32 [ %spec.select, %for.end ], [ 1000000000, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%add.ptr.promoted = load i32, ptr %add.ptr, align 4, !tbaa !5
%1 = and i32 %add.ptr.promoted, 1
%cmp728 = icmp eq i32 %1, 0
br i1 %cmp728, label %for.inc, label %for.end
for.inc: ; preds = %for.body, %for.inc
%j.030 = phi i32 [ %inc, %for.inc ], [ 0, %for.body ]
%div2729 = phi i32 [ %div, %for.inc ], [ %add.ptr.promoted, %for.body ]
%div = sdiv i32 %div2729, 2
%inc = add nuw nsw i32 %j.030, 1
%2 = and i32 %div, 1
%cmp7 = icmp eq i32 %2, 0
br i1 %cmp7, label %for.inc, label %for.cond4.for.end_crit_edge, !llvm.loop !9
for.cond4.for.end_crit_edge: ; preds = %for.inc
store i32 %div, ptr %add.ptr, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.cond4.for.end_crit_edge, %for.body
%j.0.lcssa = phi i32 [ %inc, %for.cond4.for.end_crit_edge ], [ 0, %for.body ]
%spec.select = call i32 @llvm.smin.i32(i32 %min.033, i32 %j.0.lcssa)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.end, %entry
%min.0.lcssa = phi i32 [ 1000000000, %entry ], [ %spec.select, %for.end ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress 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) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void) {
int n;
int k;
scanf("%d",&n);
int a[n][2];
int chap=0;
for(int i=0;i<n;i++){
scanf("%d %d",&a[i][1],&a[i][2]);
}
scanf("%d",&k);
for(int i=0;i<n;i++){
if(k>=a[i][1] && k<=a[i][2])
chap=n-i;
}
printf("%d",chap);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10395/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10395/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [2 x i32], i64 %1, align 16
%invariant.gep = getelementptr inbounds [2 x i32], ptr %vla, i64 0, i64 2
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %3, 0
br i1 %cmp32, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp936 = icmp sgt i32 %4, 0
br i1 %cmp936, label %for.body11.lr.ph, label %for.cond.cleanup10
for.body11.lr.ph: ; preds = %for.cond.cleanup
%5 = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count, 1
%6 = icmp eq i32 %4, 1
br i1 %6, label %for.cond.cleanup10.loopexit.unr-lcssa, label %for.body11.lr.ph.new
for.body11.lr.ph.new: ; preds = %for.body11.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx1 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv, i64 1
%gep = getelementptr inbounds [2 x i32], ptr %invariant.gep, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %gep)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup10.loopexit.unr-lcssa: ; preds = %for.inc20.1, %for.body11.lr.ph
%chap.1.lcssa.ph = phi i32 [ undef, %for.body11.lr.ph ], [ %chap.1.1, %for.inc20.1 ]
%indvars.iv40.unr = phi i64 [ 0, %for.body11.lr.ph ], [ %indvars.iv.next41.1, %for.inc20.1 ]
%chap.037.unr = phi i32 [ 0, %for.body11.lr.ph ], [ %chap.1.1, %for.inc20.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup10, label %for.body11.epil
for.body11.epil: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa
%arrayidx14.epil = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv40.unr, i64 1
%9 = load i32, ptr %arrayidx14.epil, align 4, !tbaa !5
%cmp15.not.epil = icmp slt i32 %5, %9
br i1 %cmp15.not.epil, label %for.cond.cleanup10, label %land.lhs.true.epil
land.lhs.true.epil: ; preds = %for.body11.epil
%gep35.epil = getelementptr inbounds [2 x i32], ptr %invariant.gep, i64 %indvars.iv40.unr
%10 = load i32, ptr %gep35.epil, align 8, !tbaa !5
%cmp19.not.epil = icmp sgt i32 %5, %10
%11 = trunc i64 %indvars.iv40.unr to i32
%sub.epil = sub nsw i32 %4, %11
%spec.select.epil = select i1 %cmp19.not.epil, i32 %chap.037.unr, i32 %sub.epil
br label %for.cond.cleanup10
for.cond.cleanup10: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa, %land.lhs.true.epil, %for.body11.epil, %for.cond.cleanup
%chap.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %chap.1.lcssa.ph, %for.cond.cleanup10.loopexit.unr-lcssa ], [ %chap.037.unr, %for.body11.epil ], [ %spec.select.epil, %land.lhs.true.epil ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %chap.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body11: ; preds = %for.inc20.1, %for.body11.lr.ph.new
%indvars.iv40 = phi i64 [ 0, %for.body11.lr.ph.new ], [ %indvars.iv.next41.1, %for.inc20.1 ]
%chap.037 = phi i32 [ 0, %for.body11.lr.ph.new ], [ %chap.1.1, %for.inc20.1 ]
%niter = phi i64 [ 0, %for.body11.lr.ph.new ], [ %niter.next.1, %for.inc20.1 ]
%arrayidx14 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv40, i64 1
%12 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15.not = icmp slt i32 %5, %12
br i1 %cmp15.not, label %for.inc20, label %land.lhs.true
land.lhs.true: ; preds = %for.body11
%gep35 = getelementptr inbounds [2 x i32], ptr %invariant.gep, i64 %indvars.iv40
%13 = load i32, ptr %gep35, align 8, !tbaa !5
%cmp19.not = icmp sgt i32 %5, %13
%14 = trunc i64 %indvars.iv40 to i32
%sub = sub nsw i32 %4, %14
%spec.select = select i1 %cmp19.not, i32 %chap.037, i32 %sub
br label %for.inc20
for.inc20: ; preds = %land.lhs.true, %for.body11
%chap.1 = phi i32 [ %chap.037, %for.body11 ], [ %spec.select, %land.lhs.true ]
%indvars.iv.next41 = or i64 %indvars.iv40, 1
%arrayidx14.1 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv.next41, i64 1
%15 = load i32, ptr %arrayidx14.1, align 4, !tbaa !5
%cmp15.not.1 = icmp slt i32 %5, %15
br i1 %cmp15.not.1, label %for.inc20.1, label %land.lhs.true.1
land.lhs.true.1: ; preds = %for.inc20
%gep35.1 = getelementptr inbounds [2 x i32], ptr %invariant.gep, i64 %indvars.iv.next41
%16 = load i32, ptr %gep35.1, align 16, !tbaa !5
%cmp19.not.1 = icmp sgt i32 %5, %16
%17 = trunc i64 %indvars.iv.next41 to i32
%sub.1 = sub nsw i32 %4, %17
%spec.select.1 = select i1 %cmp19.not.1, i32 %chap.1, i32 %sub.1
br label %for.inc20.1
for.inc20.1: ; preds = %land.lhs.true.1, %for.inc20
%chap.1.1 = phi i32 [ %chap.1, %for.inc20 ], [ %spec.select.1, %land.lhs.true.1 ]
%indvars.iv.next41.1 = add nuw nsw i64 %indvars.iv40, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup10.loopexit.unr-lcssa, label %for.body11, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main() {
int A[200];
int N = 0, i, count = 0, flag = 1;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
while (1) {
for (i = 0; i < N; i++) {
if (A[i] % 2 != 0) {
flag = 0;
break;
}
A[i] = A[i] / 2;
}
if (flag == 0) {
break;
} else {
count++;
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103993/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103993/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [200 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
store i32 0, ptr %N, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.body, label %while.cond.preheader40
while.cond.preheader: ; preds = %for.body
%cmp330 = icmp sgt i32 %3, 0
br i1 %cmp330, label %while.cond.us.preheader, label %while.cond.preheader40
while.cond.preheader40: ; preds = %entry, %while.cond.preheader
br label %while.cond
while.cond.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %3 to i64
br label %while.cond.us
while.cond.us: ; preds = %while.cond.us.preheader, %for.cond2.if.else_crit_edge.us
%count.0.us = phi i32 [ %inc17.us, %for.cond2.if.else_crit_edge.us ], [ 0, %while.cond.us.preheader ]
br label %for.body4.us
for.body4.us: ; preds = %while.cond.us, %if.end.us
%indvars.iv35 = phi i64 [ 0, %while.cond.us ], [ %indvars.iv.next36, %if.end.us ]
%arrayidx6.us = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv35
%1 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp7.not.us = icmp eq i32 %2, 0
br i1 %cmp7.not.us, label %if.end.us, label %while.end
if.end.us: ; preds = %for.body4.us
%div.us = sdiv i32 %1, 2
store i32 %div.us, ptr %arrayidx6.us, align 4, !tbaa !5
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
%exitcond.not = icmp eq i64 %indvars.iv.next36, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.if.else_crit_edge.us, label %for.body4.us, !llvm.loop !9
for.cond2.if.else_crit_edge.us: ; preds = %if.end.us
%inc17.us = add nuw nsw i32 %count.0.us, 1
br label %while.cond.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
while.cond: ; preds = %while.cond.preheader40, %while.cond
br label %while.cond
while.end: ; preds = %for.body4.us
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.us)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define REP(i,n) for(i=0;i<n;i++)
#define ll long long
int main(void){
int i,N,ctr=0;
scanf("%d",&N);
int a[N];
REP(i,N){
scanf("%d",&a[i]);
}
while(1){
bool yn=0;
REP(i,N){
if(a[i]%2!=0) yn=1;
}
if(yn) break;
REP(i,N){
a[i]=a[i]/2;
}
ctr++;
}
printf("%d",ctr);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104042/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104042/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %3, 0
br i1 %cmp43, label %for.body, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %3, %entry ], [ %23, %for.body ]
%.lcssa.fr = freeze i32 %.lcssa
%cmp345 = icmp sgt i32 %.lcssa.fr, 0
br i1 %cmp345, label %while.cond.us.us.preheader, label %while.cond
while.cond.us.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count85 = zext i32 %.lcssa.fr to i64
%min.iters.check98 = icmp ult i32 %.lcssa.fr, 8
%n.vec101 = and i64 %wide.trip.count85, 4294967288
%cmp.n103 = icmp eq i64 %n.vec101, %wide.trip.count85
%min.iters.check = icmp ult i32 %.lcssa.fr, 8
%n.vec = and i64 %wide.trip.count85, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count85
br label %while.cond.us.us
while.cond.us.us: ; preds = %while.cond.us.us.preheader, %for.cond13.cleanup_crit_edge.us.us
%ctr.0.us.us = phi i32 [ %inc23.us.us, %for.cond13.cleanup_crit_edge.us.us ], [ 0, %while.cond.us.us.preheader ]
br i1 %min.iters.check98, label %for.body4.us.us.preheader, label %vector.body104
vector.body104: ; preds = %while.cond.us.us, %vector.body104
%index105 = phi i64 [ %index.next109, %vector.body104 ], [ 0, %while.cond.us.us ]
%vec.phi = phi <4 x i8> [ %10, %vector.body104 ], [ zeroinitializer, %while.cond.us.us ]
%vec.phi106 = phi <4 x i8> [ %11, %vector.body104 ], [ zeroinitializer, %while.cond.us.us ]
%4 = getelementptr inbounds i32, ptr %vla, i64 %index105
%wide.load107 = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load108 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = and <4 x i32> %wide.load107, <i32 1, i32 1, i32 1, i32 1>
%7 = and <4 x i32> %wide.load108, <i32 1, i32 1, i32 1, i32 1>
%8 = icmp eq <4 x i32> %6, zeroinitializer
%9 = icmp eq <4 x i32> %7, zeroinitializer
%10 = select <4 x i1> %8, <4 x i8> %vec.phi, <4 x i8> <i8 1, i8 1, i8 1, i8 1>
%11 = select <4 x i1> %9, <4 x i8> %vec.phi106, <4 x i8> <i8 1, i8 1, i8 1, i8 1>
%index.next109 = add nuw i64 %index105, 8
%12 = icmp eq i64 %index.next109, %n.vec101
br i1 %12, label %middle.block96, label %vector.body104, !llvm.loop !9
middle.block96: ; preds = %vector.body104
%rdx.select.cmp.not = icmp ne <4 x i8> %10, zeroinitializer
%rdx.select.cmp110112 = icmp ne <4 x i8> %11, zeroinitializer
%rdx.select.cmp110 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp110112
%13 = bitcast <4 x i1> %rdx.select.cmp110 to i4
%.not = icmp ne i4 %13, 0
%rdx.select111 = zext i1 %.not to i8
br i1 %cmp.n103, label %for.cond2.for.end10_crit_edge.us.us, label %for.body4.us.us.preheader
for.body4.us.us.preheader: ; preds = %while.cond.us.us, %middle.block96
%indvars.iv83.ph = phi i64 [ 0, %while.cond.us.us ], [ %n.vec101, %middle.block96 ]
%yn.047.us.us.ph = phi i8 [ 0, %while.cond.us.us ], [ %rdx.select111, %middle.block96 ]
br label %for.body4.us.us
for.body15.us.us: ; preds = %for.body15.us.us.preheader113, %for.body15.us.us
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body15.us.us ], [ %indvars.iv87.ph, %for.body15.us.us.preheader113 ]
%arrayidx17.us.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv87
%14 = load i32, ptr %arrayidx17.us.us, align 4, !tbaa !5
%div.us.us = sdiv i32 %14, 2
store i32 %div.us.us, ptr %arrayidx17.us.us, align 4, !tbaa !5
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%exitcond91.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count85
br i1 %exitcond91.not, label %for.cond13.cleanup_crit_edge.us.us, label %for.body15.us.us, !llvm.loop !13
for.body4.us.us: ; preds = %for.body4.us.us.preheader, %for.body4.us.us
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body4.us.us ], [ %indvars.iv83.ph, %for.body4.us.us.preheader ]
%yn.047.us.us = phi i8 [ %spec.select.us.us, %for.body4.us.us ], [ %yn.047.us.us.ph, %for.body4.us.us.preheader ]
%arrayidx6.us.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv83
%15 = load i32, ptr %arrayidx6.us.us, align 4, !tbaa !5
%16 = and i32 %15, 1
%cmp7.not.us.us = icmp eq i32 %16, 0
%spec.select.us.us = select i1 %cmp7.not.us.us, i8 %yn.047.us.us, i8 1
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%exitcond86.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count85
br i1 %exitcond86.not, label %for.cond2.for.end10_crit_edge.us.us, label %for.body4.us.us, !llvm.loop !14
for.cond2.for.end10_crit_edge.us.us: ; preds = %for.body4.us.us, %middle.block96
%spec.select.us.us.lcssa = phi i8 [ %rdx.select111, %middle.block96 ], [ %spec.select.us.us, %for.body4.us.us ]
%17 = and i8 %spec.select.us.us.lcssa, 1
%tobool.not.us.us = icmp eq i8 %17, 0
br i1 %tobool.not.us.us, label %for.body15.us.us.preheader, label %while.end
for.body15.us.us.preheader: ; preds = %for.cond2.for.end10_crit_edge.us.us
br i1 %min.iters.check, label %for.body15.us.us.preheader113, label %vector.body
vector.body: ; preds = %for.body15.us.us.preheader, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body15.us.us.preheader ]
%18 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds i32, ptr %18, i64 4
%wide.load95 = load <4 x i32>, ptr %19, align 16, !tbaa !5
%20 = sdiv <4 x i32> %wide.load, <i32 2, i32 2, i32 2, i32 2>
%21 = sdiv <4 x i32> %wide.load95, <i32 2, i32 2, i32 2, i32 2>
store <4 x i32> %20, ptr %18, align 16, !tbaa !5
store <4 x i32> %21, ptr %19, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%22 = icmp eq i64 %index.next, %n.vec
br i1 %22, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond13.cleanup_crit_edge.us.us, label %for.body15.us.us.preheader113
for.body15.us.us.preheader113: ; preds = %for.body15.us.us.preheader, %middle.block
%indvars.iv87.ph = phi i64 [ 0, %for.body15.us.us.preheader ], [ %n.vec, %middle.block ]
br label %for.body15.us.us
for.cond13.cleanup_crit_edge.us.us: ; preds = %for.body15.us.us, %middle.block
%inc23.us.us = add nuw nsw i32 %ctr.0.us.us, 1
br label %while.cond.us.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%23 = load i32, ptr %N, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp = icmp slt i64 %indvars.iv.next, %24
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !16
while.cond: ; preds = %while.cond.preheader, %while.cond
br label %while.cond
while.end: ; preds = %for.cond2.for.end10_crit_edge.us.us
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ctr.0.us.us)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int main(){
int N,count=0,flag=0;
int A[N];
scanf("%d",&N);
if(N!=0){
for(int i=0;i<N;i++){
scanf("%d",&A[i]);
}
while(flag==0){
for(int i=0;i<N;i++){
if(A[i]%2==0 && i != N-1){
A[i] /= 2;
}
else if(A[i]%2 != 0){
flag++;
break;
}
else if(i == N-1 && A[i]%2 == 0){
A[i] /= 2;
count++;
}
}
}
}
else{
printf("%d\n",count);
}
printf("%d\n",count);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104086/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104086/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%vla72 = alloca [0 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%0 = tail call ptr @llvm.stacksave.p0()
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not = icmp eq i32 %1, 0
br i1 %cmp.not, label %if.else40, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp157 = icmp sgt i32 %1, 0
br i1 %cmp157, label %for.body, label %for.cond5.preheader.preheader
while.cond.preheader: ; preds = %for.body
%cmp659 = icmp sgt i32 %4, 0
br i1 %cmp659, label %for.cond5.preheader.us.preheader, label %for.cond5.preheader.preheader
for.cond5.preheader.preheader: ; preds = %for.cond.preheader, %while.cond.preheader
br label %for.cond5.preheader
for.cond5.preheader.us.preheader: ; preds = %while.cond.preheader
%sub = add nsw i32 %4, -1
%2 = zext i32 %sub to i64
%wide.trip.count = zext i32 %4 to i64
%vla72.promoted81 = load i32, ptr %vla72, align 16, !tbaa !5
br label %for.body8.us
for.body8.us: ; preds = %for.inc37.us, %for.cond5.preheader.us.preheader
%vla72.promoted83 = phi i32 [ %vla72.promoted81, %for.cond5.preheader.us.preheader ], [ %vla72.promoted82, %for.inc37.us ]
%div33.us80 = phi i32 [ %vla72.promoted81, %for.cond5.preheader.us.preheader ], [ %spec.select, %for.inc37.us ]
%indvars.iv69 = phi i64 [ 0, %for.cond5.preheader.us.preheader ], [ %spec.select86, %for.inc37.us ]
%count.160.us = phi i32 [ 0, %for.cond5.preheader.us.preheader ], [ %count.2.us, %for.inc37.us ]
%3 = and i32 %div33.us80, 1
%cmp11.us = icmp ne i32 %3, 0
%cmp12.not.us = icmp eq i64 %indvars.iv69, %2
%or.cond.us = select i1 %cmp11.us, i1 true, i1 %cmp12.not.us
br i1 %or.cond.us, label %if.else.us, label %if.then13.us
if.then13.us: ; preds = %for.body8.us
%div.us = sdiv i32 %div33.us80, 2
store i32 %div.us, ptr %vla72, align 16, !tbaa !5
br label %for.inc37.us
if.else.us: ; preds = %for.body8.us
%cmp19.not.us = icmp eq i32 %3, 0
br i1 %cmp19.not.us, label %if.else22.us, label %if.end42
if.else22.us: ; preds = %if.else.us
br i1 %cmp12.not.us, label %if.then30.us, label %for.inc37.us
if.then30.us: ; preds = %if.else22.us
%div33.us = sdiv i32 %div33.us80, 2
store i32 %div33.us, ptr %vla72, align 16, !tbaa !5
%inc34.us = add nsw i32 %count.160.us, 1
br label %for.inc37.us
for.inc37.us: ; preds = %if.then30.us, %if.else22.us, %if.then13.us
%vla72.promoted82 = phi i32 [ %div.us, %if.then13.us ], [ %div33.us, %if.then30.us ], [ %vla72.promoted83, %if.else22.us ]
%div33.us79 = phi i32 [ %div.us, %if.then13.us ], [ %div33.us, %if.then30.us ], [ %div33.us80, %if.else22.us ]
%count.2.us = phi i32 [ %count.160.us, %if.then13.us ], [ %inc34.us, %if.then30.us ], [ %count.160.us, %if.else22.us ]
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count
%spec.select = select i1 %exitcond.not, i32 %vla72.promoted82, i32 %div33.us79
%spec.select86 = select i1 %exitcond.not, i64 0, i64 %indvars.iv.next70
br label %for.body8.us, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds i32, ptr %vla72, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp1, label %for.body, label %while.cond.preheader, !llvm.loop !11
for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.cond5.preheader
br label %for.cond5.preheader
if.else40: ; preds = %entry
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
br label %if.end42
if.end42: ; preds = %if.else.us, %if.else40
%count.3 = phi i32 [ 0, %if.else40 ], [ %count.160.us, %if.else.us ]
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.3)
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { 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, !10}
|
#include<stdio.h>
int main(){
int n,a[200],s=0,i;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&a[i]);
while(n){
for(i=0;i<n;i++){
if(a[i]%2){
n=0;
break;
}
a[i]/=2;
}
s++;
}
printf("%d",s-1);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104129/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104129/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%a = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry
%n.promoted = phi i32 [ %0, %entry ], [ %1, %for.body ]
%tobool.not28 = icmp eq i32 %n.promoted, 0
br i1 %tobool.not28, label %while.end, label %for.cond2.preheader.preheader
for.cond2.preheader.preheader: ; preds = %while.cond.preheader
%cmp324 = icmp sgt i32 %n.promoted, 0
%wide.trip.count = zext i32 %n.promoted to i64
br label %for.cond2.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !9
for.cond2.preheader: ; preds = %for.end12, %for.cond2.preheader.preheader
%s.030 = phi i32 [ %inc13, %for.end12 ], [ 0, %for.cond2.preheader.preheader ]
br i1 %cmp324, label %for.body4, label %for.end12
for.body4: ; preds = %for.cond2.preheader, %if.end
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %if.end ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv34
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%4 = and i32 %3, 1
%tobool7.not = icmp eq i32 %4, 0
br i1 %tobool7.not, label %if.end, label %for.end12.thread
for.end12.thread: ; preds = %for.body4
store i32 0, ptr %n, align 4, !tbaa !5
br label %while.end
if.end: ; preds = %for.body4
%div = sdiv i32 %3, 2
store i32 %div, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
%exitcond.not = icmp eq i64 %indvars.iv.next35, %wide.trip.count
br i1 %exitcond.not, label %for.end12, label %for.body4, !llvm.loop !11
for.end12: ; preds = %if.end, %for.cond2.preheader
%inc13 = add nuw nsw i32 %s.030, 1
br label %for.cond2.preheader, !llvm.loop !12
while.end: ; preds = %for.end12.thread, %while.cond.preheader
%s.0.lcssa = phi i32 [ -1, %while.cond.preheader ], [ %s.030, %for.end12.thread ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %s.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h> //for bool
#include <stdlib.h> // abs,labs,llabs
#include <limits.h>
#include <ctype.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld; //%Lf
int main(void) {
int i = 0, n, k, j;
scanf("%d", &n);
int a[n][2];
for (i = 0; i < n; i++) {
for (j = 0; j < 2; j++) {
scanf("%d", &a[i][j]);
}
}
scanf("%d", &k);
for (i = 0; i < n; i++) {
if (a[i][0] <= k && a[i][1] >= k ) {
break;
}
}
printf("%d\n", (n - i));
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10418/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10418/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [2 x i32], i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %3, 0
br i1 %cmp36, label %for.cond1.preheader, label %for.end9
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %entry ]
%arrayidx5 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv, i64 0
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%arrayidx5.1 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%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.cond1.preheader, label %for.end9, !llvm.loop !9
for.end9: ; preds = %for.cond1.preheader, %entry
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp1238 = icmp sgt i32 %6, 0
br i1 %cmp1238, label %for.body13.lr.ph, label %for.end24
for.body13.lr.ph: ; preds = %for.end9
%7 = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %6 to i64
br label %for.body13
for.body13: ; preds = %for.body13.lr.ph, %for.inc22
%indvars.iv45 = phi i64 [ 0, %for.body13.lr.ph ], [ %indvars.iv.next46, %for.inc22 ]
%arrayidx15 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv45
%8 = load i32, ptr %arrayidx15, align 8, !tbaa !5
%cmp17.not = icmp sgt i32 %8, %7
br i1 %cmp17.not, label %for.inc22, label %land.lhs.true
land.lhs.true: ; preds = %for.body13
%arrayidx20 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv45, i64 1
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.not = icmp slt i32 %9, %7
br i1 %cmp21.not, label %for.inc22, label %for.end24.loopexit.split.loop.exit
for.inc22: ; preds = %for.body13, %land.lhs.true
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.end24, label %for.body13, !llvm.loop !11
for.end24.loopexit.split.loop.exit: ; preds = %land.lhs.true
%10 = trunc i64 %indvars.iv45 to i32
br label %for.end24
for.end24: ; preds = %for.inc22, %for.end24.loopexit.split.loop.exit, %for.end9
%i.1.lcssa = phi i32 [ 0, %for.end9 ], [ %10, %for.end24.loopexit.split.loop.exit ], [ %6, %for.inc22 ]
%sub = sub nsw i32 %6, %i.1.lcssa
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main()
{
long int n,m;
//printf("好きな整数を1~200個入力します。入力する文字数を入力してください。\n");
scanf("%d", &m);
//printf("好きな整数を入力してください。\n");
int count = 0;
int escape = 0;
int a[200];
for (int i = 0;i < m;i++)
{
scanf("%d", &a[i]);
}
while (1)
{
for (int i = 0;i < m;i++)
{
if (a[i] % 2 == 1)
{
escape = 1;
break;
}
a[i] = a[i] / 2;
}
if (escape == 1)
{
break;
}
count++;
}
//printf("試行回数は%d回です。", count);
printf("%d", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104222/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104222/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%m = alloca i64, align 8
%a = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %a) #3
%0 = load i64, ptr %m, align 8, !tbaa !5
%cmp39 = icmp sgt i64 %0, 0
br i1 %cmp39, label %for.body, label %while.cond.preheader53
while.cond.preheader: ; preds = %for.body
%cmp642 = icmp sgt i64 %3, 0
br i1 %cmp642, label %while.cond.us, label %while.cond.preheader53
while.cond.preheader53: ; preds = %entry, %while.cond.preheader
br label %while.cond
while.cond.us: ; preds = %while.cond.preheader, %for.cond4.if.end24_crit_edge.us
%count.0.us = phi i32 [ %inc25.us, %for.cond4.if.end24_crit_edge.us ], [ 0, %while.cond.preheader ]
br label %for.body9.us
for.body9.us: ; preds = %while.cond.us, %if.end.us
%indvars.iv48 = phi i64 [ 0, %while.cond.us ], [ %indvars.iv.next49, %if.end.us ]
%arrayidx11.us = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv48
%1 = load i32, ptr %arrayidx11.us, align 4, !tbaa !9
%2 = and i32 %1, -2147483647
%cmp12.us = icmp eq i32 %2, 1
br i1 %cmp12.us, label %while.end, label %if.end.us
if.end.us: ; preds = %for.body9.us
%div.us = sdiv i32 %1, 2
store i32 %div.us, ptr %arrayidx11.us, align 4, !tbaa !9
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%exitcond.not = icmp eq i64 %indvars.iv.next49, %3
br i1 %exitcond.not, label %for.cond4.if.end24_crit_edge.us, label %for.body9.us, !llvm.loop !11
for.cond4.if.end24_crit_edge.us: ; preds = %if.end.us
%inc25.us = add nuw nsw i32 %count.0.us, 1
br label %while.cond.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i64, ptr %m, align 8, !tbaa !5
%cmp = icmp sgt i64 %3, %indvars.iv.next
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !13
while.cond: ; preds = %while.cond.preheader53, %while.cond
br label %while.cond
while.end: ; preds = %for.body9.us
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.us)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
long wari(long a,long b){
if(a % 2==0){
b++;
return wari(a/2,b);
}else{
return b;
}
}
int main (void){
int i;
long s[250] = {0};
int n;
long ans=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%ld",&s[i]);
}
for(i=0;i<n;i++){
if(i==0){
ans = wari(s[i],0);
}else{
if(wari(s[i],0) < ans){
ans = wari(s[i],0);
}
}
}
printf("%ld\n",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104266/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104266/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @wari(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%0 = and i64 %a, 1
%cmp4 = icmp eq i64 %0, 0
br i1 %cmp4, label %if.then, label %return
if.then: ; preds = %entry, %if.then
%b.tr6 = phi i64 [ %inc, %if.then ], [ %b, %entry ]
%a.tr5 = phi i64 [ %div, %if.then ], [ %a, %entry ]
%inc = add nsw i64 %b.tr6, 1
%div = sdiv i64 %a.tr5, 2
%1 = and i64 %div, 1
%cmp = icmp eq i64 %1, 0
br i1 %cmp, label %if.then, label %return
return: ; preds = %if.then, %entry
%b.tr.lcssa = phi i64 [ %b, %entry ], [ %inc, %if.then ]
ret i64 %b.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca [250 x i64], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %s) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000) %s, i8 0, i64 2000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.body, label %for.end20
for.cond2.preheader: ; preds = %for.body
%cmp354 = icmp sgt i32 %8, 0
br i1 %cmp354, label %for.body4.lr.ph, label %for.end20
for.body4.lr.ph: ; preds = %for.cond2.preheader
%1 = load i64, ptr %s, align 16
%.fr58 = freeze i64 %1
%2 = and i64 %.fr58, 1
%cmp4.i = icmp eq i64 %2, 0
%wide.trip.count69 = zext i32 %8 to i64
br i1 %cmp4.i, label %for.body4.us, label %for.body4
for.body4.us: ; preds = %for.body4.lr.ph, %for.inc18.us
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.inc18.us ], [ 0, %for.body4.lr.ph ]
%ans.056.us = phi i64 [ %ans.1.us, %for.inc18.us ], [ 0, %for.body4.lr.ph ]
%cmp5.us = icmp eq i64 %indvars.iv66, 0
br i1 %cmp5.us, label %if.then.i.us, label %if.else.us
if.else.us: ; preds = %for.body4.us
%arrayidx10.us = getelementptr inbounds [250 x i64], ptr %s, i64 0, i64 %indvars.iv66
%3 = load i64, ptr %arrayidx10.us, align 8, !tbaa !9
%4 = and i64 %3, 1
%cmp4.i31.us.not = icmp eq i64 %4, 0
br i1 %cmp4.i31.us.not, label %if.then.i33.us, label %wari.exit39.thread.us
if.then.i33.us: ; preds = %if.else.us, %if.then.i33.us
%b.tr6.i34.us = phi i64 [ %inc.i36.us, %if.then.i33.us ], [ 0, %if.else.us ]
%a.tr5.i35.us = phi i64 [ %div.i37.us, %if.then.i33.us ], [ %3, %if.else.us ]
%inc.i36.us = add nuw nsw i64 %b.tr6.i34.us, 1
%div.i37.us = sdiv i64 %a.tr5.i35.us, 2
%5 = and i64 %div.i37.us, 1
%cmp.i38.us = icmp eq i64 %5, 0
br i1 %cmp.i38.us, label %if.then.i33.us, label %wari.exit39.us
wari.exit39.us: ; preds = %if.then.i33.us
%cmp12.us.not = icmp slt i64 %inc.i36.us, %ans.056.us
br i1 %cmp12.us.not, label %if.then.i42.us, label %for.inc18.us
if.then.i42.us: ; preds = %wari.exit39.us, %if.then.i42.us
%b.tr6.i43.us = phi i64 [ %inc.i45.us, %if.then.i42.us ], [ 0, %wari.exit39.us ]
%a.tr5.i44.us = phi i64 [ %div.i46.us, %if.then.i42.us ], [ %3, %wari.exit39.us ]
%inc.i45.us = add nuw nsw i64 %b.tr6.i43.us, 1
%div.i46.us = sdiv i64 %a.tr5.i44.us, 2
%6 = and i64 %div.i46.us, 1
%cmp.i47.us = icmp eq i64 %6, 0
br i1 %cmp.i47.us, label %if.then.i42.us, label %for.inc18.us
wari.exit39.thread.us: ; preds = %if.else.us
%spec.select.us = call i64 @llvm.smin.i64(i64 %ans.056.us, i64 0)
br label %for.inc18.us
if.then.i.us: ; preds = %for.body4.us, %if.then.i.us
%b.tr6.i.us = phi i64 [ %inc.i.us, %if.then.i.us ], [ 0, %for.body4.us ]
%a.tr5.i.us = phi i64 [ %div.i.us, %if.then.i.us ], [ %.fr58, %for.body4.us ]
%inc.i.us = add nuw nsw i64 %b.tr6.i.us, 1
%div.i.us = sdiv i64 %a.tr5.i.us, 2
%7 = and i64 %div.i.us, 1
%cmp.i.us = icmp eq i64 %7, 0
br i1 %cmp.i.us, label %if.then.i.us, label %for.inc18.us
for.inc18.us: ; preds = %if.then.i42.us, %if.then.i.us, %wari.exit39.thread.us, %wari.exit39.us
%ans.1.us = phi i64 [ %ans.056.us, %wari.exit39.us ], [ %spec.select.us, %wari.exit39.thread.us ], [ %inc.i.us, %if.then.i.us ], [ %inc.i45.us, %if.then.i42.us ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.end20, label %for.body4.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [250 x i64], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.lr.ph, %for.inc18
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.inc18 ], [ 0, %for.body4.lr.ph ]
%ans.056 = phi i64 [ %ans.1, %for.inc18 ], [ 0, %for.body4.lr.ph ]
%cmp5 = icmp eq i64 %indvars.iv63, 0
br i1 %cmp5, label %for.inc18, label %if.else
if.else: ; preds = %for.body4
%arrayidx10 = getelementptr inbounds [250 x i64], ptr %s, i64 0, i64 %indvars.iv63
%10 = load i64, ptr %arrayidx10, align 8, !tbaa !9
%11 = and i64 %10, 1
%cmp4.i31.not = icmp eq i64 %11, 0
br i1 %cmp4.i31.not, label %if.then.i33, label %wari.exit39.thread
if.then.i33: ; preds = %if.else, %if.then.i33
%b.tr6.i34 = phi i64 [ %inc.i36, %if.then.i33 ], [ 0, %if.else ]
%a.tr5.i35 = phi i64 [ %div.i37, %if.then.i33 ], [ %10, %if.else ]
%inc.i36 = add nuw nsw i64 %b.tr6.i34, 1
%div.i37 = sdiv i64 %a.tr5.i35, 2
%12 = and i64 %div.i37, 1
%cmp.i38 = icmp eq i64 %12, 0
br i1 %cmp.i38, label %if.then.i33, label %wari.exit39
wari.exit39: ; preds = %if.then.i33
%cmp12.not = icmp slt i64 %inc.i36, %ans.056
br i1 %cmp12.not, label %if.then.i42, label %for.inc18
wari.exit39.thread: ; preds = %if.else
%spec.select = call i64 @llvm.smin.i64(i64 %ans.056, i64 0)
br label %for.inc18
if.then.i42: ; preds = %wari.exit39, %if.then.i42
%b.tr6.i43 = phi i64 [ %inc.i45, %if.then.i42 ], [ 0, %wari.exit39 ]
%a.tr5.i44 = phi i64 [ %div.i46, %if.then.i42 ], [ %10, %wari.exit39 ]
%inc.i45 = add nuw nsw i64 %b.tr6.i43, 1
%div.i46 = sdiv i64 %a.tr5.i44, 2
%13 = and i64 %div.i46, 1
%cmp.i47 = icmp eq i64 %13, 0
br i1 %cmp.i47, label %if.then.i42, label %for.inc18
for.inc18: ; preds = %if.then.i42, %for.body4, %wari.exit39.thread, %wari.exit39
%ans.1 = phi i64 [ %ans.056, %wari.exit39 ], [ %spec.select, %wari.exit39.thread ], [ 0, %for.body4 ], [ %inc.i45, %if.then.i42 ]
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count69
br i1 %exitcond.not, label %for.end20, label %for.body4, !llvm.loop !11
for.end20: ; preds = %for.inc18, %for.inc18.us, %entry, %for.cond2.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %ans.1.us, %for.inc18.us ], [ %ans.1, %for.inc18 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
#include <string.h>
void revstr(char* str){
int size=strlen(str);
int i,j;
char tmp;
for(i = 0,j = size - 1; i < size / 2; i++, j--){
tmp = str[i];
str[i] = str[j];
str[j] = tmp;
}
}
int main()
{
int rev=0;
int posi_judge;
int do_judge;
char main[100000];
char pre[300000];
char suf[300000];
char tmp[2];
int Q;
int suf_cnt=0;
int pre_cnt=0;
scanf("%s",main);
scanf("%d",&Q);
for(int i=0;i<Q;i++)
{
scanf("%d",&do_judge);
if (do_judge==1)
{
rev++;
}
else
{
scanf("%d %s",&posi_judge,tmp);
if ((posi_judge==1 && rev%2==1)||(posi_judge==2 && rev%2==0))
suf[suf_cnt++]=tmp[0];
else
pre[pre_cnt++]=tmp[0];
}
}
if(rev%2==0)
{
revstr(pre);
printf("%s%s%s",pre,main,suf);
}
else
{
revstr(main);
revstr(suf);
printf("%s%s%s",suf,main,pre);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104309/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104309/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %s\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s%s%s\00", align 1
; Function Attrs: nofree nounwind memory(argmem: readwrite) uwtable
define dso_local void @revstr(ptr nocapture noundef %str) local_unnamed_addr #0 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5
%conv = trunc i64 %call to i32
%cmp18 = icmp sgt i32 %conv, 1
br i1 %cmp18, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%div2627 = lshr i64 %call, 1
%sext = shl i64 %call, 32
%0 = ashr exact i64 %sext, 32
%wide.trip.count = and i64 %div2627, 2147483647
%xtraiter = and i64 %div2627, 1
%1 = icmp eq i64 %wide.trip.count, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
%invariant.gep = getelementptr i8, ptr %str, i64 -1
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv21 = phi i64 [ %0, %for.body.preheader.new ], [ %indvars.iv.next22.1, %for.body ]
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv21
%3 = load i8, ptr %gep, align 1, !tbaa !5
store i8 %3, ptr %arrayidx, align 1, !tbaa !5
store i8 %2, ptr %gep, align 1, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%indvars.iv.next22.1 = add nsw i64 %indvars.iv21, -2
%arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%arrayidx3.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next22.1
%5 = load i8, ptr %arrayidx3.1, align 1, !tbaa !5
store i8 %5, ptr %arrayidx.1, align 1, !tbaa !5
store i8 %4, ptr %arrayidx3.1, align 1, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv21.unr = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next22.1, %for.body ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.unr
%6 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%7 = getelementptr i8, ptr %str, i64 %indvars.iv21.unr
%arrayidx3.epil = getelementptr i8, ptr %7, i64 -1
%8 = load i8, ptr %arrayidx3.epil, align 1, !tbaa !5
store i8 %8, ptr %arrayidx.epil, align 1, !tbaa !5
store i8 %6, ptr %arrayidx3.epil, align 1, !tbaa !5
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%posi_judge = alloca i32, align 4
%do_judge = alloca i32, align 4
%main = alloca [100000 x i8], align 16
%pre = alloca [300000 x i8], align 16
%suf = alloca [300000 x i8], align 16
%tmp = alloca [2 x i8], align 1
%Q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %posi_judge) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %do_judge) #6
call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %main) #6
call void @llvm.lifetime.start.p0(i64 300000, ptr nonnull %pre) #6
call void @llvm.lifetime.start.p0(i64 300000, ptr nonnull %suf) #6
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %tmp) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Q) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %main)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %Q)
%0 = load i32, ptr %Q, align 4, !tbaa !10
%cmp75 = icmp sgt i32 %0, 0
br i1 %cmp75, label %for.body, label %if.then24
for.cond.cleanup: ; preds = %for.inc
%1 = and i32 %rev.1, 1
%2 = icmp eq i32 %1, 0
br i1 %2, label %if.then24, label %if.else30
for.body: ; preds = %entry, %for.inc
%i.079 = phi i32 [ %inc21, %for.inc ], [ 0, %entry ]
%pre_cnt.078 = phi i32 [ %pre_cnt.1, %for.inc ], [ 0, %entry ]
%suf_cnt.077 = phi i32 [ %suf_cnt.1, %for.inc ], [ 0, %entry ]
%rev.076 = phi i32 [ %rev.1, %for.inc ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %do_judge)
%3 = load i32, ptr %do_judge, align 4, !tbaa !10
%cmp3 = icmp eq i32 %3, 1
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %rev.076, 1
br label %for.inc
if.else: ; preds = %for.body
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %posi_judge, ptr noundef nonnull %tmp)
%4 = load i32, ptr %posi_judge, align 4, !tbaa !10
%cmp6 = icmp eq i32 %4, 1
%5 = and i32 %rev.076, -2147483647
%cmp7 = icmp eq i32 %5, 1
%or.cond = select i1 %cmp6, i1 %cmp7, i1 false
br i1 %or.cond, label %if.then12, label %lor.lhs.false
lor.lhs.false: ; preds = %if.else
%cmp8 = icmp eq i32 %4, 2
%6 = and i32 %rev.076, 1
%cmp11 = icmp eq i32 %6, 0
%or.cond42 = select i1 %cmp8, i1 %cmp11, i1 false
br i1 %or.cond42, label %if.then12, label %if.else15
if.then12: ; preds = %lor.lhs.false, %if.else
%7 = load i8, ptr %tmp, align 1, !tbaa !5
%inc13 = add nsw i32 %suf_cnt.077, 1
%idxprom = sext i32 %suf_cnt.077 to i64
%arrayidx14 = getelementptr inbounds [300000 x i8], ptr %suf, i64 0, i64 %idxprom
store i8 %7, ptr %arrayidx14, align 1, !tbaa !5
br label %for.inc
if.else15: ; preds = %lor.lhs.false
%8 = load i8, ptr %tmp, align 1, !tbaa !5
%inc17 = add nsw i32 %pre_cnt.078, 1
%idxprom18 = sext i32 %pre_cnt.078 to i64
%arrayidx19 = getelementptr inbounds [300000 x i8], ptr %pre, i64 0, i64 %idxprom18
store i8 %8, ptr %arrayidx19, align 1, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then, %if.else15, %if.then12
%rev.1 = phi i32 [ %inc, %if.then ], [ %rev.076, %if.then12 ], [ %rev.076, %if.else15 ]
%suf_cnt.1 = phi i32 [ %suf_cnt.077, %if.then ], [ %inc13, %if.then12 ], [ %suf_cnt.077, %if.else15 ]
%pre_cnt.1 = phi i32 [ %pre_cnt.078, %if.then ], [ %pre_cnt.078, %if.then12 ], [ %inc17, %if.else15 ]
%inc21 = add nuw nsw i32 %i.079, 1
%9 = load i32, ptr %Q, align 4, !tbaa !10
%cmp = icmp slt i32 %inc21, %9
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
if.then24: ; preds = %entry, %for.cond.cleanup
%call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %pre) #5
%conv.i = trunc i64 %call.i to i32
%cmp18.i = icmp sgt i32 %conv.i, 1
br i1 %cmp18.i, label %for.body.preheader.i, label %revstr.exit
for.body.preheader.i: ; preds = %if.then24
%div2627.i = lshr i64 %call.i, 1
%sext.i = shl i64 %call.i, 32
%10 = ashr exact i64 %sext.i, 32
%wide.trip.count.i = and i64 %div2627.i, 2147483647
%xtraiter85 = and i64 %div2627.i, 1
%11 = icmp eq i64 %wide.trip.count.i, 1
br i1 %11, label %revstr.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter87 = sub nsw i64 %wide.trip.count.i, %xtraiter85
%invariant.gep91 = getelementptr i8, ptr %pre, i64 -1
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new
%indvars.iv21.i = phi i64 [ %10, %for.body.preheader.i.new ], [ %indvars.iv.next22.i.1, %for.body.i ]
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.1, %for.body.i ]
%niter88 = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter88.next.1, %for.body.i ]
%arrayidx.i = getelementptr inbounds i8, ptr %pre, i64 %indvars.iv.i
%12 = load i8, ptr %arrayidx.i, align 2, !tbaa !5
%gep92 = getelementptr i8, ptr %invariant.gep91, i64 %indvars.iv21.i
%13 = load i8, ptr %gep92, align 1, !tbaa !5
store i8 %13, ptr %arrayidx.i, align 2, !tbaa !5
store i8 %12, ptr %gep92, align 1, !tbaa !5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%indvars.iv.next22.i.1 = add nsw i64 %indvars.iv21.i, -2
%arrayidx.i.1 = getelementptr inbounds i8, ptr %pre, i64 %indvars.iv.next.i
%14 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds i8, ptr %pre, i64 %indvars.iv.next22.i.1
%15 = load i8, ptr %arrayidx3.i.1, align 1, !tbaa !5
store i8 %15, ptr %arrayidx.i.1, align 1, !tbaa !5
store i8 %14, ptr %arrayidx3.i.1, align 1, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%niter88.next.1 = add i64 %niter88, 2
%niter88.ncmp.1 = icmp eq i64 %niter88.next.1, %unroll_iter87
br i1 %niter88.ncmp.1, label %revstr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !8
revstr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv21.i.unr = phi i64 [ %10, %for.body.preheader.i ], [ %indvars.iv.next22.i.1, %for.body.i ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.1, %for.body.i ]
%lcmp.mod86.not = icmp eq i64 %xtraiter85, 0
br i1 %lcmp.mod86.not, label %revstr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %revstr.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %pre, i64 %indvars.iv.i.unr
%16 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
%17 = getelementptr i8, ptr %pre, i64 %indvars.iv21.i.unr
%arrayidx3.i.epil = getelementptr i8, ptr %17, i64 -1
%18 = load i8, ptr %arrayidx3.i.epil, align 1, !tbaa !5
store i8 %18, ptr %arrayidx.i.epil, align 1, !tbaa !5
store i8 %16, ptr %arrayidx3.i.epil, align 1, !tbaa !5
br label %revstr.exit
revstr.exit: ; preds = %for.body.i.epil, %revstr.exit.loopexit.unr-lcssa, %if.then24
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %pre, ptr noundef nonnull %main, ptr noundef nonnull %suf)
br label %if.end37
if.else30: ; preds = %for.cond.cleanup
%call.i43 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %main) #5
%conv.i44 = trunc i64 %call.i43 to i32
%cmp18.i45 = icmp sgt i32 %conv.i44, 1
br i1 %cmp18.i45, label %for.body.preheader.i46, label %revstr.exit58
for.body.preheader.i46: ; preds = %if.else30
%div2627.i47 = lshr i64 %call.i43, 1
%sext.i48 = shl i64 %call.i43, 32
%19 = ashr exact i64 %sext.i48, 32
%wide.trip.count.i49 = and i64 %div2627.i47, 2147483647
%xtraiter = and i64 %div2627.i47, 1
%20 = icmp eq i64 %wide.trip.count.i49, 1
br i1 %20, label %revstr.exit58.loopexit.unr-lcssa, label %for.body.preheader.i46.new
for.body.preheader.i46.new: ; preds = %for.body.preheader.i46
%unroll_iter = sub nsw i64 %wide.trip.count.i49, %xtraiter
%invariant.gep = getelementptr i8, ptr %main, i64 -1
br label %for.body.i50
for.body.i50: ; preds = %for.body.i50, %for.body.preheader.i46.new
%indvars.iv21.i51 = phi i64 [ %19, %for.body.preheader.i46.new ], [ %indvars.iv.next22.i53.1, %for.body.i50 ]
%indvars.iv.i52 = phi i64 [ 0, %for.body.preheader.i46.new ], [ %indvars.iv.next.i56.1, %for.body.i50 ]
%niter = phi i64 [ 0, %for.body.preheader.i46.new ], [ %niter.next.1, %for.body.i50 ]
%arrayidx.i54 = getelementptr inbounds i8, ptr %main, i64 %indvars.iv.i52
%21 = load i8, ptr %arrayidx.i54, align 2, !tbaa !5
%gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv21.i51
%22 = load i8, ptr %gep, align 1, !tbaa !5
store i8 %22, ptr %arrayidx.i54, align 2, !tbaa !5
store i8 %21, ptr %gep, align 1, !tbaa !5
%indvars.iv.next.i56 = or i64 %indvars.iv.i52, 1
%indvars.iv.next22.i53.1 = add nsw i64 %indvars.iv21.i51, -2
%arrayidx.i54.1 = getelementptr inbounds i8, ptr %main, i64 %indvars.iv.next.i56
%23 = load i8, ptr %arrayidx.i54.1, align 1, !tbaa !5
%arrayidx3.i55.1 = getelementptr inbounds i8, ptr %main, i64 %indvars.iv.next22.i53.1
%24 = load i8, ptr %arrayidx3.i55.1, align 1, !tbaa !5
store i8 %24, ptr %arrayidx.i54.1, align 1, !tbaa !5
store i8 %23, ptr %arrayidx3.i55.1, align 1, !tbaa !5
%indvars.iv.next.i56.1 = add nuw nsw i64 %indvars.iv.i52, 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 %revstr.exit58.loopexit.unr-lcssa, label %for.body.i50, !llvm.loop !8
revstr.exit58.loopexit.unr-lcssa: ; preds = %for.body.i50, %for.body.preheader.i46
%indvars.iv21.i51.unr = phi i64 [ %19, %for.body.preheader.i46 ], [ %indvars.iv.next22.i53.1, %for.body.i50 ]
%indvars.iv.i52.unr = phi i64 [ 0, %for.body.preheader.i46 ], [ %indvars.iv.next.i56.1, %for.body.i50 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %revstr.exit58, label %for.body.i50.epil
for.body.i50.epil: ; preds = %revstr.exit58.loopexit.unr-lcssa
%arrayidx.i54.epil = getelementptr inbounds i8, ptr %main, i64 %indvars.iv.i52.unr
%25 = load i8, ptr %arrayidx.i54.epil, align 1, !tbaa !5
%26 = getelementptr i8, ptr %main, i64 %indvars.iv21.i51.unr
%arrayidx3.i55.epil = getelementptr i8, ptr %26, i64 -1
%27 = load i8, ptr %arrayidx3.i55.epil, align 1, !tbaa !5
store i8 %27, ptr %arrayidx.i54.epil, align 1, !tbaa !5
store i8 %25, ptr %arrayidx3.i55.epil, align 1, !tbaa !5
br label %revstr.exit58
revstr.exit58: ; preds = %for.body.i50.epil, %revstr.exit58.loopexit.unr-lcssa, %if.else30
%call.i59 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %suf) #5
%conv.i60 = trunc i64 %call.i59 to i32
%cmp18.i61 = icmp sgt i32 %conv.i60, 1
br i1 %cmp18.i61, label %for.body.preheader.i62, label %revstr.exit74
for.body.preheader.i62: ; preds = %revstr.exit58
%div2627.i63 = lshr i64 %call.i59, 1
%sext.i64 = shl i64 %call.i59, 32
%28 = ashr exact i64 %sext.i64, 32
%wide.trip.count.i65 = and i64 %div2627.i63, 2147483647
%xtraiter81 = and i64 %div2627.i63, 1
%29 = icmp eq i64 %wide.trip.count.i65, 1
br i1 %29, label %revstr.exit74.loopexit.unr-lcssa, label %for.body.preheader.i62.new
for.body.preheader.i62.new: ; preds = %for.body.preheader.i62
%unroll_iter83 = sub nsw i64 %wide.trip.count.i65, %xtraiter81
%invariant.gep89 = getelementptr i8, ptr %suf, i64 -1
br label %for.body.i66
for.body.i66: ; preds = %for.body.i66, %for.body.preheader.i62.new
%indvars.iv21.i67 = phi i64 [ %28, %for.body.preheader.i62.new ], [ %indvars.iv.next22.i69.1, %for.body.i66 ]
%indvars.iv.i68 = phi i64 [ 0, %for.body.preheader.i62.new ], [ %indvars.iv.next.i72.1, %for.body.i66 ]
%niter84 = phi i64 [ 0, %for.body.preheader.i62.new ], [ %niter84.next.1, %for.body.i66 ]
%arrayidx.i70 = getelementptr inbounds i8, ptr %suf, i64 %indvars.iv.i68
%30 = load i8, ptr %arrayidx.i70, align 2, !tbaa !5
%gep90 = getelementptr i8, ptr %invariant.gep89, i64 %indvars.iv21.i67
%31 = load i8, ptr %gep90, align 1, !tbaa !5
store i8 %31, ptr %arrayidx.i70, align 2, !tbaa !5
store i8 %30, ptr %gep90, align 1, !tbaa !5
%indvars.iv.next.i72 = or i64 %indvars.iv.i68, 1
%indvars.iv.next22.i69.1 = add nsw i64 %indvars.iv21.i67, -2
%arrayidx.i70.1 = getelementptr inbounds i8, ptr %suf, i64 %indvars.iv.next.i72
%32 = load i8, ptr %arrayidx.i70.1, align 1, !tbaa !5
%arrayidx3.i71.1 = getelementptr inbounds i8, ptr %suf, i64 %indvars.iv.next22.i69.1
%33 = load i8, ptr %arrayidx3.i71.1, align 1, !tbaa !5
store i8 %33, ptr %arrayidx.i70.1, align 1, !tbaa !5
store i8 %32, ptr %arrayidx3.i71.1, align 1, !tbaa !5
%indvars.iv.next.i72.1 = add nuw nsw i64 %indvars.iv.i68, 2
%niter84.next.1 = add i64 %niter84, 2
%niter84.ncmp.1 = icmp eq i64 %niter84.next.1, %unroll_iter83
br i1 %niter84.ncmp.1, label %revstr.exit74.loopexit.unr-lcssa, label %for.body.i66, !llvm.loop !8
revstr.exit74.loopexit.unr-lcssa: ; preds = %for.body.i66, %for.body.preheader.i62
%indvars.iv21.i67.unr = phi i64 [ %28, %for.body.preheader.i62 ], [ %indvars.iv.next22.i69.1, %for.body.i66 ]
%indvars.iv.i68.unr = phi i64 [ 0, %for.body.preheader.i62 ], [ %indvars.iv.next.i72.1, %for.body.i66 ]
%lcmp.mod82.not = icmp eq i64 %xtraiter81, 0
br i1 %lcmp.mod82.not, label %revstr.exit74, label %for.body.i66.epil
for.body.i66.epil: ; preds = %revstr.exit74.loopexit.unr-lcssa
%arrayidx.i70.epil = getelementptr inbounds i8, ptr %suf, i64 %indvars.iv.i68.unr
%34 = load i8, ptr %arrayidx.i70.epil, align 1, !tbaa !5
%35 = getelementptr i8, ptr %suf, i64 %indvars.iv21.i67.unr
%arrayidx3.i71.epil = getelementptr i8, ptr %35, i64 -1
%36 = load i8, ptr %arrayidx3.i71.epil, align 1, !tbaa !5
store i8 %36, ptr %arrayidx.i70.epil, align 1, !tbaa !5
store i8 %34, ptr %arrayidx3.i71.epil, align 1, !tbaa !5
br label %revstr.exit74
revstr.exit74: ; preds = %for.body.i66.epil, %revstr.exit74.loopexit.unr-lcssa, %revstr.exit58
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %suf, ptr noundef nonnull %main, ptr noundef nonnull %pre)
br label %if.end37
if.end37: ; preds = %revstr.exit74, %revstr.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Q) #6
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %tmp) #6
call void @llvm.lifetime.end.p0(i64 300000, ptr nonnull %suf) #6
call void @llvm.lifetime.end.p0(i64 300000, ptr nonnull %pre) #6
call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %main) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %do_judge) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %posi_judge) #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
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
|
#include<stdio.h>
int main()
{
int t; scanf("%d",&t);
while(t--){
int n; scanf("%d",&n);
int arr[10000];
for(int i = 0; i < n; ++i) scanf("%d",arr+i);
for(int i = 0;i < n; i+=2){
printf("%d %d ",-arr[i+1],arr[i]);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10436/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10436/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d \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
%arr = alloca [10000 x i32], align 16
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
%dec24 = add nsw i32 %0, -1
store i32 %dec24, ptr %t, align 4, !tbaa !5
%tobool.not25 = icmp eq i32 %0, 0
br i1 %tobool.not25, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %arr) #4
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %1, 0
br i1 %cmp20, label %for.body, label %for.cond.cleanup6
for.cond4.preheader: ; preds = %for.body
%cmp522 = icmp sgt i32 %2, 0
br i1 %cmp522, label %for.body7, label %for.cond.cleanup6
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%add.ptr = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%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.cond4.preheader, !llvm.loop !9
for.cond.cleanup6: ; preds = %for.body7, %while.body, %for.cond4.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %arr) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
for.body7: ; preds = %for.cond4.preheader, %for.body7
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body7 ], [ 0, %for.cond4.preheader ]
%5 = or i64 %indvars.iv27, 1
%arrayidx = getelementptr inbounds [10000 x i32], ptr %arr, i64 0, i64 %5
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub = sub nsw i32 0, %6
%arrayidx9 = getelementptr inbounds [10000 x i32], ptr %arr, i64 0, i64 %indvars.iv27
%7 = load i32, ptr %arrayidx9, align 8, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub, i32 noundef %7)
%indvars.iv.next28 = add nuw i64 %indvars.iv27, 2
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = trunc i64 %indvars.iv.next28 to i32
%cmp5 = icmp sgt i32 %8, %9
br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !llvm.loop !12
while.end: ; preds = %for.cond.cleanup6, %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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max(a,b)-min(a,b))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1; rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)n,(int)n)
#define nHr(n,r) nCr((int)(n+r+1),(int)r)
#define sankaku(x) ((1+x)*x)/2
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
void initialize(){
}
int main(void){
initialize();
ll n,m,i,j,result=1;
int a[LIMIT2]={0};
char s[LIMIT1];
scanf("%lld",&n);
rep(i,n) scanf("%d",&a[i]);
for(i=n-2;i>=0;i--){
if(a[i]<=a[i+1]) continue;
else if(a[i]-a[i+1]==1){
a[i]--;
}else{
result = 0;
break;
}
}
if(result==1) printf("Yes");
else printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104402/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104402/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dx = dso_local local_unnamed_addr global [8 x i32] [i32 1, i32 0, i32 -1, i32 0, i32 1, i32 -1, i32 -1, i32 1], align 16
@dy = dso_local local_unnamed_addr global [8 x i32] [i32 0, i32 1, i32 0, i32 -1, i32 1, i32 1, i32 -1, i32 -1], align 16
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @nPr(i32 noundef %n, i32 noundef %r) local_unnamed_addr #0 {
entry:
%conv = sext i32 %r to i64
%cmp6 = icmp sgt i32 %r, 0
br i1 %cmp6, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%conv2 = sext i32 %n to i64
%xtraiter = and i64 %conv, 7
%0 = icmp ult i32 %r, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %conv, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%result.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %mul.7, %for.body ]
%i.07 = phi i64 [ 0, %for.body.lr.ph.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.7, %for.body ]
%sub = sub nsw i64 %conv2, %i.07
%mul = mul nsw i64 %result.08, %sub
%inc.neg = xor i64 %i.07, -1
%sub.1 = add i64 %inc.neg, %conv2
%mul.1 = mul nsw i64 %mul, %sub.1
%inc.1 = or i64 %i.07, 2
%sub.2 = sub nsw i64 %conv2, %inc.1
%mul.2 = mul nsw i64 %mul.1, %sub.2
%inc.2 = or i64 %i.07, 3
%sub.3 = sub nsw i64 %conv2, %inc.2
%mul.3 = mul nsw i64 %mul.2, %sub.3
%inc.3 = or i64 %i.07, 4
%sub.4 = sub nsw i64 %conv2, %inc.3
%mul.4 = mul nsw i64 %mul.3, %sub.4
%inc.4 = or i64 %i.07, 5
%sub.5 = sub nsw i64 %conv2, %inc.4
%mul.5 = mul nsw i64 %mul.4, %sub.5
%inc.5 = or i64 %i.07, 6
%sub.6 = sub nsw i64 %conv2, %inc.5
%mul.6 = mul nsw i64 %mul.5, %sub.6
%inc.6 = or i64 %i.07, 7
%sub.7 = sub nsw i64 %conv2, %inc.6
%mul.7 = mul nsw i64 %mul.6, %sub.7
%inc.7 = add nuw nsw i64 %i.07, 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 !5
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%mul.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %mul.7, %for.body ]
%result.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %mul.7, %for.body ]
%i.07.unr = phi i64 [ 0, %for.body.lr.ph ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%result.08.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %result.08.unr, %for.end.loopexit.unr-lcssa ]
%i.07.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.07.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%sub.epil = sub nsw i64 %conv2, %i.07.epil
%mul.epil = mul nsw i64 %result.08.epil, %sub.epil
%inc.epil = add nuw nsw i64 %i.07.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 !7
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %result.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @nCr(i32 noundef %n, i32 noundef %r) local_unnamed_addr #2 {
entry:
%sub = sub nsw i32 %n, %r
%cond = tail call i32 @llvm.smin.i32(i32 %sub, i32 %r)
%conv = sext i32 %cond to i64
%cmp216 = icmp sgt i32 %cond, 0
br i1 %cmp216, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%conv4 = sext i32 %n to i64
%xtraiter = and i64 %conv, 1
%0 = icmp eq i32 %cond, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %conv, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%result.018 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.017 = phi i64 [ 0, %for.body.lr.ph.new ], [ %add.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub5 = sub nsw i64 %conv4, %i.017
%mul = mul nsw i64 %result.018, %sub5
%add = or i64 %i.017, 1
%div = sdiv i64 %mul, %add
%sub5.1 = sub nsw i64 %conv4, %add
%mul.1 = mul nsw i64 %div, %sub5.1
%add.1 = add nuw nsw i64 %i.017, 2
%div.1 = sdiv i64 %mul.1, %add.1
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%result.018.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.017.unr = phi i64 [ 0, %for.body.lr.ph ], [ %add.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub5.epil = sub nsw i64 %conv4, %i.017.unr
%mul.epil = mul nsw i64 %result.018.unr, %sub5.epil
%add.epil = add nuw nsw i64 %i.017.unr, 1
%div.epil = sdiv i64 %mul.epil, %add.epil
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upint(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !10
%1 = load i32, ptr %b, align 4, !tbaa !10
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downint(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !10
%1 = load i32, ptr %b, align 4, !tbaa !10
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upchar(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %left, ptr noundef nonnull dereferenceable(1) %right) #11
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downchar(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %right, ptr noundef nonnull dereferenceable(1) %left) #11
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local void @initialize() local_unnamed_addr #6 {
entry:
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i64, align 8
%a = alloca [500002 x i32], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #12
call void @llvm.lifetime.start.p0(i64 2000008, ptr nonnull %a) #12
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000008) %a, i8 0, i64 2000008, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !14
%cmp37 = icmp sgt i64 %0, 0
br i1 %cmp37, label %for.body, label %if.end25
for.body: ; preds = %entry, %for.body
%i.038 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500002 x i32], ptr %a, i64 0, i64 %i.038
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.038, 1
%1 = load i64, ptr %n, align 8, !tbaa !14
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16
for.end: ; preds = %for.body
%cmp339 = icmp slt i64 %1, 2
br i1 %cmp339, label %if.end25, label %for.body4.preheader
for.body4.preheader: ; preds = %for.end
%sub = add nsw i64 %1, -2
br label %for.body4
for.body4: ; preds = %for.body4.preheader, %for.inc17
%i.140 = phi i64 [ %dec18, %for.inc17 ], [ %sub, %for.body4.preheader ]
%arrayidx5 = getelementptr inbounds [500002 x i32], ptr %a, i64 0, i64 %i.140
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !10
%add = add nuw nsw i64 %i.140, 1
%arrayidx6 = getelementptr inbounds [500002 x i32], ptr %a, i64 0, i64 %add
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !10
%cmp7.not = icmp sgt i32 %2, %3
br i1 %cmp7.not, label %if.else, label %for.inc17
if.else: ; preds = %for.body4
%sub11 = sub nsw i32 %2, %3
%cmp12 = icmp eq i32 %sub11, 1
br i1 %cmp12, label %if.then13, label %if.end25
if.then13: ; preds = %if.else
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %arrayidx5, align 4, !tbaa !10
br label %for.inc17
for.inc17: ; preds = %for.body4, %if.then13
%dec18 = add nsw i64 %i.140, -1
%cmp3 = icmp slt i64 %i.140, 1
br i1 %cmp3, label %if.end25, label %for.body4, !llvm.loop !17
if.end25: ; preds = %if.else, %for.inc17, %for.end, %entry
%.str.3.sink = phi ptr [ @.str.2, %entry ], [ @.str.2, %for.end ], [ @.str.2, %for.inc17 ], [ @.str.3, %if.else ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 2000008, ptr nonnull %a) #12
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #12
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #10
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(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 = { 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 #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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.unroll.disable"}
!9 = distinct !{!9, !6}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !12, i64 0}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
|
/* Coached by Dukkha */
#include <stdio.h>
#define N 100000
int main() {
static int hh[N];
int n, i;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &hh[i]);
for (i = n - 2; i >= 0; i--)
if (hh[i] > hh[i + 1])
hh[i]--;
for (i = 0; i < n - 1; i++)
if (hh[i] > hh[i + 1]) {
printf("No\n");
return 0;
}
printf("Yes\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104446/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104446/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@main.hh = internal global [100000 x i32] zeroinitializer, align 16
@.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.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp46 = icmp sgt i32 %0, 0
br i1 %cmp46, label %for.body, label %for.cond15.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp348 = icmp sgt i32 %1, 1
br i1 %cmp348, label %for.body4.preheader, label %for.cond15.preheader
for.body4.preheader: ; preds = %for.end
%sub = add i32 %1, -2
%3 = zext i32 %sub to i64
%4 = and i64 %3, 1
%lcmp.mod.not.not = icmp eq i64 %4, 0
br i1 %lcmp.mod.not.not, label %for.body4.prol, label %for.body4.prol.loopexit
for.body4.prol: ; preds = %for.body4.preheader
%arrayidx6.prol = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %3
%5 = load i32, ptr %arrayidx6.prol, align 4, !tbaa !5
%6 = add nuw nsw i64 %3, 1
%arrayidx8.prol = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %6
%7 = load i32, ptr %arrayidx8.prol, align 4, !tbaa !5
%cmp9.prol = icmp sgt i32 %5, %7
br i1 %cmp9.prol, label %if.then.prol, label %for.inc12.prol
if.then.prol: ; preds = %for.body4.prol
%dec.prol = add nsw i32 %5, -1
store i32 %dec.prol, ptr %arrayidx6.prol, align 4, !tbaa !5
br label %for.inc12.prol
for.inc12.prol: ; preds = %if.then.prol, %for.body4.prol
%indvars.iv.next53.prol = add nsw i64 %3, -1
br label %for.body4.prol.loopexit
for.body4.prol.loopexit: ; preds = %for.inc12.prol, %for.body4.preheader
%indvars.iv52.unr = phi i64 [ %3, %for.body4.preheader ], [ %indvars.iv.next53.prol, %for.inc12.prol ]
%8 = icmp eq i32 %sub, 0
br i1 %8, label %for.cond15.preheader, label %for.body4
for.cond15.preheader: ; preds = %for.body4.prol.loopexit, %for.inc12.1, %entry, %for.end
%.lcssa61 = phi i32 [ %1, %for.end ], [ %0, %entry ], [ %1, %for.inc12.1 ], [ %1, %for.body4.prol.loopexit ]
%9 = call i32 @llvm.smax.i32(i32 %.lcssa61, i32 1)
%smax = add nsw i32 %9, -1
%wide.trip.count = zext i32 %smax to i64
br label %for.cond15
for.body4: ; preds = %for.body4.prol.loopexit, %for.inc12.1
%indvars.iv52 = phi i64 [ %indvars.iv.next53.1, %for.inc12.1 ], [ %indvars.iv52.unr, %for.body4.prol.loopexit ]
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv52
%10 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%11 = add nuw nsw i64 %indvars.iv52, 1
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %11
%12 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %10, %12
br i1 %cmp9, label %if.then, label %for.inc12
if.then: ; preds = %for.body4
%dec = add nsw i32 %10, -1
store i32 %dec, ptr %arrayidx6, align 4, !tbaa !5
br label %for.inc12
for.inc12: ; preds = %for.body4, %if.then
%indvars.iv.next53 = add nsw i64 %indvars.iv52, -1
%arrayidx6.1 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv.next53
%13 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%arrayidx8.1 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv52
%14 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%cmp9.1 = icmp sgt i32 %13, %14
br i1 %cmp9.1, label %if.then.1, label %for.inc12.1
if.then.1: ; preds = %for.inc12
%dec.1 = add nsw i32 %13, -1
store i32 %dec.1, ptr %arrayidx6.1, align 4, !tbaa !5
br label %for.inc12.1
for.inc12.1: ; preds = %if.then.1, %for.inc12
%indvars.iv.next53.1 = add nsw i64 %indvars.iv52, -2
%cmp3.1 = icmp sgt i64 %indvars.iv52, 1
br i1 %cmp3.1, label %for.body4, label %for.cond15.preheader, !llvm.loop !11
for.cond15: ; preds = %for.cond15.preheader, %for.body18
%indvars.iv56 = phi i64 [ 0, %for.cond15.preheader ], [ %indvars.iv.next57, %for.body18 ]
%exitcond.not = icmp eq i64 %indvars.iv56, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body18
for.body18: ; preds = %for.cond15
%arrayidx20 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv56
%15 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%arrayidx23 = getelementptr inbounds [100000 x i32], ptr @main.hh, i64 0, i64 %indvars.iv.next57
%16 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %15, %16
br i1 %cmp24, label %cleanup, label %for.cond15, !llvm.loop !12
cleanup: ; preds = %for.cond15, %for.body18
%str.sink = phi ptr [ @str.3, %for.body18 ], [ @str, %for.cond15 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int t,i,n[1001],a[101],j,p[1001][101];
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&n[i]);
for(j=0;j<n[i];j++)
{
scanf("%d",&a[j]);
}
for(j=0;j<n[i];j=j+2)
{
p[i][j]=a[j+1];
p[i][j+1]=(a[j]*(-1));
}
}
for(i=0;i<t;i++)
{
for(j=0;j<n[i];j++)
{
printf("%d ",p[i][j]);
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10449/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10449/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca [1001 x i32], align 16
%a = alloca [101 x i32], align 16
%p = alloca [1001 x [101 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 404404, ptr nonnull %p) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp79 = icmp sgt i32 %0, 0
br i1 %cmp79, label %for.body.preheader, label %for.end53
for.body.preheader: ; preds = %entry
%invariant.gep = getelementptr i32, ptr %a, i64 -1
%invariant.gep113 = getelementptr i32, ptr %a, i64 -1
%invariant.gep115 = getelementptr i32, ptr %p, i64 -1
%invariant.gep117 = getelementptr i32, ptr %p, i64 -1
br label %for.body
for.cond34.preheader: ; preds = %for.inc31
%1 = icmp sgt i32 %17, 0
br i1 %1, label %for.cond37.preheader, label %for.end53
for.body: ; preds = %for.body.preheader, %for.inc31
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %for.inc31 ], [ 0, %for.body.preheader ]
%arrayidx = getelementptr inbounds [1001 x i32], ptr %n, i64 0, i64 %indvars.iv91
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp575 = icmp sgt i32 %2, 0
br i1 %cmp575, label %for.body6, label %for.inc31
for.cond10.preheader: ; preds = %for.body6
%cmp1377 = icmp sgt i32 %12, 0
br i1 %cmp1377, label %for.body14.preheader, label %for.inc31
for.body14.preheader: ; preds = %for.cond10.preheader
%3 = zext i32 %12 to i64
%4 = add nsw i64 %3, -1
%5 = lshr i64 %4, 1
%6 = add nuw i64 %5, 1
%min.iters.check = icmp ult i32 %12, 7
br i1 %min.iters.check, label %for.body14.preheader110, label %vector.ph
vector.ph: ; preds = %for.body14.preheader
%n.vec = and i64 %6, -4
%ind.end = shl i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = shl i64 %index, 1
%7 = or i64 %offset.idx, 1
%8 = or i64 %offset.idx, 5
%gep = getelementptr [101 x i32], ptr %invariant.gep, i64 0, i64 %7
%gep114 = getelementptr [101 x i32], ptr %invariant.gep113, i64 0, i64 %8
%wide.vec = load <4 x i32>, ptr %gep, align 16, !tbaa !5
%wide.vec105 = load <4 x i32>, ptr %gep114, align 16, !tbaa !5
%strided.vec = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
%strided.vec106 = shufflevector <4 x i32> %wide.vec105, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
%strided.vec107 = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
%strided.vec108 = shufflevector <4 x i32> %wide.vec105, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
%9 = sub nsw <2 x i32> zeroinitializer, %strided.vec
%10 = sub nsw <2 x i32> zeroinitializer, %strided.vec106
%gep116 = getelementptr [1001 x [101 x i32]], ptr %invariant.gep115, i64 0, i64 %indvars.iv91, i64 %7
%gep118 = getelementptr [1001 x [101 x i32]], ptr %invariant.gep117, i64 0, i64 %indvars.iv91, i64 %8
%interleaved.vec = shufflevector <2 x i32> %strided.vec107, <2 x i32> %9, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %gep116, align 4, !tbaa !5
%interleaved.vec109 = shufflevector <2 x i32> %strided.vec108, <2 x i32> %10, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec109, ptr %gep118, align 4, !tbaa !5
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.inc31, label %for.body14.preheader110
for.body14.preheader110: ; preds = %for.body14.preheader, %middle.block
%indvars.iv87.ph = phi i64 [ 0, %for.body14.preheader ], [ %ind.end, %middle.block ]
br label %for.body14
for.body6: ; preds = %for.body, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 0, %for.body ]
%arrayidx8 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %arrayidx, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp5 = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp5, label %for.body6, label %for.cond10.preheader, !llvm.loop !13
for.body14: ; preds = %for.body14.preheader110, %for.body14
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body14 ], [ %indvars.iv87.ph, %for.body14.preheader110 ]
%14 = or i64 %indvars.iv87, 1
%arrayidx16 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %14
%15 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%arrayidx20 = getelementptr inbounds [1001 x [101 x i32]], ptr %p, i64 0, i64 %indvars.iv91, i64 %indvars.iv87
store i32 %15, ptr %arrayidx20, align 4, !tbaa !5
%arrayidx22 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv87
%16 = load i32, ptr %arrayidx22, align 8, !tbaa !5
%mul = sub nsw i32 0, %16
%arrayidx27 = getelementptr inbounds [1001 x [101 x i32]], ptr %p, i64 0, i64 %indvars.iv91, i64 %14
store i32 %mul, ptr %arrayidx27, align 4, !tbaa !5
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 2
%cmp13 = icmp ult i64 %indvars.iv.next88, %3
br i1 %cmp13, label %for.body14, label %for.inc31, !llvm.loop !14
for.inc31: ; preds = %for.body14, %middle.block, %for.body, %for.cond10.preheader
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%17 = load i32, ptr %t, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp = icmp slt i64 %indvars.iv.next92, %18
br i1 %cmp, label %for.body, label %for.cond34.preheader, !llvm.loop !15
for.cond37.preheader: ; preds = %for.cond34.preheader, %for.end49
%indvars.iv97 = phi i64 [ %indvars.iv.next98, %for.end49 ], [ 0, %for.cond34.preheader ]
%arrayidx39 = getelementptr inbounds [1001 x i32], ptr %n, i64 0, i64 %indvars.iv97
%19 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp4081 = icmp sgt i32 %19, 0
br i1 %cmp4081, label %for.body41, label %for.end49
for.body41: ; preds = %for.cond37.preheader, %for.body41
%indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.body41 ], [ 0, %for.cond37.preheader ]
%arrayidx45 = getelementptr inbounds [1001 x [101 x i32]], ptr %p, i64 0, i64 %indvars.iv97, i64 %indvars.iv94
%20 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %20)
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%21 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp40 = icmp slt i64 %indvars.iv.next95, %22
br i1 %cmp40, label %for.body41, label %for.end49, !llvm.loop !16
for.end49: ; preds = %for.body41, %for.cond37.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
%23 = load i32, ptr %t, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp35 = icmp slt i64 %indvars.iv.next98, %24
br i1 %cmp35, label %for.cond37.preheader, label %for.end53, !llvm.loop !17
for.end53: ; preds = %for.end49, %entry, %for.cond34.preheader
call void @llvm.lifetime.end.p0(i64 404404, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
int main(){
int N;
int H[100010];
scanf("%d",&N);
int i;
for(i=1;i<=N;i++){
scanf("%d",&H[i]);
}
for(i=N;i>=2;i--){
if(H[i-1]>H[i]){
H[i-1]=H[i-1]-1;
}
}
for(i=2;i<=N;i++){
if(H[i-1]>H[i]){
printf("No");
return 0;
}
}
printf("Yes");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104532/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104532/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%H = alloca [100010 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %H) #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.not50 = icmp slt i32 %0, 1
br i1 %cmp.not50, label %cleanup, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp352 = icmp sgt i32 %53, 1
br i1 %cmp352, label %for.body4.preheader, label %cleanup
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %53 to i64
%2 = add nsw i64 %1, -1
%min.iters.check = icmp ult i32 %53, 53
br i1 %min.iters.check, label %for.body4.preheader93, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body4.preheader
%3 = add nsw i64 %1, -2
%4 = add i32 %53, -1
%5 = trunc i64 %3 to i32
%6 = icmp ult i32 %4, %5
%7 = icmp ugt i64 %3, 4294967295
%8 = or i1 %6, %7
%9 = zext i32 %4 to i64
%10 = shl nuw nsw i64 %9, 2
%scevgep = getelementptr i8, ptr %H, i64 %10
%mul.result72.neg = mul nsw i64 %3, -4
%11 = getelementptr i8, ptr %scevgep, i64 %mul.result72.neg
%12 = icmp ugt ptr %11, %scevgep
%13 = shl nuw nsw i64 %1, 2
%scevgep74 = getelementptr i8, ptr %H, i64 %13
%mul.result76.neg = mul nsw i64 %3, -4
%14 = getelementptr i8, ptr %scevgep74, i64 %mul.result76.neg
%15 = icmp ugt ptr %14, %scevgep74
%16 = or i1 %12, %8
%17 = or i1 %15, %16
br i1 %17, label %for.body4.preheader93, label %vector.memcheck
vector.memcheck: ; preds = %vector.scevcheck
%umin78 = call i64 @llvm.umin.i64(i64 %1, i64 2)
%18 = shl nuw nsw i64 %umin78, 2
%19 = add i32 %53, -1
%20 = zext i32 %19 to i64
%21 = shl nuw nsw i64 %20, 2
%22 = add nuw nsw i64 %18, %21
%23 = shl nuw nsw i64 %1, 2
%24 = sub nsw i64 %22, %23
%scevgep79 = getelementptr i8, ptr %H, i64 %24
%scevgep80 = getelementptr inbounds i8, ptr %H, i64 4
%scevgep81 = getelementptr i8, ptr %scevgep80, i64 %21
%scevgep82 = getelementptr i8, ptr %H, i64 %18
%scevgep83 = getelementptr i8, ptr %scevgep80, i64 %23
%bound0 = icmp ult ptr %scevgep79, %scevgep83
%bound1 = icmp ult ptr %scevgep82, %scevgep81
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body4.preheader93, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %2, -4
%ind.end = sub nsw i64 %1, %n.vec
%invariant.gep = getelementptr i32, ptr %H, i64 -3
%invariant.gep94 = getelementptr i32, ptr %H, i64 -3
br label %vector.body
vector.body: ; preds = %pred.store.continue92, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue92 ]
%offset.idx = sub i64 %1, %index
%25 = add i64 %offset.idx, 4294967295
%26 = and i64 %25, 4294967295
%gep = getelementptr [100010 x i32], ptr %invariant.gep, i64 0, i64 %26
%wide.load = load <4 x i32>, ptr %gep, align 4, !tbaa !5, !alias.scope !9, !noalias !12
%gep95 = getelementptr [100010 x i32], ptr %invariant.gep94, i64 0, i64 %offset.idx
%wide.load85 = load <4 x i32>, ptr %gep95, align 4, !tbaa !5, !alias.scope !12
%27 = icmp sgt <4 x i32> %wide.load, %wide.load85
%28 = extractelement <4 x i1> %27, i64 3
br i1 %28, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%29 = add i64 %offset.idx, 4294967295
%30 = and i64 %29, 4294967295
%31 = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 %30
%32 = extractelement <4 x i32> %wide.load, i64 3
%33 = add nsw i32 %32, -1
store i32 %33, ptr %31, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%34 = extractelement <4 x i1> %27, i64 2
br i1 %34, label %pred.store.if87, label %pred.store.continue88
pred.store.if87: ; preds = %pred.store.continue
%35 = add i64 %offset.idx, 4294967294
%36 = and i64 %35, 4294967295
%37 = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 %36
%38 = extractelement <4 x i32> %wide.load, i64 2
%39 = add nsw i32 %38, -1
store i32 %39, ptr %37, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue88
pred.store.continue88: ; preds = %pred.store.if87, %pred.store.continue
%40 = extractelement <4 x i1> %27, i64 1
br i1 %40, label %pred.store.if89, label %pred.store.continue90
pred.store.if89: ; preds = %pred.store.continue88
%41 = add i64 %offset.idx, 4294967293
%42 = and i64 %41, 4294967295
%43 = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 %42
%44 = extractelement <4 x i32> %wide.load, i64 1
%45 = add nsw i32 %44, -1
store i32 %45, ptr %43, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue90
pred.store.continue90: ; preds = %pred.store.if89, %pred.store.continue88
%46 = extractelement <4 x i1> %27, i64 0
br i1 %46, label %pred.store.if91, label %pred.store.continue92
pred.store.if91: ; preds = %pred.store.continue90
%47 = add i64 %offset.idx, 4294967292
%48 = and i64 %47, 4294967295
%49 = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 %48
%50 = extractelement <4 x i32> %wide.load, i64 0
%51 = add nsw i32 %50, -1
store i32 %51, ptr %49, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue92
pred.store.continue92: ; preds = %pred.store.if91, %pred.store.continue90
%index.next = add nuw i64 %index, 4
%52 = icmp eq i64 %index.next, %n.vec
br i1 %52, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %pred.store.continue92
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.cond19.preheader, label %for.body4.preheader93
for.body4.preheader93: ; preds = %vector.memcheck, %vector.scevcheck, %for.body4.preheader, %middle.block
%indvars.iv58.ph = phi i64 [ %1, %vector.memcheck ], [ %1, %vector.scevcheck ], [ %1, %for.body4.preheader ], [ %ind.end, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%53 = load i32, ptr %N, align 4, !tbaa !5
%54 = sext i32 %53 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %54
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !18
for.cond19.preheader: ; preds = %for.inc17, %middle.block
%cmp20.not54 = icmp slt i32 %53, 2
br i1 %cmp20.not54, label %cleanup, label %for.body21.preheader
for.body21.preheader: ; preds = %for.cond19.preheader
%55 = add nuw i32 %53, 1
%wide.trip.count = zext i32 %55 to i64
%arrayidx24.phi.trans.insert = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 1
%.pre = load i32, ptr %arrayidx24.phi.trans.insert, align 4, !tbaa !5
br label %for.body21
for.body4: ; preds = %for.body4.preheader93, %for.inc17
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.inc17 ], [ %indvars.iv58.ph, %for.body4.preheader93 ]
%indvars.iv.next59 = add nsw i64 %indvars.iv58, -1
%idxprom5 = and i64 %indvars.iv.next59, 4294967295
%arrayidx6 = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 %idxprom5
%56 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%arrayidx8 = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 %indvars.iv58
%57 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %56, %57
br i1 %cmp9, label %if.then, label %for.inc17
if.then: ; preds = %for.body4
%sub13 = add nsw i32 %56, -1
store i32 %sub13, ptr %arrayidx6, align 4, !tbaa !5
br label %for.inc17
for.inc17: ; preds = %for.body4, %if.then
%cmp3 = icmp ugt i64 %indvars.iv58, 2
br i1 %cmp3, label %for.body4, label %for.cond19.preheader, !llvm.loop !19
for.cond19: ; preds = %for.body21
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body21, !llvm.loop !20
for.body21: ; preds = %for.body21.preheader, %for.cond19
%58 = phi i32 [ %.pre, %for.body21.preheader ], [ %59, %for.cond19 ]
%indvars.iv61 = phi i64 [ 2, %for.body21.preheader ], [ %indvars.iv.next62, %for.cond19 ]
%arrayidx26 = getelementptr inbounds [100010 x i32], ptr %H, i64 0, i64 %indvars.iv61
%59 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %58, %59
br i1 %cmp27, label %cleanup, label %for.cond19
cleanup: ; preds = %for.cond19, %for.body21, %for.cond19.preheader, %for.cond2.preheader, %entry
%.str.2.sink = phi ptr [ @.str.2, %entry ], [ @.str.2, %for.cond2.preheader ], [ @.str.2, %for.cond19.preheader ], [ @.str.1, %for.body21 ], [ @.str.2, %for.cond19 ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %H) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10}
!10 = distinct !{!10, !11}
!11 = distinct !{!11, !"LVerDomain"}
!12 = !{!13}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !15, !16, !17}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15, !16}
!20 = distinct !{!20, !15}
|
#include<stdio.h>
int main(){
int n,i;
long long h[100000];
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%lld",&h[i]);
for(i=n-1;i>0;i--){
if(h[i]-h[i-1]<-1){
puts("No");
return 0;
}else if(h[i]-h[i-1]==-1)h[i-1]--;
}
puts("Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104576/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104576/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%h = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %cleanup
for.cond2.preheader: ; preds = %for.body
%cmp343 = icmp sgt i32 %2, 1
br i1 %cmp343, label %for.body4.preheader, label %cleanup
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc25
%indvars.iv48 = phi i64 [ %1, %for.body4.preheader ], [ %indvars.iv.next49, %for.inc25 ]
%indvars.iv.next49 = add nsw i64 %indvars.iv48, -1
%idxprom5 = and i64 %indvars.iv.next49, 4294967295
%arrayidx6 = getelementptr inbounds [100000 x i64], ptr %h, i64 0, i64 %idxprom5
%4 = load i64, ptr %arrayidx6, align 8, !tbaa !11
%sub7 = add nuw i64 %indvars.iv48, 4294967294
%idxprom8 = and i64 %sub7, 4294967295
%arrayidx9 = getelementptr inbounds [100000 x i64], ptr %h, i64 0, i64 %idxprom8
%5 = load i64, ptr %arrayidx9, align 8, !tbaa !11
%sub10 = sub nsw i64 %4, %5
%cmp11 = icmp slt i64 %sub10, -1
br i1 %cmp11, label %cleanup, label %if.else
if.else: ; preds = %for.body4
%cmp19 = icmp eq i64 %sub10, -1
br i1 %cmp19, label %if.then20, label %for.inc25
if.then20: ; preds = %if.else
%dec = add nsw i64 %5, -1
store i64 %dec, ptr %arrayidx9, align 8, !tbaa !11
br label %for.inc25
for.inc25: ; preds = %if.then20, %if.else
%cmp3 = icmp ugt i64 %indvars.iv48, 2
br i1 %cmp3, label %for.body4, label %cleanup, !llvm.loop !13
cleanup: ; preds = %for.inc25, %for.body4, %for.cond2.preheader, %entry
%.str.3.sink = phi ptr [ @.str.3, %entry ], [ @.str.3, %for.cond2.preheader ], [ @.str.2, %for.body4 ], [ @.str.3, %for.inc25 ]
%call28 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
char s;
scanf("%c",&s);
printf("%s",((s=='a')+(s=='i')+(s=='u')+(s=='e')+(s=='o'))?"vowel":"consonant");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104619/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104619/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%1 = insertelement <4 x i8> poison, i8 %0, i64 0
%2 = shufflevector <4 x i8> %1, <4 x i8> poison, <4 x i32> zeroinitializer
%3 = icmp eq <4 x i8> %2, <i8 105, i8 97, i8 117, i8 101>
%4 = bitcast <4 x i1> %3 to i4
%5 = call i4 @llvm.ctpop.i4(i4 %4), !range !8
%cmp14 = icmp eq i8 %0, 111
%6 = sext i1 %cmp14 to i4
%tobool.not = icmp eq i4 %5, %6
%cond = select i1 %tobool.not, ptr @.str.3, ptr @.str.2
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %cond)
call void @llvm.lifetime.end.p0(i64 1, 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i4 @llvm.ctpop.i4(i4) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{i4 0, i4 5}
|
#include<stdio.h>
int main(){
char c;
scanf("%c", &c);
if(c == 'a'){
printf("vowel");
}else if(c == 'i'){
printf("vowel");
}else if(c == 'u'){
printf("vowel");
}else if(c == 'e'){
printf("vowel");
}else if(c == 'o'){
printf("vowel");
}else{
printf("consonant");}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104662/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104662/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@reltable.main = private unnamed_addr constant [11 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%1 = add i8 %0, -97
%2 = call i8 @llvm.fshl.i8(i8 %1, i8 %1, i8 7)
%3 = icmp ult i8 %2, 11
br i1 %3, label %switch.lookup, label %if.end31
switch.lookup: ; preds = %entry
%4 = sext i8 %2 to i64
%reltable.shift = shl i64 %4, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end31
if.end31: ; preds = %entry, %switch.lookup
%.str.1.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.fshl.i8(i8, i8, i8) #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
char str[4];
fgets(str,4,stdin);
if ((str[0] == 'a') || (str[0] == 'i') || (str[0] == 'u') || (str[0] == 'e') || (str[0] == 'o'))
{
printf("vowel\n");
}
else
{
printf("consonant\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104705/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104705/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@str.2 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@reltable.main = private unnamed_addr constant [11 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %str) #6
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 4, ptr noundef %0)
%1 = load i8, ptr %str, align 1
%2 = add i8 %1, -97
%3 = call i8 @llvm.fshl.i8(i8 %2, i8 %2, i8 7)
%4 = icmp ult i8 %3, 11
br i1 %4, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%5 = sext i8 %3 to i64
%reltable.shift = shl i64 %5, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%str.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str, %entry ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %str) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.fshl.i8(i8, i8, i8) #4
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #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 nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int i=0,x=0;
char sip[100];
char sck[6] = {'a','i','u','e','o','\0'};
scanf("%100s",sip);
for(i;i <= 4;i++)
{if(sip[0] != sck[i])
{x++;}
}
if(x == 4)
{
printf("vowel\n");
}
else
{
printf("consonant\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104749/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104749/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%100s\00", align 1
@str = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@str.3 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%sip = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %sip) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sip)
%0 = load i8, ptr %sip, align 16, !tbaa !5
%1 = insertelement <4 x i8> poison, i8 %0, i64 0
%2 = shufflevector <4 x i8> %1, <4 x i8> poison, <4 x i32> zeroinitializer
%3 = icmp ne <4 x i8> %2, <i8 105, i8 97, i8 117, i8 101>
%cmp3.not.4 = icmp ne i8 %0, 111
%inc.4 = zext i1 %cmp3.not.4 to i32
%4 = bitcast <4 x i1> %3 to i4
%5 = call i4 @llvm.ctpop.i4(i4 %4), !range !8
%6 = zext i4 %5 to i32
%op.rdx = add nuw nsw i32 %6, %inc.4
%cmp6 = icmp eq i32 %op.rdx, 4
%str.3.str = select i1 %cmp6, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %sip) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i4 @llvm.ctpop.i4(i4) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{i4 0, i4 5}
|
#include<stdio.h>
int main(void)
{
char a;
scanf("%c",&a);
if(a=='a' || a=='i' || a=='u' || a=='e' || a=='o'){
printf("vowel");
}
else{
printf("consonant");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104806/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104806/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@reltable.main = private unnamed_addr constant [11 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i8, ptr %a, align 1
%1 = add i8 %0, -97
%2 = call i8 @llvm.fshl.i8(i8 %1, i8 %1, i8 7)
%3 = icmp ult i8 %2, 11
br i1 %3, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%4 = sext i8 %2 to i64
%reltable.shift = shl i64 %4, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.fshl.i8(i8, i8, i8) #3
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main()
{
char c;
scanf("%c", &c);
switch(c){
case 'a':
printf("vowel\n");
break;
case 'i':
printf("vowel\n");
break;
case 'u':
printf("vowel\n");
break;
case 'e':
printf("vowel\n");
break;
case 'o':
printf("vowel\n");
break;
default:
printf("consonant\n");
break;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104857/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104857/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@str.6 = private unnamed_addr constant [6 x i8] c"vowel\00", align 1
@str.7 = private unnamed_addr constant [10 x i8] c"consonant\00", align 1
@reltable.main = private unnamed_addr constant [11 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.6 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.7 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.6 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.7 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.6 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.7 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.7 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.6 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.7 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.7 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.6 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%1 = add nsw i32 %conv, -97
%2 = call i32 @llvm.fshl.i32(i32 %1, i32 %1, i32 31)
%3 = icmp ult i32 %2, 11
br i1 %3, label %switch.lookup, label %sw.epilog
switch.lookup: ; preds = %entry
%4 = sext i32 %2 to i64
%reltable.shift = shl i64 %4, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %sw.epilog
sw.epilog: ; preds = %entry, %switch.lookup
%str.7.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str.7, %entry ]
%puts15 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 1, 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 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.fshl.i32(i32, i32, i32) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
for(i=n;i<=10^9;i++)
{
if(i%2==0 && i%n==0)
{
printf("%d",i);
break;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104943/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104943/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i32 [ %0, %entry ], [ %inc, %for.inc ]
%1 = and i32 %i.0, 1
%cmp1 = icmp eq i32 %1, 0
br i1 %cmp1, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.cond
%rem3 = srem i32 %i.0, %0
%cmp4 = icmp eq i32 %rem3, 0
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.inc: ; preds = %for.cond, %land.lhs.true
%inc = add nsw i32 %i.0, 1
br label %for.cond, !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: 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"}
|